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));
        }
Exemplo n.º 2
0
        public static void Create_Area(Park_Database.Service.Park_Area_Service db)
        {
            Park_Database.Model.Park_Area PA = new Park_Database.Model.Park_Area();

            var Name       = "D";
            var Num        = "5";
            var Createtime = DateTime.Now;

            PA.Area_Name       = Name;
            PA.Area_Num        = Num;
            PA.Area_Createtime = (Createtime);

            db.Create(PA);

            Console.WriteLine("區域資料創建完成");
        }
Exemplo n.º 3
0
        public static void Show_Area(Park_Database.Service.Park_Area_Service db)
        {
            List <Park_Database.Model.Park_Area> PA = new List <Park_Database.Model.Park_Area>();

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

            Console.WriteLine("共有" + PA.Count + "筆區域資料");
            PA.ForEach(x =>
            {
                Console.WriteLine("\t第" + (count++) + "筆資料");
                Console.WriteLine("\t區域名稱:" + x.Area_Name);
                Console.WriteLine("\t區域數量:" + x.Area_Num);
                Console.WriteLine("\t建立時間:" + x.Area_Createtime.ToString("yyyy-MM-dd HH:mm:ss"));
                Console.WriteLine();
            });
        }
Exemplo n.º 4
0
        public ActionResult Month()
        {
            Park_Database.Service.Park_Area_Service db = new Park_Database.Service.Park_Area_Service();
            var list = db.LoadAll();
            List <SelectListItem> items = new List <SelectListItem>();
            int i = 0;

            foreach (var item in list)
            {
                items.Add(new SelectListItem()
                {
                    Text  = item.Area_Name,
                    Value = (i++).ToString(),
                });
            }
            ViewBag.Map_area = items;
            return(View());
        }
Exemplo n.º 5
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();
        }