public ActionResult MonthP(Park_Web.Models.Park_DateArea PMA)
        {
            Park_Database.Service.Park_Area_Service  da = new Park_Database.Service.Park_Area_Service();
            Park_Database.Service.Park_Seats_Service ds = new Park_Database.Service.Park_Seats_Service();
            Park_Database.Service.Park_Time_Service  dt = new Park_Database.Service.Park_Time_Service();

            List <Park_Database.Model.Park_Area>    PA  = new List <Park_Database.Model.Park_Area>();
            List <Park_Database.Model.Park_Seats>   PS  = new List <Park_Database.Model.Park_Seats>();
            List <Park_Database.Model.Park_Time>    PT  = new List <Park_Database.Model.Park_Time>();
            List <Park_Web.Models.Park_SeatsStatus> PWS = new List <Park_Web.Models.Park_SeatsStatus>();

            PA = da.LoadAll();
            PS = ds.LoadAll();
            PT = dt.LoadAll();


            PS.ForEach(x => {
                Park_Web.Models.Park_SeatsStatus item = new Park_Web.Models.Park_SeatsStatus();
                if (PA[int.Parse(PMA.Park_DateArea_Area)].Area_Name == x.Seats_Area)
                {
                    item.Park_SeatsStatus_Seat = x.Seats_Num;
                    PWS.Add(item);
                }
            });
            bool PTf = false;

            for (int i = 0; i < PWS.Count; i++)
            {
                PTf = false;
                for (int j = 0; j < PT.Count; j++)
                {
                    if (PWS[i].Park_SeatsStatus_Seat == PT[j].Time_Seat)
                    {
                        if (((DateTime.Parse(PT[j].Time_End) >= DateTime.Parse(PMA.Park_DateArea_Date))) && ((DateTime.Parse(PT[j].Time_Start) <= DateTime.Parse(PMA.Park_DateArea_Date))))
                        {
                            PWS[i].Park_SeatsStatus_Status = "1";
                            PTf = true;
                            break;
                        }
                    }
                }
                if (!PTf)
                {
                    PWS[i].Park_SeatsStatus_Status = "0";
                }
            }
            ViewBag.Date = PMA.Park_DateArea_Date;
            ViewBag.Area = PA[int.Parse(PMA.Park_DateArea_Area)].Area_Name;
            ViewBag.type = "1"; //0 日租型 1 月租型
            return(View(PWS));
        }
Ejemplo n.º 2
0
        public ActionResult Day(Park_Web.Models.Park_DateArea PD)
        {
            DateTime dt, now;

            if (PD.Park_DateArea_Date == null)
            {
                return(RedirectToAction("Day"));
            }

            dt  = DateTime.Parse(PD.Park_DateArea_Date);
            now = DateTime.Now;

            if (dt < now)
            {
                return(RedirectToAction("Day"));
            }

            return(RedirectToAction("DayP", "ParkingLot", PD));
        }
Ejemplo n.º 3
0
        public ActionResult Month(Park_Web.Models.Park_DateArea PM)
        {
            DateTime dt, now;

            if (PM.Park_DateArea_Date == null)
            {
                return(RedirectToAction("Month"));
            }

            dt = DateTime.Parse(PM.Park_DateArea_Date);

            now = DateTime.Now;

            if (dt < now)
            {
                return(RedirectToAction("Month"));
            }

            return(RedirectToAction("MonthP", "ParkingLot", PM));
        }
Ejemplo n.º 4
0
        public ActionResult Year(Park_Web.Models.Park_DateArea PY)
        {
            DateTime dt, now;

            if (PY.Park_DateArea_Date == null)
            {
                return(RedirectToAction("Year"));
            }

            dt = DateTime.Parse(PY.Park_DateArea_Date);

            now = DateTime.Now;

            if (dt < now)
            {
                return(RedirectToAction("Year"));
            }

            return(RedirectToAction("YearP", "ParkingLot", PY));
        }