82 lines
3.0 KiB
C#
82 lines
3.0 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Web.Mvc;
|
|
using WX.CRM.Common;
|
|
using WX.CRM.IBLL.Wx;
|
|
using WX.CRM.WebHelper;
|
|
|
|
namespace WX.CRM.WEB.Controllers.WeiXin
|
|
{
|
|
public class BonusGrouperController : BaseController
|
|
{
|
|
private readonly IWX_BONUSSALEUSER _bonussaleuser;
|
|
|
|
public BonusGrouperController(IWX_BONUSSALEUSER bonussaleuser)
|
|
{
|
|
_bonussaleuser = bonussaleuser;
|
|
}
|
|
|
|
[HttpGet]
|
|
[AuthorizeRedirect(Roles = InitRights.CONST_主管奖励)]
|
|
public ActionResult Index()
|
|
{
|
|
ToolBar tb = new ToolBar();
|
|
string[] balance = new ToolButtonView().ToolButtonRight(InitRights.奖励确认, userRightId);
|
|
tb.AllowButton(balance);
|
|
tb.AddOtherButton("Other1", "确认", "icon-export", "BtnSvae", true);
|
|
ViewBag.ToolBar = tb;
|
|
|
|
Table tab1 = new Table("tablist1");
|
|
tab1.AddHeadCol("uname", "", "姓名");
|
|
tab1.AddHeadCol("eid", "", "工号");
|
|
tab1.AddHeadCol("PerformanceAmount", "", "组业绩额");
|
|
tab1.AddHeadCol("rank", "", "排名");
|
|
tab1.AddHeadCol("bonus", "", "奖金");
|
|
tab1.AddHeadRow();
|
|
ViewBag.table1 = tab1.GetTable();
|
|
|
|
return View();
|
|
}
|
|
|
|
[HttpPost]
|
|
[AuthorizeRedirect(Roles = InitRights.CONST_主管奖励)]
|
|
public JsonResult GetGrouperBonusWeek(DateTime week, string columns)
|
|
{
|
|
var table = new Table(columns, true);
|
|
var ds = _bonussaleuser.GetGrouperBonusWeek(week);
|
|
foreach (DataRow dataRow in ds.Tables[0].Rows)
|
|
{
|
|
table.AddCol(string.Format("{0}", InnerUserHelper.Instance.GetUsername(decimal.Parse(dataRow["saleuserid"].ToString()))));
|
|
table.AddCol(InnerUserHelper.Instance.GetEidByUserId(decimal.Parse(dataRow["saleuserid"].ToString())));
|
|
table.AddCol(dataRow["PerformanceAmount"]);
|
|
table.AddCol(dataRow["rank"]);
|
|
table.AddCol(dataRow["bonus"]);
|
|
table.AddRow();
|
|
}
|
|
var json = new
|
|
{
|
|
rowsList = table.GetRows()
|
|
};
|
|
return Json(json, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
[HttpPost]
|
|
public JsonResult SaveGrouperBonusWeek(DateTime week)
|
|
{
|
|
try
|
|
{
|
|
var result = _bonussaleuser.SaveBonusSaleUser(7, week, UserId, UserName);
|
|
if (result)
|
|
return Json(new { result = "ok", message = "操作成功!" }, JsonRequestBehavior.AllowGet);
|
|
return Json(new { result = "exist", message = "记录已经存在,请确认!" }, JsonRequestBehavior.AllowGet);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Error("BonusGrouperController/SaveGrouperBonusWeek:" + ex.Message);
|
|
return JsonHandler.ManageMessage(ex.Message, false);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|