示例#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
                {
                    #region INSERT BRAND COMPLAIN MASTER

                    BRAND_COMPMASLogicLayer insert = new BRAND_COMPMASLogicLayer();
                    insert.COMP_CODE      = Session["COMP_CODE"].ToString();
                    insert.COMPLAIN_SRNO  = HfComplainSrNo.Value.Trim();
                    insert.BRANDTYPE_CODE = DdlBrandTypeName.SelectedValue.Trim().ToUpper();
                    insert.COMPLAIN_CODE  = DdlComplainDescription.SelectedValue.Trim().ToUpper();
                    insert.INS_USERID     = Session["USERNAME"].ToString();
                    insert.INS_TERMINAL   = Session["PC"].ToString();
                    insert.INS_DATE       = "";
                    insert.UPD_USERID     = Session["USERNAME"].ToString();
                    insert.UPD_TERMINAL   = Session["PC"].ToString();
                    insert.UPD_DATE       = "";
                    #endregion

                    if (BtncallUpd.Text.Trim().ToUpper() == "SAVE")
                    {
                        string str = BRAND_COMPMASLogicLayer.InsertBRAND_COMPLAIN_MASDetail(insert);
                        if (str.Contains("successfully"))
                        {
                            lblmsg.Text      = "BRAND COMPALIN MASTER DETAIL ADD SUCCESSFULLY.";
                            lblmsg.ForeColor = Color.Green;
                            clear();
                            FillGrid(DdlBrandTypeName.SelectedValue);
                            UserRights();
                        }
                        else if (str.Contains("Already") || str.Contains("PRIMARY KEY"))
                        {
                            lblmsg.Text      = "BRAND COMPLAIN CODE ALREADY EXIST.";
                            lblmsg.ForeColor = Color.Red;
                        }
                        else
                        {
                            lblmsg.Text      = "ERROR :BRAND COMPLAIN MASTER DETAIL NOT SAVED";
                            lblmsg.ForeColor = Color.Red;
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                #region UPDATE BRAND COMPLAIN MASTER

                BRAND_COMPMASLogicLayer insert = new BRAND_COMPMASLogicLayer();
                insert.COMP_CODE      = HfCompCode.Value.Trim();
                insert.COMPLAIN_SRNO  = HfComplainSrNo.Value.Trim();
                insert.BRANDTYPE_CODE = DdlBrandTypeName.SelectedValue.Trim().ToUpper();
                insert.COMPLAIN_CODE  = DdlComplainDescription.SelectedValue.Trim().ToUpper();
                insert.INS_USERID     = Session["USERNAME"].ToString();
                insert.INS_TERMINAL   = Session["PC"].ToString();
                insert.INS_DATE       = "";
                insert.UPD_USERID     = Session["USERNAME"].ToString();
                insert.UPD_TERMINAL   = Session["PC"].ToString();
                insert.UPD_DATE       = "";
                #endregion

                if (btnSave.Text.Trim().ToUpper() == "SAVE")
                {
                    string str = BRAND_COMPMASLogicLayer.InsertBRAND_COMPLAIN_MASDetail(insert);
                    if (str.Contains("successfully"))
                    {
                        lblmsg.Text      = "BRAND COMPALIN MASTER DETAIL ADD SUCCESSFULLY.";
                        lblmsg.ForeColor = Color.Green;
                        clear();
                        FillGrid(DdlBrandTypeName.SelectedValue);
                        UserRights();
                    }
                    else if (str.Contains("Already") || str.Contains("PRIMARY KEY"))
                    {
                        lblmsg.Text      = "BRAND COMPLAIN CODE ALREADY EXIST.";
                        lblmsg.ForeColor = Color.Red;
                    }
                    else
                    {
                        lblmsg.Text      = "ERROR :BRAND COMPLAIN MASTER DETAIL NOT SAVED";
                        lblmsg.ForeColor = Color.Red;
                    }
                }

                else
                {
                    string str = BRAND_COMPMASLogicLayer.UpdateBRAND_COMPLAIN_MASDetail(insert);
                    if (str.Contains("successfully"))
                    {
                        lblmsg.Text      = "BRAND COMPALIN MASTER DETAIL UPDATE SUCCESSFULLY.";
                        lblmsg.ForeColor = Color.Green;
                        clear();
                        FillGrid(DdlBrandTypeName.SelectedValue);
                        UserRights();
                    }
                    else if (str.Contains("Already") || str.Contains("PRIMARY KEY"))
                    {
                        lblmsg.Text      = "BRAND COMPLAIN CODE ALREADY EXIST.";
                        lblmsg.ForeColor = Color.Red;
                    }
                    else
                    {
                        lblmsg.Text      = "ERROR :BRAND COMPLAIN MASTER DETAIL NOT SAVED";
                        lblmsg.ForeColor = Color.Red;
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }