예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    BindReviewDDL();
                    List <string> groups = new List <string>();
                    groups.Add("SalesManagers");
                    if (Common.CheckUserInGroups(UserID, groups))
                    {
                        if (Page.Request.QueryString.Count > 0 && Page.Request.QueryString["RID"] != null)
                        {
                            string ID  = GarasERP.Encrypt_Decrypt.Decrypt(Page.Request.QueryString["RID"].ToString(), key);
                            long   RID = 0;
                            if (long.TryParse(ID, out RID) && RID > 0)
                            {
                                V_DailyReport report = new V_DailyReport();


                                report.Where.BranchID.Value = Common.GetUserBranchID(UserID);
                                report.Where.ID.Value       = RID;
                                report.Where.Status.Value   = "Pending Verification";

                                if (report.Query.Load())
                                {
                                    if (report.DefaultView != null && report.DefaultView.Count > 0)
                                    {
                                        DIV_Content.Visible = true;
                                        LBL_MSG.Visible     = false;

                                        LBL_TitleDate.Text = " " + report.ReprotDate.ToString("dd/MM/yyyy");

                                        LoadReportLines(RID);
                                    }
                                    else
                                    {
                                        LBL_MSG.Visible = true;
                                        LBL_MSG.Text    = "Please Select Correct Report For review";
                                    }
                                }
                                else
                                {
                                    LBL_MSG.Visible = true;
                                    LBL_MSG.Text    = "the report was already reviewed before.";
                                }
                            }
                            else
                            {
                                LBL_MSG.Visible = true;
                                LBL_MSG.Text    = "Please Select Correct Report For review";
                            }
                        }
                        else
                        {
                            LBL_MSG.Visible = true;
                            LBL_MSG.Text    = "Please Select Correct Report For review";
                        }
                    }
                    else
                    {
                        LBL_MSG.Visible = true;
                        LBL_MSG.Text    = "Please Select Correct Report For review";
                    }
                }
                else
                {
                    if (ViewState["ReportDT"] != null)
                    {
                        ReportDT = (DataTable)ViewState["ReportDT"];
                    }
                }
            }
            catch (Exception ex)
            {
                LBL_MSG.Visible = true;
                LBL_MSG.Text    = "Page_Load: " + ex.Message;
            }
        }
예제 #2
0
        private void LoadReportData()
        {
            try
            {
                bool ViewAll = Common.CheckUserInRole(UserID, 4); // view all daily reports
                ReportDT = InitializeReportGridViewDataTable();
                V_DailyReport report = new V_DailyReport();
                if (!ViewAll)
                {
                    report.Where.UserID.Value = UserID;
                }
                else
                {
                    report.Where.BranchID.Value = Common.GetUserBranchID(UserID);
                    //report.Where.Status.Value = "Not Filled";
                    //report.Where.Status.Operator = MyGeneration.dOOdads.WhereParameter.Operand.NotEqual;
                }
                report.Query.AddOrderBy(V_DailyReport.ColumnNames.ReprotDate, MyGeneration.dOOdads.WhereParameter.Dir.DESC);
                if (report.Query.Load())
                {
                    do
                    {
                        DataRow dr = ReportDT.NewRow();
                        dr["ID"]           = report.ID;
                        dr["ReportDate"]   = report.ReprotDate.ToString("dd/MM/yyyy");
                        dr["UserName"]     = report.FirstName + " " + report.LastName;
                        dr["ModifiedDate"] = report.ModifiedDate.ToString("dd/MM/yyyy");
                        dr["Status"]       = report.Status;
                        dr["ViewURL"]      = "ViewReport.aspx?RID=" + Server.UrlEncode(Encrypt_Decrypt.Encrypt(report.s_ID, key));
                        dr["Review"]       = report.s_Review;
                        dr["Reviewed"]     = report.Reviewed;
                        if (UserID == report.UserID && report.Status == "Not Filled")
                        {
                            dr["CanEdit"] = true;
                            dr["URL"]     = "EditReport.aspx?RID=" + Server.UrlEncode(Encrypt_Decrypt.Encrypt(report.s_ID, key));
                        }
                        else
                        {
                            dr["CanEdit"] = false;
                            dr["URL"]     = "#";
                        }
                        List <string> groups = new List <string>();
                        groups.Add("SalesManagers");
                        if (Common.CheckUserInGroups(UserID, groups) && report.Status == "Pending Verification")
                        {
                            dr["CanVer"] = true;
                            dr["URL"]    = "VarifyReport.aspx?RID=" + Server.UrlEncode(Encrypt_Decrypt.Encrypt(report.s_ID, key));
                        }
                        else
                        {
                            dr["CanVer"] = false;
                            //   dr["URL"] = "#";
                        }

                        if (UserID == report.UserID || (report.Status != "Not Filled"))
                        {
                            ReportDT.Rows.Add(dr);
                        }
                    }while (report.MoveNext());
                }
                GV_Reports.DataSource = ReportDT;
                GV_Reports.DataBind();
                ViewState["ReportDT"] = ReportDT;
            }
            catch (Exception ex)
            {
                Page.Response.Write(ex.Message);
            }
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    bool canViewAllReports = Common.CheckUserInRole(UserID, 4);
                    if (Page.Request.QueryString.Count > 0 && Page.Request.QueryString["RID"] != null)
                    {
                        string ID  = GarasERP.Encrypt_Decrypt.Decrypt(Page.Request.QueryString["RID"].ToString(), key);
                        long   RID = 0;
                        if (long.TryParse(ID, out RID) && RID > 0)
                        {
                            V_DailyReport report = new V_DailyReport();
                            bool          load   = false;
                            if (canViewAllReports)
                            {
                                report.Where.ID.Value       = RID;
                                report.Where.BranchID.Value = Common.GetUserBranchID(UserID);
                                load = report.Query.Load();
                            }
                            else
                            {
                                report.Where.ID.Value     = RID;
                                report.Where.UserID.Value = UserID;

                                load = report.Query.Load();
                            }


                            if (load)
                            {
                                if (report.DefaultView != null && report.DefaultView.Count > 0)
                                {
                                    DIV_Content.Visible = true;
                                    LBL_MSG.Visible     = false;

                                    LBL_TitleDate.Text = " " + report.ReprotDate.ToString("dd/MM/yyyy");

                                    LBL_Review.Text = report.s_Review;
                                    TXT_Desc.Text   = report.ReviewComment;
                                    LoadReportLines(RID);
                                }
                                else
                                {
                                    LBL_MSG.Visible = true;
                                    LBL_MSG.Text    = "Please Select Correct Report For edit";
                                }
                            }
                            else
                            {
                                LBL_MSG.Visible = true;
                                LBL_MSG.Text    = "Please Select Correct Report For edit";
                            }
                        }
                        else
                        {
                            LBL_MSG.Visible = true;
                            LBL_MSG.Text    = "Please Select Correct Report For edit";
                        }
                    }
                    else
                    {
                        LBL_MSG.Visible = true;
                        LBL_MSG.Text    = "Please Select Correct Report For edit";
                    }
                }
                else
                {
                    if (ViewState["ReportDT"] != null)
                    {
                        ReportDT = (DataTable)ViewState["ReportDT"];
                    }
                }
            }
            catch (Exception ex)
            {
                LBL_MSG.Visible = true;
                LBL_MSG.Text    = "Page_Load: " + ex.Message;
            }
        }