Пример #1
0
        protected void BtncallUpd_Click(object sender, EventArgs e)
        {
            try
            {
                if (BtncallUpd.Text == "UPDATE")
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ShowModel1", "ShowModel1()", true);
                }
                else
                {
                    STATE_MASLogicLayer insert = new STATE_MASLogicLayer();
                    insert.STATE_CODE    = HfStateCode.Value.Trim();
                    insert.STATE_NAME    = TxtStateName.Text.Trim().ToUpper();
                    insert.STATE_TYPE    = DdlStateType.SelectedValue.Trim().ToUpper();
                    insert.STATE_NO      = TxtStateNo.Text.Trim().ToUpper();
                    insert.STATE_SHORT   = TxtStateShort.Text.Trim().ToUpper();
                    insert.STATE_CAPITAL = TxtStateCapital.Text.Trim().ToUpper();

                    if (BtncallUpd.Text.Trim().ToUpper() == "SAVE")
                    {
                        string str = STATE_MASLogicLayer.InsertSTATE_MASDetail(insert);
                        if (str.Contains("successfully"))
                        {
                            lblmsg.Text      = "STATE DETAIL ADD SUCCESSFULLY.";
                            lblmsg.ForeColor = Color.Green;
                            clear();
                            FillGrid();
                            UserRights();
                        }
                        else if (str.Contains("Already") || str.Contains("PRIMARY KEY"))
                        {
                            lblmsg.Text      = "STATE CODE ALREADY EXIST.";
                            lblmsg.ForeColor = Color.Red;
                        }
                        else
                        {
                            lblmsg.Text      = "ERROR : STATE DETAIL NOT SAVED";
                            lblmsg.ForeColor = Color.Red;
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                #region INSERT _ UPDATE VALUE

                STATE_MASLogicLayer insert = new STATE_MASLogicLayer();
                insert.STATE_CODE    = HfStateCode.Value.Trim();
                insert.STATE_NAME    = TxtStateName.Text.Trim().ToUpper();
                insert.STATE_TYPE    = DdlStateType.SelectedValue.Trim().ToUpper();
                insert.STATE_NO      = TxtStateNo.Text.Trim().ToUpper();
                insert.STATE_SHORT   = TxtStateShort.Text.Trim().ToUpper();
                insert.STATE_CAPITAL = TxtStateCapital.Text.Trim().ToUpper();

                #endregion
                if (btnSave.Text.Trim().ToUpper() == "SAVE")
                {
                    string str = STATE_MASLogicLayer.InsertSTATE_MASDetail(insert);
                    if (str.Contains("successfully"))
                    {
                        lblmsg.Text      = "STATE DETAIL ADD SUCCESSFULLY.";
                        lblmsg.ForeColor = Color.Green;
                        clear();
                        FillGrid();
                        UserRights();
                    }
                    else if (str.Contains("Already") || str.Contains("PRIMARY KEY"))
                    {
                        lblmsg.Text      = "STATE CODE ALREADY EXIST.";
                        lblmsg.ForeColor = Color.Red;
                    }
                    else
                    {
                        lblmsg.Text      = "ERROR : STATE DETAIL NOT SAVED";
                        lblmsg.ForeColor = Color.Red;
                    }
                }
                else
                {
                    string str = STATE_MASLogicLayer.UpdateSTATE_MASDetails(insert);
                    if (str.Contains("successfully"))
                    {
                        lblmsg.Text      = "STATE DETAIL UPDATE SUCCESSFULLY.";
                        lblmsg.ForeColor = Color.Green;
                        clear();
                        FillGrid();
                        UserRights();
                    }
                    else if (str.Contains("Already"))
                    {
                        lblmsg.Text      = "STATE CODE ALREADY EXIST.";
                        lblmsg.ForeColor = Color.Red;
                    }
                    else
                    {
                        lblmsg.Text      = "ERROR : STATE DETAIL NOT SAVED";
                        lblmsg.ForeColor = Color.Red;
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }