using System;
using System.Web.Mvc;
using WX.CRM.Common;
using WX.CRM.IBLL.Soft;
using WX.CRM.Model.Enum;
using WX.CRM.WebHelper;
namespace WX.CRM.WEB.Controllers.Soft
{
public class SoftallocateLogController : BaseController
{
//
// GET: /SoftallocateLog/
[Ninject.Inject]
public ISOFT_ALLOCATERESLOG_Q _ALLOCATERESLOG_Q { get; set; }
[AuthorizeRedirect(Roles = InitRights.CONST_软件客户分配日志)]
public ActionResult softAllocateLog()
{
ToolBar tool = new ToolBar();
Pager pager = new Pager() { page = 1, rows = 10 };
string tableId = "tablist";
Table tab = new Table(tableId);
tab.AddHeadCol("SOFTNAME", "", "软件用户名");
tab.AddHeadCol("RESID", "", "客户ID");
tab.AddHeadCol("ALLOCATETYPE", "", "分配方式");
tab.AddHeadCol("OPUSERID", "", "分配操作员");
tab.AddHeadCol("OPTIME", "", "分配时间");
tab.AddHeadCol("ORGSALESID", "", "原有");
tab.AddHeadCol("NEWSALESID", "", "新分配");
tab.AddHeadCol("OPREMART", "", "备注");
tab.AddHeadRow();
ViewBag.List = tab.GetTable() + Pagination.GetPage(pager, tableId, "5,8,10,15");
return View();
}
[HttpPost]
///
/// 按照条件获取数据
///
///
///
///
[AuthorizeRedirect(Roles = InitRights.CONST_软件客户分配日志)]
public ActionResult GeSoftLogList(Pager pager, string export, string columns)
{
string username = Request.Form["username"];
DateTime? stime = Request.Form["stime"].GetDateTime();
DateTime? etime = Request.Form["etime"].GetDateTime();
decimal _oldUserid = InnerUserHelper.Instance.GetUserIdByEid(Request.Form["oldEid"].GetDecimal());
decimal _newUserid = InnerUserHelper.Instance.GetUserIdByEid(Request.Form["newEid"].GetDecimal());
decimal _opUserid = InnerUserHelper.Instance.GetUserIdByEid(Request.Form["opEid"].GetDecimal());
var list = _ALLOCATERESLOG_Q.GetSOFT_ALLOCATERESLOG(ref pager, username, _oldUserid, _newUserid, _opUserid, stime, etime);
Table table = new Table(columns, true);
table.gridPager = pager;
foreach (var model in list)
{
table.AddCol(PhoneHelper.FormatPhoneUserName(model.SOFTNAME));
table.AddCol(model.RESID);
table.AddCol(Utility.GetEnumNameByValue(Convert.ToInt32(model.ALLOCATETYPE)));
table.AddCol(InnerUserHelper.Instance.EidAndName(model.OPUSERID));
table.AddCol(model.OPTIME);
table.AddCol(InnerUserHelper.Instance.EidAndName(model.ORGSALESID));
table.AddCol(InnerUserHelper.Instance.EidAndName(model.NEWSALESID));
table.AddCol(model.OPREMART);
table.AddRow();
}
var json = new
{
totalPages = pager.totalPages,
totalRows = pager.totalRows,
rowsList = table.GetRows()
};
return Json(json, JsonRequestBehavior.AllowGet);
}
}
}