예제 #1
0
    private void LoadSupplier()
    {
        try
        {
            BL_SupplierTypeMaster = new SupplierTypeMaster_BL();
            BL_SupplierTypeMaster.STM_CM_COMP_ID = Convert.ToInt32(Session["CompanyId"]);
            // BL_SupplierTypeMaster.FillGrid(dgSupplierTypeMaster);
            BL_SupplierTypeMaster.FillGrid(dgSupplierTypeMaster);
            if (dgSupplierTypeMaster.Rows.Count == 0)
            {
                dgSupplierTypeMaster.Enabled = false;
                dtFilter.Clear();
                if (dtFilter.Columns.Count == 0)
                {
                    dtFilter.Columns.Add(new System.Data.DataColumn("STM_CODE", typeof(String)));
                    dtFilter.Columns.Add(new System.Data.DataColumn("STM_TYPE_CODE", typeof(String)));
                    dtFilter.Columns.Add(new System.Data.DataColumn("STM_TYPE_DESC", typeof(String)));

                    dtFilter.Columns.Add(new System.Data.DataColumn("STM_FIRST_LETTER", typeof(String)));

                    dtFilter.Rows.Add(dtFilter.NewRow());
                    dgSupplierTypeMaster.DataSource = dtFilter;
                    dgSupplierTypeMaster.DataBind();
                }
            }
            else
            {
                dgSupplierTypeMaster.Enabled = true;
            }
        }
        catch (Exception Ex)
        {
            CommonClasses.SendError("Supplier Type Master-View", "LoadSupplier", Ex.Message);
        }
    }
예제 #2
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();
             try
             {
                 if (Request.QueryString[0].Equals("VIEW"))
                 {
                     BL_SupplierTypeMaster = new SupplierTypeMaster_BL();
                     mlCode = Convert.ToInt32(Request.QueryString[1].ToString());
                     ViewRec("VIEW");
                 }
                 else if (Request.QueryString[0].Equals("MODIFY"))
                 {
                     BL_SupplierTypeMaster = new SupplierTypeMaster_BL();
                     mlCode = Convert.ToInt32(Request.QueryString[1].ToString());
                     ViewRec("MOD");
                 }
                 txtSupplierTypeCode.Focus();
             }
             catch (Exception ex)
             {
                 CommonClasses.SendError("Supplier Type Master", "PageLoad", ex.Message);
             }
         }
     }
 }
예제 #3
0
    protected void dgSupplierTypeMaster_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            if (CommonClasses.ValidRights(int.Parse(right.Substring(5, 1)), this, "For Delete"))
            {
                if (!ModifyLog(((Label)(dgSupplierTypeMaster.Rows[e.RowIndex].FindControl("lblSTM_Code"))).Text))
                {
                    BL_SupplierTypeMaster = new SupplierTypeMaster_BL();
                    string Supplier_Code         = ((Label)(dgSupplierTypeMaster.Rows[e.RowIndex].FindControl("lblSTM_Code"))).Text;
                    string Supplier_Type_Code    = ((Label)(dgSupplierTypeMaster.Rows[e.RowIndex].FindControl("lblSTM_TYPE_CODE"))).Text;
                    string Supplier_Desc         = ((Label)(dgSupplierTypeMaster.Rows[e.RowIndex].FindControl("lblSTM_TYPE_DESC"))).Text;
                    string Supplier_First_Letter = ((Label)(dgSupplierTypeMaster.Rows[e.RowIndex].FindControl("lblSTM_FIRST_LETTER"))).Text;

                    BL_SupplierTypeMaster.STM_CODE = Convert.ToInt32(Supplier_Code);
                    if (CommonClasses.CheckUsedInTran("PARTY_MASTER", "P_STM_CODE", "AND ES_DELETE=0 and P_TYPE=2 ", Supplier_Code))
                    {
                        // ShowMessage("#Avisos", "You can't delete this record it has used in Supplier Master", CommonClasses.MSG_Warning);
                        PanelMsg.Visible = true;
                        lblmsg.Text      = "You can't delete this record it has used in Supplier Master";
                        ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
                    }
                    else
                    {
                        bool flag = BL_SupplierTypeMaster.Delete();
                        if (flag == true)
                        {
                            CommonClasses.WriteLog("Supplier Type Master", "Delete", "Supplier Type Master", Supplier_Code, Convert.ToInt32(Supplier_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);
                        }
                        LoadSupplier();
                    }
                }
            }
            else
            {
                PanelMsg.Visible = true;
                lblmsg.Text      = "You Have No Rights To Delete";
                ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
            }
        }
        catch (Exception Ex)
        {
            CommonClasses.SendError("Supplier Type Master-View", "dgSupplierTypeMaster_RowDeleting", Ex.Message);
        }
    }
예제 #4
0
 private void ViewRec(string str)
 {
     try
     {
         BL_SupplierTypeMaster = new SupplierTypeMaster_BL(mlCode);
         DataTable dt = new DataTable();
         BL_SupplierTypeMaster.GetInfo();
         GetValues(str);
         if (str == "MOD")
         {
             CommonClasses.SetModifyLock("SUPPLIER_TYPE_MASTER", "MODIFY", "STM_CODE", mlCode);
         }
     }
     catch (Exception Ex)
     {
         CommonClasses.SendError("Supplier Type Master", "ViewRec", Ex.Message);
     }
 }
예제 #5
0
    bool SaveRec()
    {
        bool result = false;

        try
        {
            if (Request.QueryString[0].Equals("INSERT"))
            {
                BL_SupplierTypeMaster = new SupplierTypeMaster_BL();
                if (Setvalues())
                {
                    if (BL_SupplierTypeMaster.Save())
                    {
                        string Code = CommonClasses.GetMaxId("Select Max(STM_CODE) from SUPPLIER_TYPE_MASTER");
                        CommonClasses.WriteLog("Supplier Type Master", "Save", "Supplier Type Master", BL_SupplierTypeMaster.STM_TYPE_CODE, Convert.ToInt32(Code), Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));
                        result = true;
                        Response.Redirect("~/Masters/VIEW/ViewSupplierTypeMaster.aspx", false);
                    }
                    else
                    {
                        if (BL_SupplierTypeMaster.Msg != "")
                        {
                            //ShowMessage("#Avisos", BL_SupplierTypeMaster.Msg.ToString(), CommonClasses.MSG_Warning);
                            lblmsg.Text      = BL_SupplierTypeMaster.Msg;
                            PanelMsg.Visible = true;
                            ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);

                            BL_SupplierTypeMaster.Msg = "";
                        }
                        txtSupplierTypeCode.Focus();
                    }
                }
            }
            else if (Request.QueryString[0].Equals("MODIFY"))
            {
                BL_SupplierTypeMaster = new SupplierTypeMaster_BL(mlCode);
                if (Setvalues())
                {
                    if (BL_SupplierTypeMaster.Update())
                    {
                        CommonClasses.RemoveModifyLock("SUPPLIER_TYPE_MASTER", "MODIFY", "STM_CODE", mlCode);
                        CommonClasses.WriteLog("Supplier Type Master", "Update", "Supplier Type Master", BL_SupplierTypeMaster.STM_TYPE_CODE, mlCode, Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));
                        result = true;
                        Response.Redirect("~/Masters/VIEW/ViewSupplierTypeMaster.aspx", false);
                    }
                    else
                    {
                        if (BL_SupplierTypeMaster.Msg != "")
                        {
                            //ShowMessage("#Avisos", BL_SupplierTypeMaster.Msg.ToString(), CommonClasses.MSG_Warning);
                            lblmsg.Text      = BL_SupplierTypeMaster.Msg;
                            PanelMsg.Visible = true;
                            ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);

                            BL_SupplierTypeMaster.Msg = "";
                        }
                        txtSupplierTypeCode.Focus();
                    }
                }
            }
        }
        catch (Exception ex)
        {
            CommonClasses.SendError("Supplier Type Master", "SaveRec", ex.Message);
        }
        return(result);
    }