Example #1
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         #region  DELETE
         if (HfChargesCode.Value != string.Empty)
         {
             string str = CHARGES_MASLogicLayer.DeleteCHARGESDetailsByID(HfChargesCode.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:Charges Not Deleted";
                 lblmsg.ForeColor = Color.Red;
             }
             clear();
             FillGrid(Session["COMP_CODE"].ToString());
             UserRights();
         }
         #endregion
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #2
0
        public void FillGrid(string CompCode)
        {
            try
            {
                DataTable Dt = new DataTable();

                Dt = CHARGES_MASLogicLayer.GetAllCHARGESDetials(Convert.ToInt32(Session["USERCODE"].ToString()), Convert.ToInt32(Session["COMP_CODE"].ToString()));
                DataView Dv = new DataView(Dt);
                if (CompCode != string.Empty)
                {
                    Dv.RowFilter = "COMP_CODE=" + Session["COMP_CODE"].ToString();
                }
                GvChargestMaster.DataSource = Dv.ToTable();
                GvChargestMaster.DataBind();
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #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
                {
                    CHARGES_MASLogicLayer insert = new CHARGES_MASLogicLayer();
                    insert.COMP_CODE = Session["COMP_CODE"].ToString();
                    insert.NAME      = TxtChargesName.Text.Trim().ToUpper();
                    if (TxtRate.Text == string.Empty)
                    {
                        insert.PER = "0";
                    }
                    else
                    {
                        insert.PER = TxtRate.Text.Trim();
                    }
                    insert.SIGN  = DdlSign.SelectedValue.Trim().ToUpper();
                    insert.ACODE = DdlAccountName.SelectedValue.Trim().ToUpper();

                    if (TxtHSNCode.Text == string.Empty)
                    {
                        insert.HSN_NO = "0";
                    }
                    else
                    {
                        insert.HSN_NO = TxtHSNCode.Text.Trim();
                    }
                    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 = CHARGES_MASLogicLayer.InsertCHARGESDetail(insert);
                        if (str.Length <= 8)
                        {
                            //INSERT CHARGE RATE
                            CHARGES_RATEMASLogicLayer InsertRate = new CHARGES_RATEMASLogicLayer();

                            InsertRate.CCODE     = str;
                            InsertRate.COMP_CODE = Session["COMP_CODE"].ToString();
                            InsertRate.YRDT1     = Convert.ToDateTime(Session["FIN_YEAR"]).ToString("yyyy-MM-dd");


                            if (TxtGST.Text == string.Empty)
                            {
                                InsertRate.GST_RATE = "0";
                            }
                            else
                            {
                                InsertRate.GST_RATE = TxtGST.Text.Trim();
                            }

                            if (TxtCGST.Text == string.Empty)
                            {
                                InsertRate.CGST_RATE = "0";
                            }
                            else
                            {
                                InsertRate.CGST_RATE = TxtCGST.Text.Trim();
                            }

                            if (TxtSGST.Text == string.Empty)
                            {
                                InsertRate.SGST_RATE = "0";
                            }
                            else
                            {
                                InsertRate.SGST_RATE = TxtSGST.Text.Trim();
                            }

                            if (TxtIGST.Text == string.Empty)
                            {
                                InsertRate.IGST_RATE = "0";
                            }
                            else
                            {
                                InsertRate.IGST_RATE = TxtIGST.Text.Trim();
                            }
                            InsertRate.INS_USERID   = Session["USERNAME"].ToString();
                            InsertRate.INS_TERMINAL = Session["PC"].ToString();
                            InsertRate.INS_DATE     = "";
                            InsertRate.UPD_USERID   = Session["USERNAME"].ToString();
                            InsertRate.UPD_TERMINAL = Session["PC"].ToString();
                            InsertRate.UPD_DATE     = "";
                            CHARGES_RATEMASLogicLayer.InsertCHARGES_RATEMASDetail(InsertRate);

                            lblmsg.Text      = "CHARGES 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      = "CHARGES CODE ALREADY EXIST.";
                            lblmsg.ForeColor = Color.Red;
                        }
                        else
                        {
                            lblmsg.Text      = "ERROR : CHARGES DETAIL NOT SAVED";
                            lblmsg.ForeColor = Color.Red;
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #4
0
        protected void GvChargestMaster_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Deletea")
                {
                    #region DELETE
                    clear();
                    DataTable dt = CHARGES_MASLogicLayer.GetAllIDWiseCHARGESDetials(e.CommandArgument.ToString());
                    if (dt.Rows.Count > 0)
                    {
                        DivEntry.Visible = true;
                        DivView.Visible  = false;

                        HfCompCode.Value             = dt.Rows[0]["COMP_CODE"].ToString();
                        HfChargesCode.Value          = dt.Rows[0]["CCODE"].ToString();
                        TxtChargesName.Text          = dt.Rows[0]["NAME"].ToString();
                        TxtRate.Text                 = dt.Rows[0]["PER"].ToString();
                        DdlSign.SelectedValue        = dt.Rows[0]["SIGN"].ToString();
                        DdlAccountName.SelectedValue = dt.Rows[0]["ACODE"].ToString();
                        TxtHSNCode.Text              = dt.Rows[0]["HSN_NO"].ToString();
                        TxtGST.Text       = dt.Rows[0]["GST_RATE"].ToString();
                        TxtCGST.Text      = dt.Rows[0]["CGST_RATE"].ToString();
                        TxtSGST.Text      = dt.Rows[0]["SGST_RATE"].ToString();
                        TxtIGST.Text      = dt.Rows[0]["IGST_RATE"].ToString();
                        HfYearDate1.Value = dt.Rows[0]["YRDT1"].ToString();
                    }

                    btnSave.Visible    = false;
                    btnDelete.Visible  = true;
                    Btncalldel.Visible = true;
                    BtncallUpd.Visible = false;
                    ControllerDisable();

                    #endregion
                }

                if (e.CommandName == "Edita")
                {
                    #region EDIT
                    clear();
                    DataTable dt = CHARGES_MASLogicLayer.GetAllIDWiseCHARGESDetials(e.CommandArgument.ToString());
                    if (dt.Rows.Count > 0)
                    {
                        DivEntry.Visible = true;
                        DivView.Visible  = false;

                        HfCompCode.Value             = dt.Rows[0]["COMP_CODE"].ToString();
                        HfChargesCode.Value          = dt.Rows[0]["CCODE"].ToString();
                        TxtChargesName.Text          = dt.Rows[0]["NAME"].ToString();
                        TxtRate.Text                 = dt.Rows[0]["PER"].ToString();
                        DdlSign.SelectedValue        = dt.Rows[0]["SIGN"].ToString();
                        DdlAccountName.SelectedValue = dt.Rows[0]["ACODE"].ToString();
                        TxtHSNCode.Text              = dt.Rows[0]["HSN_NO"].ToString();
                        TxtGST.Text       = dt.Rows[0]["GST_RATE"].ToString();
                        TxtCGST.Text      = dt.Rows[0]["CGST_RATE"].ToString();
                        TxtSGST.Text      = dt.Rows[0]["SGST_RATE"].ToString();
                        TxtIGST.Text      = dt.Rows[0]["IGST_RATE"].ToString();
                        HfYearDate1.Value = dt.Rows[0]["YRDT1"].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 = CHARGES_MASLogicLayer.GetAllIDWiseCHARGESDetials(e.CommandArgument.ToString());
                    if (dt.Rows.Count > 0)
                    {
                        DivEntry.Visible = true;
                        DivView.Visible  = false;

                        HfCompCode.Value             = dt.Rows[0]["COMP_CODE"].ToString();
                        HfChargesCode.Value          = dt.Rows[0]["CCODE"].ToString();
                        TxtChargesName.Text          = dt.Rows[0]["NAME"].ToString();
                        TxtRate.Text                 = dt.Rows[0]["PER"].ToString();
                        DdlSign.SelectedValue        = dt.Rows[0]["SIGN"].ToString();
                        DdlAccountName.SelectedValue = dt.Rows[0]["ACODE"].ToString();
                        TxtHSNCode.Text              = dt.Rows[0]["HSN_NO"].ToString();
                        TxtGST.Text       = dt.Rows[0]["GST_RATE"].ToString();
                        TxtCGST.Text      = dt.Rows[0]["CGST_RATE"].ToString();
                        TxtSGST.Text      = dt.Rows[0]["SGST_RATE"].ToString();
                        TxtIGST.Text      = dt.Rows[0]["IGST_RATE"].ToString();
                        HfYearDate1.Value = dt.Rows[0]["YRDT1"].ToString();
                    }
                    #endregion
                    ControllerDisable();
                    btnSave.Visible    = false;
                    Btncalldel.Visible = false;
                    BtncallUpd.Visible = false;
                    UserRights();
                }
            }
            catch (Exception ex)
            {
                lblmsg.Text = ex.Message.ToString();
            }
        }
Example #5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                #region INSERT _ UPDATE VALUE

                CHARGES_MASLogicLayer insert = new CHARGES_MASLogicLayer();
                insert.COMP_CODE = HfCompCode.Value.Trim();
                insert.CCODE     = HfChargesCode.Value.Trim();
                insert.NAME      = TxtChargesName.Text.Trim().ToUpper();

                if (TxtRate.Text == string.Empty)
                {
                    insert.PER = "0";
                }
                else
                {
                    insert.PER = TxtRate.Text.Trim();
                }
                insert.SIGN  = DdlSign.SelectedValue.Trim().ToUpper();
                insert.ACODE = DdlAccountName.SelectedValue.Trim().ToUpper();

                if (TxtHSNCode.Text == string.Empty)
                {
                    insert.HSN_NO = "0";
                }
                else
                {
                    insert.HSN_NO = TxtHSNCode.Text.Trim();
                }
                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 = CHARGES_MASLogicLayer.InsertCHARGESDetail(insert);
                    if (str.Length <= 8)
                    {
                        lblmsg.Text      = "CHARGES 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      = "CHARGES CODE ALREADY EXIST.";
                        lblmsg.ForeColor = Color.Red;
                    }
                    else
                    {
                        lblmsg.Text      = "ERROR : CHARGES DETAIL NOT SAVED";
                        lblmsg.ForeColor = Color.Red;
                    }
                }

                else
                {
                    string str = CHARGES_MASLogicLayer.UpdateCHARGESDetails(insert);
                    if (str.Contains("successfully"))
                    {
                        //INSERT CHARGE RATE
                        CHARGES_RATEMASLogicLayer InsertRate = new CHARGES_RATEMASLogicLayer();
                        InsertRate.CCODE     = HfChargesCode.Value.Trim();
                        InsertRate.COMP_CODE = HfCompCode.Value.Trim();
                        InsertRate.YRDT1     = Convert.ToDateTime(HfYearDate1.Value.Trim()).ToString("yyyy-MM-dd");

                        if (TxtGST.Text == string.Empty)
                        {
                            InsertRate.GST_RATE = "0";
                        }
                        else
                        {
                            InsertRate.GST_RATE = TxtGST.Text.Trim();
                        }

                        if (TxtCGST.Text == string.Empty)
                        {
                            InsertRate.CGST_RATE = "0";
                        }
                        else
                        {
                            InsertRate.CGST_RATE = TxtCGST.Text.Trim();
                        }

                        if (TxtSGST.Text == string.Empty)
                        {
                            InsertRate.SGST_RATE = "0";
                        }
                        else
                        {
                            InsertRate.SGST_RATE = TxtSGST.Text.Trim();
                        }

                        if (TxtIGST.Text == string.Empty)
                        {
                            InsertRate.IGST_RATE = "0";
                        }
                        else
                        {
                            InsertRate.IGST_RATE = TxtIGST.Text.Trim();
                        }
                        InsertRate.INS_USERID   = Session["USERNAME"].ToString();
                        InsertRate.INS_TERMINAL = Session["PC"].ToString();
                        InsertRate.INS_DATE     = "";
                        InsertRate.UPD_USERID   = Session["USERNAME"].ToString();
                        InsertRate.UPD_TERMINAL = Session["PC"].ToString();
                        InsertRate.UPD_DATE     = "";

                        CHARGES_RATEMASLogicLayer.UpdateCHARGES_RATEMASDetails(InsertRate);

                        lblmsg.Text      = "CHARGES DETAIL UPDATE SUCCESSFULLY.";
                        lblmsg.ForeColor = Color.Green;
                        clear();
                        FillGrid(Session["COMP_CODE"].ToString());
                        UserRights();
                    }
                    else if (str.Contains("Already"))
                    {
                        lblmsg.Text      = "CHARGES CODE ALREADY EXIST.";
                        lblmsg.ForeColor = Color.Red;
                    }
                    else
                    {
                        lblmsg.Text      = "ERROR :CHARGES DETAIL NOT SAVED";
                        lblmsg.ForeColor = Color.Red;
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }