using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using DSWeb.EntityDA; using DSWeb.Models; using DSWeb.TruckMng.Comm.Cookie; using DSWeb.TruckMng.Helper; using WebSqlHelper; using System.Web.Configuration; using System.IO; using DSWeb.SysMng.DAL.SysRoleTaskQuery; using DSWeb.Areas.MvcShipping.Helper; using DSWeb.Common.DB; using DSWeb.Areas.CommMng.Models; namespace DSWeb.Areas.SysMng.Controllers { /// /// 首页工作台 后台 /// [JsonRequestBehavior] public class SysRoleTaskQueryController : Controller { // // GET: /CommMng/Print/ public ActionResult Index() { return View(); } public ActionResult Edit() { return View(); } // //public static List GetDataList(int start, int limit, string sort, string condition, string compid, ref int count) //{ // var cdc = new CommonDataContext(); // var Condition = new Condition_RoleTaskQuery(); // try // { // Condition = JsonConvert.Deserialize(condition); // } // catch { } // //QueryCollection queries = new QueryCollection(); // if (Condition != null)//&& // { // QueryCollection queries = new QueryCollection(); // if (Condition.GID!=null) // queries.Add(new Query { Name = "GID", Operator = Query.Operators.Equal, Value = Condition.GID }); // if (Condition.RoleId != null) // queries.Add(new Query { Name = "RoleId", Operator = Query.Operators.Equal, Value = Condition.RoleId }); // if (!string.IsNullOrWhiteSpace(Condition.MODECNNAME)) // queries.Add(new Query { Name = "MODECNNAME", Operator = Query.Operators.Contains, Value = Condition.MODECNNAME }); // if (!string.IsNullOrWhiteSpace(Condition.BSTYPE)) // queries.Add(new Query { Name = "BSTYPE", Operator = Query.Operators.Contains, Value = Condition.BSTYPE }); // var result = cdc.Sys_Role_Task_Query.Where(queries.AsExpression(Query.Condition.AndAlso)) // //.Where(queries2.AsExpression(Query.Condition.AndAlso)) // .ToList(); // count = result.Count(); // var list0 = result.Skip(start).Take(limit).ToList(); // return list0; // } // else // { // var AllList = cdc.Sys_Role_Task_Query.Where(x => 1 == 1).ToList(); // if (AllList != null && AllList.Count > 0) { // count = AllList.Count (); // AllList = AllList.Skip(start).Take(limit).ToList(); // return AllList; // } // else{ // count = 0; // return new List(); // } // } //} public ContentResult GetDataList(int start, int limit, string sort, string condition, string CODENAME = "") { var count = 0; //var userid = Convert.ToString(Session["USERID"]); //var uid = Session["USERID"].ToString(); //var corpid = Session["COMPANYID"].ToString(); var dataList = SysRoleTaskQueryDAL.GetDataList(start, limit, sort, condition, ref count); //var dataList = MsChDuiDAL.GetDataList(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request), sort); //int count = MsChDuiDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request)); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetData( string GID) { var count = 0; //var userid = Convert.ToString(Session["USERID"]); //var uid = Session["USERID"].ToString(); //var corpid = Session["COMPANYID"].ToString(); var dataList = SysRoleTaskQueryDAL.GetDataList(0, 1, "", " GID='"+ GID + "'", ref count); //var dataList = MsChDuiDAL.GetDataList(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request), sort); //int count = MsChDuiDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request)); if (dataList.Count == 0) { var newrec = new Sys_Role_Task_Query_md(); dataList.Add(newrec); } var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList[0] }); return new ContentResult() { Content = json }; } } }