You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

212 lines
7.4 KiB
C#

11 months ago
using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.MvcShipping.Models.InfoSaleProfitSharePlan;
using DSWeb.MvcShipping.Models.InfoSaleProfitShareSet;
using DSWeb.MvcShipping.DAL.MsInfoSaleProfitShareSet;
using DSWeb.MvcShipping.Helper;
using DSWeb.MvcShipping.Comm.Cookie;
using System.Collections.Generic;
using HcUtility.Comm;
using HcUtility.Core;
namespace DSWeb.MvcShipping.Controllers
{
[JsonRequestBehavior]
public class MsInfoSaleProfitShareSetController : Controller
{
//
// GET:
public ActionResult Index()
{
return View();
}
//
// GET: /
public ActionResult Edit()
{
return View();
}
public ActionResult PlanIndex()
{
return View();
}
//
// GET
public ContentResult GetDataList(string condition,string sort)
{
var dataList = MsInfoSaleProfitShareSetDAL.GetDataList(condition, Convert.ToString(Session["COMPANYID"]), sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
//
// GET/TruckMng/MsWlTyreAcc/GetData/
public ContentResult GetData(string handle, string condition)
{
InfoSaleProfitSharePlan head = null;
if (handle == "edit")
{
var list = MsInfoSaleProfitShareSetDAL.GetDataList(condition, Convert.ToString(Session["COMPANYID"]));
if (list.Count > 0)
head = list[0];
}
if (head == null)
{
head = new InfoSaleProfitSharePlan();
head.CREATEUSER = Convert.ToString(Session["SHOWNAME"]);
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
public ContentResult Save(string opstatus, string data, string body, string bodywork)
{
var headData = JsonConvert.Deserialize<InfoSaleProfitSharePlan>(data);
var bodyList = JsonConvert.Deserialize<List<InfoSaleProfitShareDetail>>(body);
var worklist = JsonConvert.Deserialize<List<InfoSaleProfitShareLx>>(bodywork);
if (opstatus == "add")
{
headData.DbOperationType = DbOperationType.DbotIns;
}
else if (opstatus == "edit")
{
headData.DbOperationType = DbOperationType.DbotUpd;
headData.ModelUIStatus = "E";
}
else
{
headData.DbOperationType = DbOperationType.DbotDel;
}
var modb = new ModelObjectDB();
var GID = headData.GID;
headData.COMPANYID = Convert.ToString(Session["COMPANYID"]);
DBResult result = modb.Save(headData);
result = MsInfoSaleProfitShareSetDAL.SaveDetail(bodyList, GID);
result = MsInfoSaleProfitShareSetDAL.SaveLxDetail(worklist, GID);
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message,
Data = MsInfoSaleProfitShareSetDAL.GetData("GID='" + GID + "'", Convert.ToString(Session["COMPANYID"]))
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult Delete(string data)
{
var headData = JsonConvert.Deserialize<InfoSaleProfitSharePlan>(data);
DBResult result = MsInfoSaleProfitShareSetDAL.DeleteDetail(headData);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#region 方案明细
public ContentResult GetSaleProfitDetailDataList(string condition, string sort)
{
var dataList = MsInfoSaleProfitShareSetDAL.GetSaleProfitDetailDataList(condition, sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult DeleteSaleProfitDetail(string data)
{
var headData = JsonConvert.Deserialize<InfoSaleProfitShareDetail>(data);
var modb = new ModelObjectDB();
DBResult result = modb.Delete(headData);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
#region 方案利息
public ContentResult GetSaleProfitLxDataList(string condition, string sort)
{
var dataList = MsInfoSaleProfitShareSetDAL.GetSaleProfitLxDataList(condition, sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
public ContentResult DeleteSaleProfitLx(string data)
{
var headData = JsonConvert.Deserialize<InfoSaleProfitShareLx>(data);
var modb = new ModelObjectDB();
DBResult result = modb.Delete(headData);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
#region 方案设置
public ContentResult GetSaleProfitSetDataList(string condition, string sort)
{
var dataList = MsInfoSaleProfitShareSetDAL.GetSaleProfitSetDataList(condition, Convert.ToString(Session["COMPANYID"]), sort);
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
//
// GET/TruckMng/MsWlTyreAcc/GetData/
public ContentResult DeleteSaleProfitSet(string data)
{
var headData = JsonConvert.Deserialize<InfoSaleProfitShareSet>(data);
var modb = new ModelObjectDB();
DBResult result = modb.Delete(headData);
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
public ContentResult SaveSaleProfitSet(string body)
{
var bodyList = JsonConvert.Deserialize<List<InfoSaleProfitShareSet>>(body);
DBResult result = MsInfoSaleProfitShareSetDAL.SaveSaleProfitSet(bodyList, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
#region 参照部分
#endregion
}
}