Esempio n. 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
                {
                    ROUTE_MASLogicLayer insert = new ROUTE_MASLogicLayer();
                    insert.comp_code   = Session["COMP_CODE"].ToString();
                    insert.branch_code = Session["BRANCH_CODE"].ToString();
                    insert.ROUTE_CODE  = HfRouteCode.Value.Trim();
                    insert.ROUTE_NAME  = TxtRouteName.Text.Trim().ToUpper();
                    if (TxtOrder.Text == string.Empty)
                    {
                        insert.ROUTE_ORD = "0";
                    }
                    else
                    {
                        insert.ROUTE_ORD = TxtOrder.Text.Trim();
                    }

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

                ROUTE_MASLogicLayer insert = new ROUTE_MASLogicLayer();
                insert.comp_code   = HfCompCode.Value.Trim();
                insert.branch_code = HfBranchCode.Value.Trim();
                insert.ROUTE_CODE  = HfRouteCode.Value.Trim();
                insert.ROUTE_NAME  = TxtRouteName.Text.Trim().ToUpper();
                if (TxtOrder.Text == string.Empty)
                {
                    insert.ROUTE_ORD = "0";
                }
                else
                {
                    insert.ROUTE_ORD = TxtOrder.Text.Trim();
                }

                #endregion

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