Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["isLogin"] == null)
            {
                Response.Redirect("Login.aspx");
            }

            UserAccount user = (UserAccount)Session["UserAccountObj"];

            lblUserName.Text = user.Username.ToUpper();
            lblUserRole.Text = user.UserRole.ToUpper();

            ReviewBLL reviewBLL = new ReviewBLL();
            double    rating    = reviewBLL.DoRetrieveRiderAvgRating(user.UserId);

            if (rating == 0)
            {
                lblRating.Text = "NIL";
            }

            else
            {
                lblRating.Text = rating.ToString();
            }

            StatsBLL statsBLL         = new StatsBLL();
            int      totalAvailOrders = statsBLL.DoCountTotalAvailableOrders();

            lblTotalAvailOrders.Text = totalAvailOrders.ToString();

            int totalOrdersDone = statsBLL.DoCountOrdersDoneByRider(user.UserId);

            lblOrdersDone.Text = totalOrdersDone.ToString();

            int totalOrders = statsBLL.DoCountTotalOrders();

            lbltotalOrders.Text = totalOrders.ToString();

            double totalOrderAmt = statsBLL.DoCountTotalOrderAmount();

            lbltotalOrderAmt.Text = "$" + totalOrderAmt.ToString();
        }
Ejemplo n.º 2
0
        protected void btnViewStats_Click(object sender, EventArgs e)
        {
            UserAccount user = (UserAccount)Session["UserAccountObj"];

            if (user.UserRole.Equals("Manager"))
            {
                adminViewStats.Visible = true;

                StatsBLL statsBLL = new StatsBLL();
                int      custNum  = statsBLL.DoCountTotalCustomers();
                lblTotalCustomers.Text = custNum.ToString();

                int riderNum = statsBLL.DoCountTotalRiders();
                lblTotalRiders.Text = riderNum.ToString();

                int staffNum = statsBLL.DoCountTotalStaffs();
                lblTotalStaff.Text = staffNum.ToString();

                DataTable dt = new DataTable();
                dt = statsBLL.DoCountFoodItemsByCategory();
                if (dt != null)
                {
                    gv_FoodItemStats.DataSource = dt;
                    gv_FoodItemStats.DataBind();
                    gv_FoodItemStats.Visible = true;
                }

                int totalOrders = statsBLL.DoCountTotalOrders();
                lbltotalOrders.Text = totalOrders.ToString();

                double totalOrderAmt = statsBLL.DoCountTotalOrderAmount();
                lbltotalOrderAmt.Text = "$" + totalOrderAmt.ToString();

                DataTable dt2 = new DataTable();
                dt2 = statsBLL.DoFindCustomersMostOrders();
                if (dt2 != null)
                {
                    gv_CustMostOrder.DataSource = dt2;
                    gv_CustMostOrder.DataBind();
                    gv_CustMostOrder.Visible = true;
                }
            }

            else
            {
                StaffBLL staffBLL = new StaffBLL();
                Staff    staff    = staffBLL.DoRetrieveStaffByID(user.UserId);

                staffViewStats.Visible = true;

                StatsBLL statsBLL    = new StatsBLL();
                int      foodItemNum = statsBLL.DoCountTotalFoodItems(staff.RestId);
                lblFoodItemNum.Text = foodItemNum.ToString();

                int reviewNum = statsBLL.DoCountTotalReviews(staff.RestId);
                lblTotalReview.Text = reviewNum.ToString();

                DataTable dt = new DataTable();
                dt = statsBLL.DoFindPopularFoodItem(staff.RestId);
                if (dt != null)
                {
                    gv_popularFoodItems.DataSource = dt;
                    gv_popularFoodItems.DataBind();
                    gv_popularFoodItems.Visible = true;
                }
            }
        }