Пример #1
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                #region  DELETE
                if (HfStateCode.Value != string.Empty)
                {
                    string str = STATE_MASLogicLayer.DeleteSTATE_MASDetailsByID(HfStateCode.Value);
                    if (str.Contains("successfully"))
                    {
                        lblmsg.Text      = "Record Deleted Successfully";
                        lblmsg.ForeColor = Color.Green;
                    }
                    else if (str.Contains("Cannot"))
                    {
                        lblmsg.Text      = "Cannot Delete This Record It Used by Other Data";
                        lblmsg.ForeColor = Color.Red;
                    }
                    else
                    {
                        lblmsg.Text      = "Error:Branch Not Deleted";
                        lblmsg.ForeColor = Color.Red;
                    }
                    clear();
                    FillGrid();
                    UserRights();
                }
                #endregion
            }

            catch (Exception)
            {
                throw;
            }
        }
Пример #2
0
        public void FillGrid(string sortExpression = null)
        {
            try
            {
                DataTable Dt = new DataTable();

                Dt = STATE_MASLogicLayer.GetAllSTATE_MASDetials(Convert.ToInt32(Session["USERCODE"].ToString()), Convert.ToInt32(Session["COMP_CODE"].ToString()));

                if (sortExpression != null)
                {
                    DataView dv = Dt.AsDataView();
                    this.SortDirection       = this.SortDirection == "ASC" ? "DESC" : "ASC";
                    dv.Sort                  = sortExpression + " " + this.SortDirection;
                    GvStateMaster.DataSource = dv;
                    GvStateMaster.DataBind();
                }
                else
                {
                    GvStateMaster.DataSource = Dt;
                    GvStateMaster.DataBind();
                }


                //  GvStateMaster.DataSource = Dt;
                //  GvStateMaster.DataBind();
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #3
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;
            }
        }
Пример #4
0
 protected void TxtBranchState_TextChanged(object sender, EventArgs e)
 {
     try
     {
         DataTable DtSTATEName = STATE_MASLogicLayer.GetAllSTATE_MASDetials(Convert.ToInt32(Session["USERCODE"].ToString()), Convert.ToInt32(Session["COMP_CODE"].ToString()));
         if (TxtBranchState.Text != string.Empty)
         {
             DataView Dv = new DataView(DtSTATEName);
             Dv.RowFilter = "STATE_NAME='" + TxtBranchState.Text.Trim() + "'";
             DataTable DtView = Dv.ToTable();
             if (DtView.Rows.Count > 0)
             {
                 TxtBranchStateNo.Text = DtView.Rows[0]["STATE_NO"].ToString();
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #5
0
        protected void GvStateMaster_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Deletea")
                {
                    #region DELETE
                    clear();
                    DataTable dt = STATE_MASLogicLayer.GetAllIDWiseSTATE_MASDetials(e.CommandArgument.ToString());
                    if (dt.Rows.Count > 0)
                    {
                        DivEntry.Visible = true;
                        DivView.Visible  = false;

                        HfStateCode.Value          = dt.Rows[0]["STATE_CODE"].ToString();
                        TxtStateName.Text          = dt.Rows[0]["STATE_NAME"].ToString();
                        TxtStateNo.Text            = dt.Rows[0]["STATE_NO"].ToString();
                        DdlStateType.SelectedValue = dt.Rows[0]["STATE_TYPE"].ToString();
                        TxtStateShort.Text         = dt.Rows[0]["STATE_SHORT"].ToString();
                        TxtStateCapital.Text       = dt.Rows[0]["STATE_CAPITAL"].ToString();
                    }
                    btnSave.Visible    = false;
                    btnDelete.Visible  = true;
                    Btncalldel.Visible = true;
                    BtncallUpd.Visible = false;
                    ControllerDisable();

                    #endregion
                }

                if (e.CommandName == "Edita")
                {
                    #region EDIT

                    clear();
                    DataTable dt = STATE_MASLogicLayer.GetAllIDWiseSTATE_MASDetials(e.CommandArgument.ToString());
                    if (dt.Rows.Count > 0)
                    {
                        DivEntry.Visible = true;
                        DivView.Visible  = false;

                        HfStateCode.Value          = dt.Rows[0]["STATE_CODE"].ToString();
                        TxtStateName.Text          = dt.Rows[0]["STATE_NAME"].ToString();
                        TxtStateNo.Text            = dt.Rows[0]["STATE_NO"].ToString();
                        DdlStateType.SelectedValue = dt.Rows[0]["STATE_TYPE"].ToString();
                        TxtStateShort.Text         = dt.Rows[0]["STATE_SHORT"].ToString();
                        TxtStateCapital.Text       = dt.Rows[0]["STATE_CAPITAL"].ToString();

                        BtncallUpd.Text = "UPDATE";

                        #endregion
                    }

                    #region CHECK UPDATE RIGHTS
                    if (Session["UPDATE"] != null)
                    {
                        if (Session["UPDATE"].ToString() == "Y")
                        {
                            ControllerEnable();
                        }
                        else
                        {
                            ControllerDisable();
                        }
                    }
                    #endregion
                    Btncalldel.Visible = false;
                    BtncallUpd.Visible = true;
                    btnSave.Visible    = true;
                    UserRights();
                }

                if (e.CommandName == "Viewa")
                {
                    #region SET TEXT ON VIEW

                    clear();
                    DataTable dt = STATE_MASLogicLayer.GetAllIDWiseSTATE_MASDetials(e.CommandArgument.ToString());
                    if (dt.Rows.Count > 0)
                    {
                        DivEntry.Visible = true;
                        DivView.Visible  = false;

                        HfStateCode.Value          = dt.Rows[0]["STATE_CODE"].ToString();
                        TxtStateName.Text          = dt.Rows[0]["STATE_NAME"].ToString();
                        TxtStateNo.Text            = dt.Rows[0]["STATE_NO"].ToString();
                        DdlStateType.SelectedValue = dt.Rows[0]["STATE_TYPE"].ToString();
                        TxtStateShort.Text         = dt.Rows[0]["STATE_SHORT"].ToString();
                        TxtStateCapital.Text       = dt.Rows[0]["STATE_CAPITAL"].ToString();

                        #endregion
                    }

                    ControllerDisable();
                    btnSave.Visible    = false;
                    Btncalldel.Visible = false;
                    BtncallUpd.Visible = false;
                    UserRights();
                }
            }
            catch (Exception ex)
            {
                lblmsg.Text = ex.Message.ToString();
            }
        }
Пример #6
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;
            }
        }