public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; RoleInfoManager manager = new RoleInfoManager(); DataTable dt = manager.GetDataTable(); string result = JsonConvert.Convert2Json(dt); context.Response.Write(result); context.Response.End(); }
private void LoadData(string ID) { RoleInfo code = new OAManager.RoleInfoManager().GetItemById(new Guid(ID)); txtID.Value = code.ID.ToString(); txtCode.Value = code.Code; txtName.Value = code.Name; txtRoleClass.Value = code.RoleClass; txtIsEnable.Checked = code.IsEnable; txtNote.Value = code.Note; }
public void ProcessRequest(HttpContext context) { HttpRequest rp = context.Request; context.Response.ContentType = "text/plain"; RoleInfoManager manager = new RoleInfoManager(); int currentPage = int.Parse(rp["pagenum"]); int pageSize = int.Parse(rp["pagesize"]) ; int count = 0, recordCount = 0; DataTable dt = manager.GetPersonByRoleID(currentPage + 1, pageSize,null, rp["RoleID"],true, ref count, ref recordCount); string result = JsonConvert.Convert2Json(dt); context.Response.Write("{ \"totalRecords\":\"" + recordCount + "\",\"rows\":" + result + "}"); context.Response.End(); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; HttpRequest rp = context.Request; string msg = string.Empty; try { if (string.IsNullOrEmpty(rp["txtID"])) { entity.ID = Guid.NewGuid(); } else { entity.ID = new Guid(rp["txtID"]); entity.RecordStatus = StatusType.update; } entity.Code = rp["txtCode"]; entity.Name = rp["txtName"]; entity.RoleClass = rp["txtRoleClass"]; entity.IsEnable = rp["txtIsEnable"] == "on"; entity.Note = rp["txtNote"]; RoleInfoManager manager = new RoleInfoManager(); bool IsExit = manager.ExitCodeAndName(entity);//重复校验参考 if (IsExit) { msg = "已存在相同编号或名称!"; } else { manager.Save(entity); context.Response.Write("{\"success\":\"true\",\"ID\":\"" + entity.ID + "\"}"); } } catch (Exception ex) { msg = ex.Message; } if (!string.IsNullOrEmpty(msg)) { byte[] bytes = Encoding.UTF8.GetBytes(msg.Replace("\r\n", "<br/>")); string encode = Convert.ToBase64String(bytes); context.Response.Write("{\"success\":\"false\",\"msg\":\"" + encode + "\"}"); } context.Response.End(); }
public void ProcessRequest(HttpContext context) { HttpRequest rp = context.Request; context.Response.ContentType = "text/plain"; RoleInfoManager manager = new RoleInfoManager(); int currentPage = int.Parse(rp["pagenum"]); int pageSize = int.Parse(rp["pagesize"]) ; string fiter = rp["filtervalue0"]; WhereClip where = null; if (!string.IsNullOrEmpty(fiter)) { fiter = fiter.Trim(); where = (PersonInfo._.UserName.Contains(fiter) || PersonInfo._.RealName.Contains(fiter)); } int count = 0, recordCount = 0; DataTable dt = manager.GetPersonByRoleID(currentPage + 1, pageSize, where, rp["RoleID"], false, ref count, ref recordCount); string result = JsonConvert.Convert2Json(dt); context.Response.Write("{ \"totalRecords\":\"" + recordCount + "\",\"rows\":" + result + "}"); context.Response.End(); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; HttpRequest rp = context.Request; string msg = string.Empty; try { if (string.IsNullOrEmpty(rp["ID"])) { msg = "请选择要删除的数据!"; } else { int i = new RoleInfoManager().DelateRolePersonById(new Guid(rp["ID"])); if (i > 0) { context.Response.Write("{\"success\":\"true\"}"); } else { context.Response.Write("{\"success\":\"true\"}"); msg = "删除失败!"; } } } catch (Exception ex) { msg = ex.Message; } if (!string.IsNullOrEmpty(msg)) { byte[] bytes = Encoding.UTF8.GetBytes(msg.Replace("\r\n", "<br/>")); string encode = Convert.ToBase64String(bytes); context.Response.Write("{\"success\":\"false\",\"msg\":\"" + encode + "\"}"); } context.Response.End(); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; HttpRequest rp = context.Request; string msg = string.Empty; try { Guid RoleID = new Guid(rp["roleID"]); string personID = rp["person"]; string[] personArray = personID.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); List<BaseEntity> list = new List<BaseEntity>(); foreach (string item in personArray) { RolePerson rpi = new RolePerson(); rpi.ID = Guid.NewGuid(); rpi.PersonID = new Guid(item); rpi.RoleID = RoleID; list.Add(rpi); } RoleInfoManager manager = new RoleInfoManager(); manager.Save(list); context.Response.Write("{\"success\":\"true\"}"); } catch (Exception ex) { msg = ex.Message; } if (!string.IsNullOrEmpty(msg)) { byte[] bytes = Encoding.UTF8.GetBytes(msg.Replace("\r\n", "<br/>")); string encode = Convert.ToBase64String(bytes); context.Response.Write("{\"success\":\"false\",\"msg\":\"" + encode + "\"}"); } context.Response.End(); }