private string updatetbDept(HttpContext context) { try { using (AMSCM.Models.AMSCM amscm = new AMSCM.Models.AMSCM()) { AMSCM.Models.tbDept tbDept = amscm.tbDept.Find(context.Request.Form["cnvcDeptID"]); tbDept.cnvcDeptName = context.Request.Form["cnvcDeptName"]; tbDept.cnvcDeptID = context.Request.Form["cnvcDeptID"]; tbDept.cnvcDeptType = context.Request.Form["cnvcDeptType"]; tbDept.cnvcParentDeptID = context.Request.Form["cnvcParentDeptID"]; tbDept.cnvcComments = context.Request.Form["cnvcComments"]; tbDept.cnnPriority = Convert.ToInt32(context.Request.Form["cnnPriority"]); amscm.SaveChanges(); } } catch (NullReferenceException nex) { ExceptionPolicy.HandleException(nex, ServiceHelper.ExceptionPolicy); return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(false, nex.Message))); } catch (DbUpdateException dex) { ExceptionPolicy.HandleException(dex, ServiceHelper.ExceptionPolicy); return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(false, dex.Message))); } return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(true, ""))); }
private string removetbDept(HttpContext context) { try { using (AMSCM.Models.AMSCM amscm = new AMSCM.Models.AMSCM()) { AMSCM.Models.tbDept tbDept = amscm.tbDept.Find(context.Request.Form["cnvcDeptID"]); amscm.tbDept.Remove(tbDept); amscm.SaveChanges(); } } catch (ArgumentNullException aex) { ExceptionPolicy.HandleException(aex, ServiceHelper.ExceptionPolicy); return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(false, aex.Message))); } catch (DbUpdateException dex) { ExceptionPolicy.HandleException(dex, ServiceHelper.ExceptionPolicy); return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(false, dex.Message))); } return(ServiceHelper.JsonSerializer <JEasyUIResult>(new JEasyUIResult(true, ""))); }