示例#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());
        }
示例#2
0
        public JsonResult FindCollectionPoint(int id, string location)
        {
            //scheduled and received

            List <int> idCPs       = _collectionPointDAO.FindByClerkId(id);
            var        departments = from d in _departmentDAO.FindDepartmentsByLocation(location)
                                     select new
            {
                deptName = d.Name,
                deptRep  = (_employeeDAO.FindDepartmentRep(d.CodeDepartment) == null)? "": _employeeDAO.FindDepartmentRep(d.CodeDepartment).Name,
                contact  = _employeeDAO.FindDepartmentRep(d.CodeDepartment) == null? "": _employeeDAO.FindDepartmentRep(d.CodeDepartment).Tel,
                disId    = (d.Disbursements.Where(x => x.IdStatus == 10 || x.IdStatus == 11).FirstOrDefault() == null)? null: (d.Disbursements.Where(x => x.IdStatus == 10 || x.IdStatus == 11).FirstOrDefault()
                                                                                                                               .IdDisbursement.ToString()),
                items = (d.Disbursements.Where(x => x.IdStatus == 10 || x.IdStatus == 11).FirstOrDefault() == null) ? null: (from i in d.Disbursements.Where(x => (x.IdStatus == 10 || x.IdStatus == 11) && idCPs.Contains(x.IdCollectionPt.GetValueOrDefault(0))).FirstOrDefault().DisbursementItems
                                                                                                                             select new { description = i.Item.Description, unit = i.UnitIssued })
            };

            return(Json(new { location, departments }, JsonRequestBehavior.AllowGet));
        }