Example #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
                {
                    HSNCODE_MASLogicLayer insert = new HSNCODE_MASLogicLayer();
                    insert.COMP_CODE = Session["COMP_CODE"].ToString();
                    insert.HSN_CODE  = HfHsnCode.Value.Trim();

                    if (TxtHsnNo.Text == string.Empty)
                    {
                        insert.HSN_NO = "0";
                    }
                    else
                    {
                        insert.HSN_NO = TxtHsnNo.Text.Trim();
                    }
                    insert.HSN_DESC     = TxtProductName.Text.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     = "";

                    if (BtncallUpd.Text.Trim().ToUpper() == "SAVE")
                    {
                        string str = HSNCODE_MASLogicLayer.InsertHSNCODE_MASDetials(insert);
                        if (str.Contains("successfully"))
                        {
                            lblmsg.Text      = "HSN CODE DETAIL ADD SUCCESSFULLY.";
                            lblmsg.ForeColor = Color.Green;
                            clear();
                            FillGrid(Session["COMP_CODE"].ToString());
                            UserRights();
                        }
                        else if (str.Contains("Already") || str.Contains("PRIMARY KEY"))
                        {
                            lblmsg.Text      = "HSN CODE MASTER ALREADY EXIST.";
                            lblmsg.ForeColor = Color.Red;
                        }
                        else
                        {
                            lblmsg.Text      = "ERROR : HSN CODE DETAIL NOT SAVED";
                            lblmsg.ForeColor = Color.Red;
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                #region INSERT _ UPDATE VALUE
                HSNCODE_MASLogicLayer insert = new HSNCODE_MASLogicLayer();
                insert.COMP_CODE = HfCompCode.Value.Trim();
                insert.HSN_CODE  = HfHsnCode.Value.Trim();

                if (TxtHsnNo.Text == string.Empty)
                {
                    insert.HSN_NO = "0";
                }
                else
                {
                    insert.HSN_NO = TxtHsnNo.Text.Trim();
                }
                insert.HSN_DESC     = TxtProductName.Text.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 = HSNCODE_MASLogicLayer.InsertHSNCODE_MASDetials(insert);
                    if (str.Contains("successfully"))
                    {
                        lblmsg.Text      = "HSN CODE DETAIL ADD SUCCESSFULLY.";
                        lblmsg.ForeColor = Color.Green;
                        clear();
                        FillGrid(Session["COMP_CODE"].ToString());
                        UserRights();
                    }
                    else if (str.Contains("Already") || str.Contains("PRIMARY KEY"))
                    {
                        lblmsg.Text      = "HSN CODE MASTER ALREADY EXIST.";
                        lblmsg.ForeColor = Color.Red;
                    }
                    else
                    {
                        lblmsg.Text      = "ERROR : HSN CODE DETAIL NOT SAVED";
                        lblmsg.ForeColor = Color.Red;
                    }
                }
                else
                {
                    string str = HSNCODE_MASLogicLayer.UpdateHSNCODE_MASDetail(insert);
                    if (str.Contains("successfully"))
                    {
                        lblmsg.Text      = "HSN CODE DETAIL UPDATE SUCCESSFULLY.";
                        lblmsg.ForeColor = Color.Green;
                        clear();
                        FillGrid(Session["COMP_CODE"].ToString());
                        UserRights();
                    }
                    else if (str.Contains("Already") || str.Contains("PRIMARY KEY"))
                    {
                        lblmsg.Text      = "HSN CODE MASTER ALREADY EXIST.";
                        lblmsg.ForeColor = Color.Red;
                    }
                    else
                    {
                        lblmsg.Text      = "ERROR : HSN CODE DETAIL NOT SAVED";
                        lblmsg.ForeColor = Color.Red;
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }