protected void btnNonconfSave_Click(object sender, EventArgs e) { bool success; if (hfOper.Value == "add") { staticNonconf = new NONCONFORMANCE(); staticNonconf.COMPANY_ID = SessionManager.UserContext.HRLocation.Company.COMPANY_ID; staticNonconf.STATUS = "A"; } else { staticNonconf = SQMResourcesMgr.LookupNonconf(entities, staticNonconf.NONCONF_ID, ""); } btnNonconfSave.Enabled = false; hfOper.Value = ""; staticNonconf.PROBLEM_AREA = ddlProblemArea.SelectedValue; staticNonconf.NONCONF_CATEGORY = ddlNonconfCategory.SelectedValue; staticNonconf.NONCONF_CD = tbNonconfCode.Text; staticNonconf.NONCONF_NAME = tbNonconfName.Text; staticNonconf.NONCONF_DESC = tbNonconfDesc.Text; staticNonconf.STATUS = ddlNonconfStatus.SelectedValue; if ((staticNonconf = SQMResourcesMgr.UpdateNonconf(entities, staticNonconf, SessionManager.UserContext.UserName())) != null) { NONCONFORMANCE nonconf = null; if ((nonconf = nonconfList.FirstOrDefault(l => l.NONCONF_ID == staticNonconf.NONCONF_ID)) == null) { nonconfList.Add(staticNonconf); } else { if (staticNonconf.EntityState == System.Data.EntityState.Detached || staticNonconf.EntityState == System.Data.EntityState.Deleted) { nonconfList.Remove(nonconf); } else { nonconf = (NONCONFORMANCE)SQMModelMgr.CopyObjectValues(nonconf, staticNonconf, false); } } BindNonconfList(nonconfList); } }
protected void btnNonconfCatSave_Click(object sender, EventArgs e) { bool success; NONCONFORMANCE nonconfCat = null; if (!string.IsNullOrEmpty(tbNonconfCategoryCode.Text)) { nonconfCat = new NONCONFORMANCE(); nonconfCat.NONCONF_CD = tbNonconfCategoryCode.Text; nonconfCat.NONCONF_NAME = nonconfCat.NONCONF_DESC = tbNonconfCategoryName.Text; nonconfCat.STATUS = "A"; nonconfCat.PROBLEM_AREA = ddlProblemArea.SelectedValue; if ((nonconfCat = SQMResourcesMgr.UpdateNonconf(entities, nonconfCat, SessionManager.UserContext.UserName())) != null) { categoryList.Add(nonconfCat); BindNonconfList(nonconfList); BindCategoryList(); } } }