private void EditOrgDetail(HttpContext context) { int OrgId = Convert.ToInt32(HttpContext.Current.Request["ID"]); jsonModel = bll.GetEntityById(OrgId); if (jsonModel.errNum == 0) { Org_Mechanism org = (Org_Mechanism)jsonModel.retData; org.Id = OrgId; string Name = context.Request["Name"].SafeToString(); if (Name.Length > 0) { org.Name = context.Request["Name"].SafeToString(); } string OrganNo = context.Request["OrganNo"].SafeToString(); if (OrganNo.Length > 0) { org.OrganNo = context.Request["OrganNo"].SafeToString(); } string ImageInfo = context.Request["ImageInfo"].SafeToString(); if (ImageInfo.Length > 0) { org.ImageInfo = ImageInfo; } string Introduce = context.Request["Introduce"].SafeToString(); if (Introduce.Length > 0) { org.Introduce = Introduce; } if (context.Request["EstabLish"].SafeToString().Length > 0) { org.EstabLish = Convert.ToDateTime(context.Request["EstabLish"]); } string LegalUID = context.Request["LegalUID"].SafeToString(); if (LegalUID.Length > 0) { org.LegalUID = LegalUID; } if (context.Request["IsDelete"].SafeToString().Length > 0) { org.IsDelete = 0; } if (context.Request["UserCount"].SafeToString().Length > 0) { org.UserCount = Convert.ToInt32(context.Request["UserCount"]); } jsonModel = bll.EditOrg(org); } }
private void AddOrg(HttpContext context) { try { Org_Mechanism org = new Org_Mechanism(); org.Name = context.Request["Name"].SafeToString(); org.Pid = 0; if (context.Request["Pid"].SafeToString().Length > 0) { org.Pid = Convert.ToInt32(context.Request["Pid"]); } org.OrganType = int.Parse(context.Request["OrganType"]); jsonModel = bll.AddOrg(org); } catch (Exception ex) { jsonModel = new JsonModel() { errNum = 400, errMsg = ex.Message, retData = "" }; } }