protected void btnSave_Click(object sender, EventArgs e) { var obj = new COLOR_TYPE(); obj.COLOR_TYPE_NAME = popTxtColorTypeName.Text; obj.COLOR_TYPE_SUBNAME = popTxtColorTypeSubName.Text; var cmd = new TraceryService(obj); if (flag.Text.Equals("Add")) { obj.Action = ActionEnum.Create; obj.CREATE_DATE = DateTime.Now; obj.CREATE_EMPLOYEE_ID = 0; obj.UPDATE_DATE = DateTime.Now; obj.UPDATE_EMPLOYEE_ID = 0; obj.SYE_DEL = true; cmd.Add(); } else { obj.Action = ActionEnum.Update; obj.COLOR_TYPE_ID = Convert.ToInt32(ViewState["colorTypeId"].ToString()); obj.UPDATE_DATE = DateTime.Now; obj.UPDATE_EMPLOYEE_ID = 0; obj.SYE_DEL = true; cmd.Edit(); } ViewState["colorTypeId"] = null; Response.Redirect("SearchTracery.aspx"); }