using System; using System.Collections.Generic; using System.Web.Mvc; using WX.CRM.Common; using WX.CRM.IBLL.QH; using WX.CRM.Model.Entity; using WX.CRM.WebHelper; namespace WX.CRM.WEB.Controllers.QH { public class MyCustomerController : BaseController { // // GET: /MyCustomer/ private IQH_CUSTOMER _iqh_Customer; public MyCustomerController(IQH_CUSTOMER iQH_CUSTOMER) { this._iqh_Customer = iQH_CUSTOMER; } [AuthorizeRedirect(Roles = InitRights.CONST_期货我的客户信息列表)] public ActionResult Index() { ToolBar tool = new ToolBar(); string[] toolbtn = new ToolButtonView().ToolButtonRight(InitRights.期货我的客户信息列表, userRightId); tool.AllowButton(toolbtn); tool.AddOtherButton("Other1", "分成申请", "icon-details", "FCApplica_Click", true); tool.AddOtherButton("Other2", "导出", "icon-export", "export_Click", true); ViewBag.ToolBar = tool; Pager pager = new Pager() { page = 1, rows = 10 }; string tableId = "tablist"; Table tab = new Table(tableId); tab.AddHiddenHeadCol("PKID", "PKID"); tab.AddHeadCol("USERACCOUNT", "", "资金账号"); tab.AddHeadCol("USERNAME", "", "客户名称"); tab.AddHeadCol("ORGANTYPE", "", "机构类别"); tab.AddHeadCol("KFFXL", "", "客户风险率"); tab.AddHeadCol("PCYK", "", "平仓盈亏"); tab.AddHeadCol("CCYK", "", "持仓盈亏"); tab.AddHeadCol("DRYK", "", "当日盈亏"); tab.AddHeadCol("CJSS", "", "成交手数"); tab.AddHeadCol("BZJ", "", "保证金"); tab.AddHeadCol("JYK", "", "净盈亏"); tab.AddHeadCol("RQ", "", "日期"); tab.AddHeadCol("ZYHZ", "", "质押划转"); tab.AddHeadCol("QYHZ", "", "权益划转"); tab.AddHeadCol("CTIME", "", "创建日期"); tab.AddHeadRow(); ViewBag.List = tab.GetTable() + Pagination.GetPage(pager, tableId, "5,8,10,15"); return View(); } public ActionResult GetHtml(Pager pager, string userAccount, string name, string organType, DateTime? starttime, DateTime? endtime, string columns) { try { List list = _iqh_Customer.GetList(ref pager, UserId, userAccount, name, organType, starttime, endtime); Table table = new Table(columns, true); table.gridPager = pager; foreach (QH_CUSTOMER model in list) { table.AddHiddenCol(model.PKID); table.AddCol(model.USERACCOUNT); //table.AddCol(model.USERNAME); //table.AddCol(model.ORGANTYPE); //table.AddCol(model.KFFXL); //table.AddCol(model.PCYK); //table.AddCol(model.CCYK); //table.AddCol(model.DRYK); //table.AddCol(model.CJSS); //table.AddCol(model.BZJ); //table.AddCol(model.JYK); //table.AddCol(model.RQ); //table.AddCol(model.ZYHZ); //table.AddCol(model.QYHZ); table.AddCol(model.CTIME); table.AddRow(); } var json = new { totalPages = pager.totalPages, totalRows = pager.totalRows, rowsList = table.GetRows() }; return Json(json, JsonRequestBehavior.AllowGet); } catch (Exception ex) { LogHelper.Error(ex.ToString()); return JsonHandler.ManageMessage(ex.Message, false); } } #region 客户信息列表导出 public FileResult Export(string userAccount, string name, string organType, DateTime? starttime, DateTime? endtime) { string checkedFilds = PageRequest.GetQueryString("checkedFilds"); checkedFilds = checkedFilds.Replace("[]", ""); string checkedTitles = PageRequest.GetQueryString("checkedTitles"); Pager pager = new Pager() { page = 1, rows = int.MaxValue }; List list = _iqh_Customer.GetList(ref pager, UserId, userAccount, name, organType, starttime, endtime); return File(ExcelHelper.ExportListModelToExcel(list, "期货我的客户信息列表", 10000, checkedFilds, checkedTitles, null), "application/ms-excel", PageRequest.GetDlownLoadName("期货我的客户信息列表.xls")); } #endregion } }