protected void dgCurrancyMaster_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            if (CommonClasses.ValidRights(int.Parse(right.Substring(4, 1)), this, "For Delete"))
            {
                if (!ModifyLog(((Label)(dgCurrancyMaster.Rows[e.RowIndex].FindControl("lblC_Code"))).Text))
                {
                    Bl_CrrancyMaster = new CurrancyMaster_BL();
                    string Curr_Code = ((Label)(dgCurrancyMaster.Rows[e.RowIndex].FindControl("lblC_Code"))).Text;
                    //string Curr_Name = ((Label)(dgCurrancyMaster.Rows[e.RowIndex].FindControl("lblC_CURR_NAME"))).Text;

                    Bl_CrrancyMaster.CURR_CODE = Convert.ToInt32(Curr_Code);
                    if (CommonClasses.CheckUsedInTran("INVOICE_MASTER", "INM_CURR_CODE", "AND ES_DELETE=0", Curr_Code))
                    {
                        //ShowMessage("#Avisos", "You cant delete this record it has used in Components", CommonClasses.MSG_Warning);
                        PanelMsg.Visible = true;
                        lblmsg.Text      = "You can't delete this record it has used in Invoice";
                        ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                    }
                    else if (CommonClasses.CheckUsedInTran("SUPP_PO_MASTER", "SPOM_CURR_CODE", "AND ES_DELETE=0", Curr_Code))
                    {
                        PanelMsg.Visible = true;
                        lblmsg.Text      = "You can't delete this record it has used in Purchase Order";
                        ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                    }
                    else
                    {
                        bool flag = Bl_CrrancyMaster.Delete();
                        if (flag == true)
                        {
                            CommonClasses.WriteLog("Currancy  Master", "Delete", "Currancy Master", Curr_Code, Convert.ToInt32(Curr_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);
                        }
                    }
                }
                LoadCurrancy();
            }
            else
            {
                PanelMsg.Visible = true;
                lblmsg.Text      = "You Have No Rights To Delete";
                ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
            }
        }
        catch (Exception Ex)
        {
            CommonClasses.SendError("Currency Master-View", "dgCurrancyMaster_RowDeleting", Ex.Message);
        }
    }
 private void LoadCurrancy()
 {
     try
     {
         Bl_CrrancyMaster = new CurrancyMaster_BL();
         Bl_CrrancyMaster.CURR_CM_COMP_ID = Convert.ToInt32(Session["CompanyId"]);
         // Bl_CrrancyMaster.FillGrid(dgCurrancyMaster);
         dt = CommonClasses.Execute("Select  COUNTRY_NAME,CURR_NAME,CURR_CODE,CURR_SHORT_NAME,CURR_DESC,CURR_RATE from CURRANCY_MASTER,COUNTRY_MASTER where CURR_CM_COMP_ID = '" + Convert.ToInt32(Session["CompanyId"]) + "' and CURRANCY_MASTER.ES_DELETE=0 and COUNTRY_MASTER.COUNTRY_CODE=CURRANCY_MASTER.CURR_COUNTRY_CODE  Order by CURR_NAME ");
         dgCurrancyMaster.DataSource = dt;
         dgCurrancyMaster.DataBind();
     }
     catch (Exception Ex)
     {
         CommonClasses.SendError("Currancy Master-View", "LoadCurrancy", Ex.Message);
     }
 }
Example #3
0
    private void ViewRec(string str)
    {
        try
        {
            BL_CurrancyMaster = new CurrancyMaster_BL(mlCode);

            // BL_CurrancyMaster.GetInfo();
            dt5 = CommonClasses.Execute("Select * from CURRANCY_MASTER where CURR_CM_COMP_ID = '" + Convert.ToInt32(Session["CompanyId"]) + "' and ES_DELETE=0 and CURR_CODE=" + mlCode + "");
            GetValues(str);
            if (str == "MOD")
            {
                CommonClasses.SetModifyLock("ITEM_CATEGORY_MASTER", "MODIFY", "I_CAT_CODE", mlCode);
            }
        }
        catch (Exception Ex)
        {
            CommonClasses.SendError("Item Category Master", "ViewRec", Ex.Message);
        }
    }
Example #4
0
 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='13'");
             right = dtRights.Rows.Count == 0 ? "00000000" : dtRights.Rows[0][0].ToString();
             LoadCountry();
             try
             {
                 if (Request.QueryString[0].Equals("VIEW"))
                 {
                     BL_CurrancyMaster = new CurrancyMaster_BL();
                     mlCode            = Convert.ToInt32(Request.QueryString[1].ToString());
                     ViewRec("VIEW");
                 }
                 else if (Request.QueryString[0].Equals("MODIFY"))
                 {
                     BL_CurrancyMaster = new CurrancyMaster_BL();
                     mlCode            = Convert.ToInt32(Request.QueryString[1].ToString());
                     ViewRec("MOD");
                 }
                 ddlCountry.Focus();
             }
             catch (Exception ex)
             {
                 CommonClasses.SendError("Currancy Master", "PageLoad", ex.Message);
             }
         }
     }
 }
Example #5
0
    bool SaveRec()
    {
        int  Zero   = 0;
        bool result = false;

        try
        {
            if (Request.QueryString[0].Equals("INSERT"))
            {
                if (txtCurrencyRate.Text == Zero.ToString())
                {
                    ShowMessage("#Avisos", "Rate not be a 0 ", CommonClasses.MSG_Warning);
                    ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);

                    return(false);
                }
                else
                {
                }
                BL_CurrancyMaster = new CurrancyMaster_BL();
                if (Setvalues())
                {
                    if (BL_CurrancyMaster.Save())
                    // dt5=CommonClasses.Execute("Select * from CURRANCY_MASTER where CURR_CM_COMP_ID = '" + Convert.ToInt32(Session["CompanyId"]) + "' and ES_DELETE=0 and CURR_NAME!='"+txtCurrancyName.Text+"' and CURR_COUNTRY_CODE='"+ddlCountry.SelectedValue+"' ");
                    {
                        string Code = CommonClasses.GetMaxId("Select Max(CURR_CODE) from CURRANCY_MASTER");
                        CommonClasses.WriteLog("Currency Master", "Save", "Item Category Master", BL_CurrancyMaster.CURR_NAME, Convert.ToInt32(Code), Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));
                        result = true;
                        Response.Redirect("~/Admin/VIEW/ViewCurrancyMaster.aspx", false);
                    }
                    else
                    {
                        if (BL_CurrancyMaster.Msg != "")
                        {
                            ShowMessage("#Avisos", BL_CurrancyMaster.Msg.ToString(), CommonClasses.MSG_Warning);

                            BL_CurrancyMaster.Msg = "";
                        }
                        ddlCountry.Focus();
                    }
                }
            }
            else if (Request.QueryString[0].Equals("MODIFY"))
            {
                BL_CurrancyMaster = new CurrancyMaster_BL(mlCode);
                if (Setvalues())
                {
                    if (BL_CurrancyMaster.Update())
                    {
                        CommonClasses.RemoveModifyLock("CURRANCY_MASTER", "MODIFY", "CURR_CODE", mlCode);
                        CommonClasses.WriteLog("Currancy Master", "Update", "Currancy Master", BL_CurrancyMaster.CURR_NAME, mlCode, Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));
                        result = true;
                        Response.Redirect("~/Admin/VIEW/ViewCurrancyMaster.aspx", false);
                    }
                    else
                    {
                        if (BL_CurrancyMaster.Msg != "")
                        {
                            ShowMessage("#Avisos", BL_CurrancyMaster.Msg.ToString(), CommonClasses.MSG_Warning);
                            ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);

                            BL_CurrancyMaster.Msg = "";
                        }
                        txtCurrancyName.Focus();
                    }
                }
            }
        }
        catch (Exception ex)
        {
            CommonClasses.SendError("Currency Master", "SaveRec", ex.Message);
        }
        return(result);
    }