protected void btnRetrieve_Click(object sender, EventArgs e)
        {
            UserAccount user  = (UserAccount)Session["UserAccountObj"];
            int         rid   = user.UserId;
            int         year  = int.Parse(ddlYear.SelectedValue);
            int         month = int.Parse(ddlMonth.SelectedValue);

            StatsBLL sbll  = new StatsBLL();
            RiderBLL rbll  = new RiderBLL();
            Rider    rider = rbll.DoRetrieveRiderByID(rid);

            panelViewStats.Visible = true;

            if (rider.IsFullTime)
            {
                lblOrders.Text      = sbll.DoCountOrderForRiderMonth(rid, year, month).ToString();
                lblHours.Text       = sbll.DoCountHoursWorkedForFTRiderMonth(rid, year, month).ToString();
                lblDeliverTime.Text = sbll.DoCountRiderAverageDeliverTimeByMonth(rid, year, month).ToString("HH:mm:ss");

                if (lblOrders.Text.Equals("0"))
                {
                    lblDeliverTime.Text = "-";
                }

                lblReviewNum.Text = sbll.DoCountRatingsForRiderMonth(rid, year, month).ToString();
                lblRating.Text    = Math.Round(sbll.DoCountAverageRiderRatingMonth(rid, year, month), 2).ToString();
                lblSalary.Text    = sbll.DoCountFTRiderSalaryMonth(rid, year, month).ToString();
            }

            else
            {
                lblOrders.Text      = sbll.DoCountOrderForRiderMonth(rid, year, month).ToString();
                lblHours.Text       = sbll.DoCountHoursWorkedForPTRiderMonth(rid, year, month).ToString();
                lblDeliverTime.Text = sbll.DoCountRiderAverageDeliverTimeByMonth(rid, year, month).ToString("HH:mm:ss");

                if (lblOrders.Text.Equals("0"))
                {
                    lblDeliverTime.Text = "-";
                }

                lblReviewNum.Text = sbll.DoCountRatingsForRiderMonth(rid, year, month).ToString();
                lblRating.Text    = Math.Round(sbll.DoCountAverageRiderRatingMonth(rid, year, month), 2).ToString();
                lblSalary.Text    = sbll.DoCountPTRiderSalaryMonth(rid, year, month).ToString();
            }
        }
Beispiel #2
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();

            if (Session["generatedId"] == null)
            {
                OrderItemListBLL orderItemListBLL = new OrderItemListBLL();
                OrderItemList    orderItemList    = orderItemListBLL.DoRetrieveExisitngCustomerFoodItemListByCustId(user.UserId);

                if (orderItemList != null)
                {
                    Session["generatedId"] = orderItemList.TransactionId;
                }
            }

            StatsBLL statsBLL       = new StatsBLL();
            string   recentLocation = statsBLL.DoRetrieveRecentLocation(user.UserId);

            if (recentLocation == "")
            {
                lblRecentLocation.Text  = "You have no recent location";
                btnClearHistory.Enabled = false;
            }

            else
            {
                lblRecentLocation.Text = recentLocation;
            }

            int ordersMade = statsBLL.DoCountCustomersOrder(user.UserId);

            lblOrdersMade.Text = ordersMade.ToString();

            int reviewMade = statsBLL.DoCountCustomersReviews(user.UserId);

            lblReviewsMade.Text = reviewMade.ToString();
        }
Beispiel #3
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();
        }
Beispiel #4
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;
                }
            }
        }