protected void btnSave_Click(object sender, EventArgs e) { var obj = new COLOR(); obj.COLOR_NAME = popTxtColorTypeName.Text; obj.COLOR_SUBNAME = popTxtColorTypeSubName.Text; var cmd = new ColorService(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_ID = Convert.ToInt32(ViewState["colorId"].ToString()); obj.UPDATE_DATE = DateTime.Now; obj.UPDATE_EMPLOYEE_ID = 0; obj.SYE_DEL = true; cmd.Edit(); } ViewState["colorId"] = null; Response.Redirect("SearchColorProduct.aspx"); }
public ColorService(COLOR item) { _item = item; }
private void InitialDataPopup() { if (ViewState["colorId"] != null) { var cmd = new ColorService(); _color = cmd.Select(Convert.ToInt32(ViewState["colorId"].ToString())); if (_color != null) { popTxtColorTypeName.Text = _color.COLOR_NAME; popTxtColorTypeSubName.Text = _color.COLOR_SUBNAME; flag.Text = "Edit"; } } }