public string SetFunctions(HttpContext context) { string returnValue = "{\"state\":0}"; string userid = context.Request.Form["userid"]; string functionsid = context.Request.Form["functionsid"]; if (string.IsNullOrEmpty(userid) || string.IsNullOrEmpty(functionsid)) { returnValue = "{\"state\":-1}"; //传递参数不完整 } else { List <FunctionEntity> list = new List <FunctionEntity>(); String[] funid = functionsid.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (String var in funid) { FunctionEntity fe = new FunctionEntity(); fe.Function_ID = Convert.ToInt32(var); list.Add(fe); } if (new BCtrl_Function().EditUserFunRel(userid, list)) { ClearCacheOrSession.ClearFunctionsCacheByCRUD(); returnValue = "{\"state\":1}"; } } return(returnValue); }
public string DeleteFunction(HttpContext context) { string status = "{\"status\":-1}"; int functionID = 0; if (int.TryParse(context.Request.Form["pid"], out functionID) && functionID > 0) { BCtrl_Function bll = new BCtrl_Function(); if (bll.Delete(functionID)) { ClearCacheOrSession.ClearFunctionsCacheByCRUD(); status = "{\"status\":1}"; } else { status = "{\"status\":0}"; } } return(status); }