示例#1
0
 private void LoadSalesTaxMasterDetails()
 {
     try
     {
         BL_SalesTaxMAster = new SalesTaxMaster_BL();
         BL_SalesTaxMAster.ST_CM_COMP_ID = Convert.ToInt32(Session["CompanyId"]);
         BL_SalesTaxMAster.FillGrid(dgSalesTaxMaster);
         if (dgSalesTaxMaster.Rows.Count > 0)
         {
             dgSalesTaxMaster.Enabled = true;
         }
     }
     catch (Exception Ex)
     {
         CommonClasses.SendError("Sales Tax Master", "LoadSalesTaxMasterDetails", Ex.Message);
     }
 }
 private void ViewRec(string str)
 {
     try
     {
         BL_SalesTaxMaster = new SalesTaxMaster_BL(mlCode);
         DataTable dt = new DataTable();
         BL_SalesTaxMaster.GetInfo();
         GetValues(str);
         if (str == "MOD")
         {
             CommonClasses.SetModifyLock("SALES_TAX_MASTER", "MODIFY", "ST_CODE", mlCode);
         }
     }
     catch (Exception Ex)
     {
         CommonClasses.SendError("Sales Tax Master", "ViewRec", Ex.Message);
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty((string)Session["CompanyId"]) && string.IsNullOrEmpty((string)Session["Username"]))
     {
         Response.Redirect("~/Default.aspx", false);
     }
     else
     {
         if (!IsPostBack)
         {
             DataTable dtRights = CommonClasses.Execute("select UR_RIGHTS from USER_RIGHT where UR_IS_DELETE=0 AND UR_UM_CODE='" + Convert.ToInt32(Session["UserCode"]) + "' and UR_SM_CODE='16'");
             right = dtRights.Rows.Count == 0 ? "0000000" : dtRights.Rows[0][0].ToString();
             try
             {
                 LoadTaxHeadSales();
                 LoadTaxHeadPurchase();
                 if (Request.QueryString[0].Equals("VIEW"))
                 {
                     BL_SalesTaxMaster = new SalesTaxMaster_BL();
                     mlCode            = Convert.ToInt32(Request.QueryString[1].ToString());
                     ViewRec("VIEW");
                 }
                 else if (Request.QueryString[0].Equals("MODIFY"))
                 {
                     BL_SalesTaxMaster = new SalesTaxMaster_BL();
                     mlCode            = Convert.ToInt32(Request.QueryString[1].ToString());
                     ViewRec("MOD");
                 }
                 txtTaxName.Focus();
             }
             catch (Exception ex)
             {
                 CommonClasses.SendError("Sales Tax Master", "PageLoad", ex.Message);
             }
         }
     }
 }
    bool SaveRec()
    {
        bool result = false;

        try
        {
            string StrReplaceTaxName = txtTaxName.Text;


            StrReplaceTaxName = StrReplaceTaxName.Replace("'", "''");

            if (Request.QueryString[0].Equals("INSERT"))
            {
                BL_SalesTaxMaster = new SalesTaxMaster_BL();
                if (Setvalues())
                {
                    if (BL_SalesTaxMaster.Save())
                    {
                        string Code = CommonClasses.GetMaxId("Select Max(ST_CODE) from  SALES_TAX_MASTER");
                        CommonClasses.WriteLog("Sales Tax Master", "Save", "Sales Tax Master", BL_SalesTaxMaster.ST_TAX_NAME, Convert.ToInt32(Code), Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));
                        result = true;
                        Response.Redirect("~/Masters/VIEW/ViewSalesTaxMaster.aspx", false);
                    }
                    else
                    {
                        if (BL_SalesTaxMaster.Msg != "")
                        {
                            //ShowMessage("#Avisos", BL_SalesTaxMaster.Msg.ToString(), CommonClasses.MSG_Warning);
                            lblmsg.Text      = BL_SalesTaxMaster.Msg;
                            PanelMsg.Visible = true;
                            ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert1();", true);

                            BL_SalesTaxMaster.Msg = "";
                        }
                        txtTaxName.Focus();
                    }
                }
            }
            else if (Request.QueryString[0].Equals("MODIFY"))
            {
                BL_SalesTaxMaster = new SalesTaxMaster_BL(mlCode);
                if (Setvalues())
                {
                    if (BL_SalesTaxMaster.Update())
                    {
                        CommonClasses.RemoveModifyLock(" SALES_TAX_MASTER", "MODIFY", "ST_CODE", mlCode);
                        CommonClasses.WriteLog("Sales Tax Master", "Update", "Sales Tax Master", BL_SalesTaxMaster.ST_TAX_NAME, mlCode, Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));
                        result = true;
                        Response.Redirect("~/Masters/VIEW/ViewSalesTaxMaster.aspx", false);
                    }
                    else
                    {
                        if (BL_SalesTaxMaster.Msg != "")
                        {
                            //ShowMessage("#Avisos", BL_SalesTaxMaster.Msg.ToString(), CommonClasses.MSG_Warning);
                            lblmsg.Text      = BL_SalesTaxMaster.Msg;
                            PanelMsg.Visible = true;
                            ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert1();", true);

                            BL_SalesTaxMaster.Msg = "";
                        }
                        txtTaxName.Focus();
                    }
                }
            }
        }
        catch (Exception ex)
        {
            CommonClasses.SendError("Sales Tax Master", "SaveRec", ex.Message);
        }
        return(result);
    }
示例#5
0
    protected void dgSalesTaxMaster_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            if (CommonClasses.ValidRights(int.Parse(right.Substring(4, 1)), this, "For Delete"))
            {
                if (!ModifyLog(((Label)(dgSalesTaxMaster.Rows[e.RowIndex].FindControl("lblST_CODE"))).Text))
                {
                    BL_SalesTaxMAster = new SalesTaxMaster_BL();
                    string ST_CODE      = ((Label)(dgSalesTaxMaster.Rows[e.RowIndex].FindControl("lblST_CODE"))).Text;
                    string ST_TAX_NAME  = ((Label)(dgSalesTaxMaster.Rows[e.RowIndex].FindControl("lblST_TAX_NAME"))).Text;
                    string ST_ALIAS     = ((Label)(dgSalesTaxMaster.Rows[e.RowIndex].FindControl("lblST_ALIAS"))).Text;
                    string ST_SALES_TAX = ((Label)(dgSalesTaxMaster.Rows[e.RowIndex].FindControl("lblST_SALES_TAX"))).Text;
                    string ST_TCS_TAX   = ((Label)(dgSalesTaxMaster.Rows[e.RowIndex].FindControl("lblST_TCS_TAX"))).Text;
                    // string ST_SET_OFF = ((Label)(dgSalesTaxMaster.Rows[e.RowIndex].FindControl("lblST_SET_OFF"))).Text;
                    string ST_FORM_NO        = ((Label)(dgSalesTaxMaster.Rows[e.RowIndex].FindControl("lblST_FORM_NO"))).Text;
                    string ST_SALES_ACC_HEAD = ((Label)(dgSalesTaxMaster.Rows[e.RowIndex].FindControl("lblST_SALES_ACC_HEAD"))).Text;
                    string ST_TAX_ACC_HEAD   = ((Label)(dgSalesTaxMaster.Rows[e.RowIndex].FindControl("lblST_TAX_ACC_HEAD"))).Text;

                    BL_SalesTaxMAster.ST_CODE = Convert.ToInt32(ST_CODE);
                    if (CommonClasses.CheckUsedInTran("ITEM_MASTER", "I_ACCOUNT_SALES", "AND ES_DELETE=0", ST_CODE))
                    {
                        PanelMsg.Visible = true;
                        lblmsg.Text      = "You cant delete this record it has used in Item Master";
                        ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);

                        // ShowMessage("#Avisos", "You cant delete this record it has used in Sales Tax Master", CommonClasses.MSG_Warning);
                    }
                    else if (CommonClasses.CheckUsedInTran("ITEM_MASTER", "I_ACCOUNT_PURCHASE", "AND ES_DELETE=0", ST_CODE))
                    {
                        PanelMsg.Visible = true;
                        lblmsg.Text      = "You cant delete this record it has used in Item Master";
                        ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);

                        // ShowMessage("#Avisos", "You cant delete this record it has used in Sales Tax Master", CommonClasses.MSG_Warning);
                    }

                    else
                    {
                        bool flag = BL_SalesTaxMAster.Delete();
                        if (flag == true)
                        {
                            CommonClasses.WriteLog("Sales Tax Master", "Delete", "Sales Tax Master", ST_CODE, Convert.ToInt32(ST_CODE), Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));
                            //ShowMessage("#Avisos", CommonClasses.strRegDelSucesso, CommonClasses.MSG_Erro);
                            PanelMsg.Visible = true;
                            lblmsg.Text      = "Record Deleted Successfully";
                            ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                        }
                        LoadSalesTaxMasterDetails();
                    }
                }
            }



            else
            {
                PanelMsg.Visible = true;
                lblmsg.Text      = "You Have No Rights To Delete";
                ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);

                //ShowMessage("#Avisos", "You Have No Rights To Delete", CommonClasses.MSG_Erro);
                return;
            }
        }
        catch (Exception Ex)
        {
            CommonClasses.SendError("Saltes Tax Master", "dgSalesTaxMaster_RowDeleting", Ex.Message);
        }
    }