protected void BtncallUpd_Click(object sender, EventArgs e) { try { if (BtncallUpd.Text == "UPDATE") { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ShowModel1", "ShowModel1()", true); } else { MENU_MASLogicLayer insert = new MENU_MASLogicLayer(); // insert.SYSCODE = ""; if (TxtCode.Text == string.Empty) { insert.CODE = "0"; } else { insert.CODE = TxtCode.Text.Trim(); } insert.NAME = TxtName.Text.Trim(); insert.REF_CODE = DdlReferenceCode.SelectedValue.Trim().ToUpper(); insert.MENU_NAME = TxtMenuName.Text.Trim().ToUpper(); if (TxtMenuOrder.Text == string.Empty) { insert.MENU_ORD = "0"; } else { insert.MENU_ORD = TxtMenuOrder.Text.Trim(); } if (BtncallUpd.Text.Trim().ToUpper() == "SAVE") { string str = MENU_MASLogicLayer.InsertMENU_MASDetail(insert); if (str.Contains("successfully")) { lblmsg.Text = "MENU DETAIL ADD SUCCESSFULLY."; lblmsg.ForeColor = Color.Green; clear(); FillGrid(); UserRights(); } else if (str.Contains("Already") || str.Contains("PRIMARY KEY")) { lblmsg.Text = "MENU CODE ALREADY EXIST."; lblmsg.ForeColor = Color.Red; } else { lblmsg.Text = "ERROR : MENU DETAIL NOT SAVED"; lblmsg.ForeColor = Color.Red; } } } } catch (Exception) { throw; } }
protected void btnSave_Click(object sender, EventArgs e) { try { #region INSERT _ UPDATE VALUE MENU_MASLogicLayer insert = new MENU_MASLogicLayer(); // insert.SYSCODE = ""; if (TxtCode.Text == string.Empty) { insert.CODE = "0"; } else { insert.CODE = TxtCode.Text.Trim(); } insert.NAME = TxtName.Text.Trim(); insert.REF_CODE = DdlReferenceCode.SelectedValue.Trim().ToUpper(); insert.MENU_NAME = TxtMenuName.Text.Trim().ToUpper(); if (TxtMenuOrder.Text == string.Empty) { insert.MENU_ORD = "0"; } else { insert.MENU_ORD = TxtMenuOrder.Text.Trim(); } #endregion if (btnSave.Text.Trim().ToUpper() == "SAVE") { string str = MENU_MASLogicLayer.InsertMENU_MASDetail(insert); if (str.Contains("successfully")) { lblmsg.Text = "MENU DETAIL ADD SUCCESSFULLY."; lblmsg.ForeColor = Color.Green; clear(); FillGrid(); UserRights(); } else if (str.Contains("Already") || str.Contains("PRIMARY KEY")) { lblmsg.Text = "MENU CODE ALREADY EXIST."; lblmsg.ForeColor = Color.Red; } else { lblmsg.Text = "ERROR : MENU DETAIL NOT SAVED"; lblmsg.ForeColor = Color.Red; } } else { string str = MENU_MASLogicLayer.UpdateMENU_MASDetails(insert); if (str.Contains("successfully")) { lblmsg.Text = "MENU DETAIL UPDATE SUCCESSFULLY."; lblmsg.ForeColor = Color.Green; clear(); FillGrid(); UserRights(); } else if (str.Contains("Already")) { lblmsg.Text = "MENU CODE ALREADY EXIST."; lblmsg.ForeColor = Color.Red; } else { lblmsg.Text = "ERROR : MENU DETAIL NOT SAVED"; lblmsg.ForeColor = Color.Red; } } } catch (Exception) { throw; } }