private void BindGrid1(int pageIndex, int pageSize, string selectTest, string actionType, string type, out DataTable table, out int count) { string sql = string.Empty; if (!selectTest.Equals("")) { if (actionType == "trigger2") { sql = sql + " and a.UserName like '%" + selectTest + "%'"; } else if (actionType == "trigger3") { sql = sql + " and e.Name like '%" + selectTest + "%'"; } else if (actionType == "trigger4") { sql = sql + " and b.Name like '%" + selectTest + "'%"; } } switch (type) { case "0": sql = sql + " and a.UserType = '1'"; break; //管理员 case "1": sql = sql + " and a.UserType = '2'"; break; //分公司 case "2": sql = sql + " and a.UserType = '3'"; break; //客户 } Hashtable has = Panda_UserInfoDal.Search(pageIndex, pageSize, "ID", "asc", sql); count = Int32.Parse(has["total"].ToString()); table = (DataTable)has["data"]; }
public ActionResult MyCustomPostBack(string type, JArray gridFields, JObject typeParams, int gridIndex, int gridPageSize) { var Grid1 = UIHelper.Grid("Grid1"); string sql = string.Empty; var ttbSearch = UIHelper.TwinTriggerBox("ttbSearchMessage"); if (type == "trigger1") { ttbSearch.Text(String.Empty); ttbSearch.ShowTrigger1(false); } else if (type == "trigger2") { ttbSearch.ShowTrigger1(true); var triggerValue = typeParams.Value <string>("triggerValue"); sql = " and UserName like '%" + triggerValue + "%'"; } if (GetUserType().Equals("3")) //如果登录用户是客户 { sql = sql + " and a.FCustomerID=" + GetUserCustomer(); } Hashtable table = Panda_UserInfoDal.Search(gridIndex, gridPageSize, "FCreateDate", "DESC", sql); Grid1.DataSource(table["data"], gridFields); Grid1.RecordCount(Int32.Parse(table["total"].ToString())); Grid1.PageSize(gridPageSize); return(UIHelper.Result()); }
private void UpdateGrid(JArray Grid1_fields, int gridIndex, int gridPageSize) { var Grid1 = UIHelper.Grid("Grid1"); string sql = string.Empty; if (GetUserType().Equals("3")) //如果登录用户是客户 { sql = sql + " and a.FCustomerID=" + GetUserCustomer(); } Hashtable table = Panda_UserInfoDal.Search(gridIndex, gridPageSize, "FCreateDate", "DESC", sql); Grid1.DataSource(table["data"], Grid1_fields); Grid1.RecordCount(Int32.Parse(table["total"].ToString())); }
public ActionResult Index() { ViewBag.CoreUserNew = CheckPower("CoreUserNew"); ViewBag.CoreUserDelete = CheckPower("CoreUserDelete"); ViewBag.CoreUserEdit = CheckPower("CoreUserEdit"); string sql = string.Empty; if (GetUserType().Equals("3")) //如果登录用户是客户 { sql = sql + " and a.FCustomerID=" + GetUserCustomer(); } Hashtable table = Panda_UserInfoDal.Search(0, 20, "FCreateDate", "DESC", sql); ViewBag.Grid1DataSource = table["data"]; ViewBag.Grid1RecordCount = Int32.Parse(table["total"].ToString()); return(View()); }
public ActionResult Grid1_PageIndexChanged(JArray Grid1_fields, int Grid1_pageIndex, int gridPageSize, string searchMessage) { var Grid1 = UIHelper.Grid("Grid1"); string sql = string.Empty; if (GetUserType().Equals("3")) //如果登录用户是客户 { sql = sql + " and a.FCustomerID=" + GetUserCustomer(); } if (!searchMessage.Equals("")) { sql = sql + " and UserName like '%" + searchMessage + "%'"; } Hashtable table = Panda_UserInfoDal.Search(Grid1_pageIndex, gridPageSize, "FCreateDate", "DESC", sql); Grid1.DataSource(table["data"], Grid1_fields); Grid1.RecordCount(Int32.Parse(table["total"].ToString())); return(UIHelper.Result()); }
private void BindGrid1(int pageIndex, int pageSize, string selectTest, out DataTable table, out int count, int RoleID) { string sql = string.Empty; if (!selectTest.Equals("")) { sql = sql + " and UserName like '%" + selectTest + "%'"; } if (GetUserType().Equals("3")) //如果登录用户是客户 { sql = sql + " and a.FCustomerID=" + GetUserCustomer(); } else { string roleName = db.roles.Where(x => x.ID == RoleID).FirstOrDefault().Name; if (roleName.Contains("管理员")) { sql = sql + " and UserType=1"; } else if (roleName.Contains("分公司")) { sql = sql + " and UserType=2"; } else if (roleName.Contains("客户")) { sql = sql + " and UserType=3"; } else if (roleName.Contains("其他")) { sql = sql + " and UserType=4"; } } Hashtable has = Panda_UserInfoDal.Search(pageIndex, pageSize, "FCreateDate", "DESC", sql); count = Int32.Parse(has["total"].ToString()); table = (DataTable)has["data"]; }