TG.WXCRM.V4/WEB/Controllers/QH/QHCustomerController.cs

120 lines
5.2 KiB
C#

using Ninject;
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 QHCustomerController : BaseController
{
//
// GET: /Customer/
private IQH_CUSTOMER _iqh_Customer;
[Inject]
public IQH_CAPITALDETAIL QH_CapitalDetail_BL { get; set; }
public QHCustomerController(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-export", "export_Click", true);
ViewBag.ToolBar = tool;
Pager pager = new Pager() { page = 1, rows = 20 };
string tableId = "tablist";
Table tab = new Table(tableId);
tab.AddHiddenHeadCol("PKID", "PKID");
tab.AddHeadCol("USERACCOUNT", "", "资产账号");
tab.AddHeadCol("TEAM", "", "所属组");
tab.AddHeadCol("RQ", "", "日期");
tab.AddHeadCol("BZ", "", "币种");
tab.AddHeadCol("SCJSZBJ", "", "上次结算准备金");
tab.AddHeadCol("RJ", "", "入金");
tab.AddHeadCol("CJ", "", "出金");
tab.AddHeadCol("JTQY", "", "静态权益");
tab.AddHeadCol("PCYK", "", "平仓盈亏");
tab.AddHeadCol("CCYK", "", "持仓盈亏");
tab.AddHeadCol("SXF", "", "手续费");
tab.AddHeadCol("DTQY", "", "动态权益");
tab.AddHeadCol("ZYBZJ", "", "占用保证金");
tab.AddHeadCol("DJSXF", "", "冻结手续费");
tab.AddHeadCol("DJBZJ", "", "冻结保证金");
tab.AddHeadCol("KYZJ", "", "可用资金");
tab.AddHeadCol("KQZJ", "", "可取资金");
tab.AddHeadCol("JYSBZJ", "", "交易所保证金");
tab.AddHeadCol("SQFY", "", "申请费用");
tab.AddHeadRow();
ViewBag.List = tab.GetTable() + Pagination.GetPage(pager, tableId, "10,20,30,50");
return View();
}
public ActionResult GetHtml(Pager pager, string userAccount, string name, string resId, DateTime? starttime, DateTime? endtime, string columns)
{
try
{
List<QH_CAPITALDETAIL> list = QH_CapitalDetail_BL.GetList(ref pager, userAccount, name, resId, starttime, endtime);
Table table = new Table(columns, true);
table.gridPager = pager;
foreach (QH_CAPITALDETAIL model in list)
{
table.AddHiddenCol(model.PKID);
table.AddCol(model.USERACCOUNT);
table.AddCol(model.TEAM);
table.AddCol(model.RQ.HasValue ? model.RQ.Value.ToString("yyyy-MM-dd") : "");
table.AddCol(model.BZ);
table.AddCol(model.SCJSZBJ);
table.AddCol(model.RJ);
table.AddCol(model.CJ);
table.AddCol(model.JTQY);
table.AddCol(model.PCYK);
table.AddCol(model.CCYK);
table.AddCol(model.SXF);
table.AddCol(model.DTQY);
table.AddCol(model.ZYBZJ);
table.AddCol(model.DJSXF);
table.AddCol(model.DJBZJ);
table.AddCol(model.KYZJ);
table.AddCol(model.KQZJ);
table.AddCol(model.JYSBZJ);
table.AddCol(model.SQFY);
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 resId, 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<QH_CAPITALDETAIL> list = QH_CapitalDetail_BL.GetList(ref pager, userAccount, name, resId, starttime, endtime);
return File(ExcelHelper.ExportListModelToExcel<QH_CAPITALDETAIL>(list, "期货客户信息列表", 10000, checkedFilds, checkedTitles, null), "application/ms-excel", PageRequest.GetDlownLoadName("期货客户信息列表.xls"));
}
#endregion
}
}