예제 #1
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_ReferenceMaster = new ReferenceMaster_BL();
                     mlCode             = Convert.ToInt32(Request.QueryString[1].ToString());
                     ViewRec("VIEW");
                 }
                 else if (Request.QueryString[0].Equals("MODIFY"))
                 {
                     BL_ReferenceMaster = new ReferenceMaster_BL();
                     mlCode             = Convert.ToInt32(Request.QueryString[1].ToString());
                     ViewRec("MOD");
                 }
                 txtReferenceName.Focus();
             }
             catch (Exception ex)
             {
                 CommonClasses.SendError("Reference Master", "PageLoad", ex.Message);
             }
         }
     }
 }
예제 #2
0
    protected void dgReferenceMaster_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            if (CommonClasses.ValidRights(int.Parse(right.Substring(4, 1)), this, "For Delete"))
            {
                if (!ModifyLog(((Label)(dgReferenceMaster.Rows[e.RowIndex].FindControl("lblREF_CODE"))).Text))
                {
                    BL_ReferenceMaster = new ReferenceMaster_BL();
                    string REF_code = ((Label)(dgReferenceMaster.Rows[e.RowIndex].FindControl("lblREF_CODE"))).Text;
                    string REF_name = ((Label)(dgReferenceMaster.Rows[e.RowIndex].FindControl("lblREF_NAME"))).Text;
                    string REF_desc = ((Label)(dgReferenceMaster.Rows[e.RowIndex].FindControl("lblREF_DESC"))).Text;
                    BL_ReferenceMaster.REF_CODE = Convert.ToInt32(REF_code);
                    if (CommonClasses.CheckUsedInTran("RECIEPT_DETAIL", "RCPD_INVOICE_CODE", "AND ES_DELETE=0", REF_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 Components", CommonClasses.MSG_Warning);
                    }
                    else
                    {
                        bool flag = BL_ReferenceMaster.Delete();
                        if (flag == true)
                        {
                            CommonClasses.WriteLog("Reference Master", "Delete", "Reference Master", REF_name, Convert.ToInt32(REF_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);
                        }

                        LoadReference();
                    }
                }
            }
            else
            {
                PanelMsg.Visible = true;
                lblmsg.Text      = "You have No Rights To Delete";
                ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);
            }
        }
        catch (Exception Ex)
        {
            CommonClasses.SendError("Reference Master - View", "GridView1_RowDeleting", Ex.Message);
        }
    }
예제 #3
0
 private void LoadReference()
 {
     try
     {
         BL_ReferenceMaster = new ReferenceMaster_BL();
         BL_ReferenceMaster.REF_CM_COMP_ID = Convert.ToInt32(Session["CompanyId"]);
         BL_ReferenceMaster.FillGrid(dgReferenceMaster);
         if (dgReferenceMaster.Rows.Count > 0)
         {
             dgReferenceMaster.Enabled = true;
         }
     }
     catch (Exception Ex)
     {
         CommonClasses.SendError("Reference Master-View", "LoadReference", Ex.Message);
     }
 }
예제 #4
0
    //#region btnClose_Click
    //protected void btnClose_Click(object sender, EventArgs e)
    //{
    //    try
    //    {
    //        if (mlCode != 0 && mlCode != null)
    //        {
    //            CommonClasses.RemoveModifyLock("NEWREFERENCE_MASTER", "MODIFY", "REF_CODE", mlCode);
    //        }
    //        Response.Redirect("~/Masters/VIEW/ViewReferenceMaster.aspx", false);
    //    }
    //    catch (Exception Ex)
    //    {
    //        CommonClasses.SendError("Reference Master", "btnClose_Click", Ex.Message);
    //    }
    //}
    //#endregion btnClose_Click
    #endregion

    #region ViewRec
    private void ViewRec(string str)
    {
        try
        {
            BL_ReferenceMaster = new ReferenceMaster_BL(mlCode);
            DataTable dt = new DataTable();
            BL_ReferenceMaster.GetInfo();
            GetValues(str);
            if (str == "MOD")
            {
                CommonClasses.SetModifyLock("NEWREFERENCE_MASTER", "MODIFY", "REF_CODE", mlCode);
            }
        }
        catch (Exception Ex)
        {
            CommonClasses.SendError("Reference Master", "ViewRec", Ex.Message);
        }
    }
예제 #5
0
    bool SaveRec()
    {
        bool result = false;

        try
        {
            if (Request.QueryString[0].Equals("INSERT"))
            {
                BL_ReferenceMaster = new ReferenceMaster_BL();
                if (Setvalues())
                {
                    if (BL_ReferenceMaster.Save())
                    {
                        string Code = CommonClasses.GetMaxId("Select Max(REF_CODE) from NEWREFERENCE_MASTER");
                        CommonClasses.WriteLog("Reference Master", "Save", "Reference Master", BL_ReferenceMaster.REF_NAME, Convert.ToInt32(Code), Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));
                        result = true;
                        Response.Redirect(URL, false);
                    }
                    else
                    {
                        if (BL_ReferenceMaster.Msg != "")
                        {
                            ShowMessage("#Avisos", BL_ReferenceMaster.Msg.ToString(), CommonClasses.MSG_Warning);
                            ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);

                            //PanelMsg.Visible = true;
                            //lblmsg.Text = BL_ReferenceMaster.Msg;
                            BL_ReferenceMaster.Msg = "";
                        }
                        txtReferenceName.Focus();
                    }
                }
            }
            else if (Request.QueryString[0].Equals("MODIFY"))
            {
                BL_ReferenceMaster = new ReferenceMaster_BL(mlCode);
                if (Setvalues())
                {
                    if (BL_ReferenceMaster.Update())
                    {
                        CommonClasses.RemoveModifyLock("NEWREFERENCE_MASTER", "MODIFY", "REF_CODE", mlCode);
                        CommonClasses.WriteLog("Reference Master", "Update", "Reference Master", BL_ReferenceMaster.REF_NAME, mlCode, Convert.ToInt32(Session["CompanyId"]), Convert.ToInt32(Session["CompanyCode"]), (Session["Username"].ToString()), Convert.ToInt32(Session["UserCode"]));
                        result = true;
                        Response.Redirect(URL, false);
                    }
                    else
                    {
                        if (BL_ReferenceMaster.Msg != "")
                        {
                            ShowMessage("#Avisos", BL_ReferenceMaster.Msg.ToString(), CommonClasses.MSG_Warning);
                            ScriptManager.RegisterStartupScript(this, GetType(), "displayalertmessage", "Showalert();", true);

                            BL_ReferenceMaster.Msg = "";
                        }
                        txtReferenceName.Focus();
                    }
                }
            }
        }
        catch (Exception ex)
        {
            CommonClasses.SendError("Reference Master", "SaveRec", ex.Message);
        }
        return(result);
    }