예제 #1
0
        // Willis
        public ActionResult FormRetrieve()
        {
            // Assume ClerkID
            int IdStoreClerk = (int)Session["IdEmployee"];

            // Get Department that seleceted same collection point as store clerk
            List <string> DClerk = _disbursementDAO.ReturnStoreClerkCP(IdStoreClerk);

            DateTime Today   = DateTime.Now;
            DateTime LastThu = Today.AddDays(-1);

            while (LastThu.DayOfWeek != DayOfWeek.Thursday)
            {
                LastThu = LastThu.AddDays(-1);
            }

            // If Disbursement contain status "preparing" from last thurseday to today
            if (_disbursementDAO.CheckExistDisbursement(DClerk, Today, LastThu))
            {
                // Search Disbursement with status set as "preparing"
                List <Retrieval> RetrievalForm = _disbursementDAO.RetrievePreparingItem(DClerk, Today, LastThu);
                ViewData["RetrievalForm"]    = RetrievalForm;
                ViewData["NoDisbursement"]   = false;
                ViewData["NoNewRequisition"] = false;
                ViewBag.Today   = Today.ToString("dd-MM-yyyy");
                ViewBag.LastThu = LastThu.ToString("dd-MM-yyyy");
            }
            // If Disbursement contain no status "preparing" from last thursday to today
            else
            {
                ViewData["NoDisbursement"]   = true;
                ViewData["NoNewRequisition"] = false;
                ViewBag.Today   = Today.ToString("dd-MM-yyyy");
                ViewBag.LastThu = LastThu.ToString("dd-MM-yyyy");
            }
            List <int> CPs = _collectionpointDAO.FindByClerkId(IdStoreClerk);

            ViewData["CPs"] = CPs;
            return(View());
        }