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 static void Create_Seats(Park_Database.Service.Park_Seats_Service db)
        {
            Park_Database.Model.Park_Seats PS = new Park_Database.Model.Park_Seats();


            PS.Seats_Area = "B";
            for (int i = 1; i < 11; i++)
            {
                PS.Seats_Num = PS.Seats_Area + i.ToString("00");
                db.Create(PS);
            }


            Console.WriteLine("區域位置資料創建完成");
        }
Ejemplo n.º 3
0
        public static void Show_Seats(Park_Database.Service.Park_Seats_Service db)
        {
            List <Park_Database.Model.Park_Seats> PS = new List <Park_Database.Model.Park_Seats>();

            PS = db.LoadAll();
            int count = 1;

            Console.WriteLine("共有" + PS.Count + "筆區域位置資料");
            PS.ForEach(x =>
            {
                Console.WriteLine("\t第" + (count++) + "筆資料");
                Console.WriteLine("\t區域座號:" + x.Seats_Num);
                Console.WriteLine("\t所在區域:" + x.Seats_Area);
                Console.WriteLine();
            });
        }
Ejemplo n.º 4
0
        public static void Main(string[] args)
        {
            List <Park_Database.Model.Park_User> PU = new List <Park_Database.Model.Park_User>();
            var dbu = new Park_Database.Service.Park_User_Service();
            var dba = new Park_Database.Service.Park_Area_Service();
            var dbs = new Park_Database.Service.Park_Seats_Service();
            var dbt = new Park_Database.Service.Park_Time_Service();
            var dbr = new Park_Database.Service.Park_Root_Service();

            // Create_User(dbu);
            //Show_User(dbu);
            //Create_Area(dba);
            //Show_Area(dba);
            //Create_Seats(dbs);
            //Show_Seats(dbs);
            // Create_Time(dbt);
            //Show_Time(dbt);
            Create_Root(dbr);
            Show_Root(dbr);
            Console.ReadKey();
        }