示例#1
0
        public NeedToReserve(Person person)
        {
            PoonehEntities1 db = new PoonehEntities1();

            Person = person;
            date   = "";
            ListDate ty = new ListDate(person);

            AllDays = ty.GetList();

            // string y = AllDays.ElementAt(0).date.AddDaysToShamsiDate(-1);
            tempSchedules = Login.tempSchedules;

            // var ew = tempSchedules.Where(p => AllDays.Any(pe => pe.date == p.SDate)).Select(p => p.Tray_Id_Fk).Distinct().ToList();
            TempTrays = Login.TempTrays;
        }
示例#2
0
        private void ReserveFoodQuickly_Load(object sender, EventArgs e)
        {
            db = new PoonehEntities1();

            //p1 = db.People.Where(pp => pp.NationalCode == "0440005191").FirstOrDefault(); //rozkar


            //p1 = db.People.Where(p => p.PersonelNo == "545642").FirstOrDefault();//c
            //p1 = db.People.Where(p => p.NationalCode == "1828039179").FirstOrDefault();  //b
            //p1 = db.People.Where(p => p.PersonelNo == "565807").FirstOrDefault();   //d
            //p1 = db.People.Where(p => p.PersonelNo == "568161").FirstOrDefault();   //a

            lbName.Text   = "   نام و نام خانوادگی: " + p1.Name + "  " + p1.LastName;
            restaurant_id = db.Person_Restaurant.FirstOrDefault(p => p.Person_Id_Fk == p1.Id).Restaurant_Id_Fk.Value;
            Schedules     = new List <Schedule>();
            Trays         = new List <Tray>();
            ListDate     ty    = new ListDate(p1);
            List <Label> label = new List <Label>()
            {
                label1, label2, label3, label4, panelLabel5
            };
            List <Panel> panels = new List <Panel>()
            {
                panelLabel1, panelLabel2, panelLabel3, panelLabel4, panel10
            };

            var uu       = ty.GetList().OrderBy(p => p.date).ToList();
            int countRow = 0;

            if (uu.Count() > 4)
            {
                meals    = ty.GetList().OrderBy(p => p.date).Take(5).ToList();
                countRow = 5;
            }

            else
            {
                meals    = ty.GetList().OrderBy(p => p.date).Take(uu.Count()).ToList();
                countRow = uu.Count();
            }



            SetPicture();
            string y             = meals.ElementAt(0).date.AddDaysToShamsiDate(-1);
            var    tempSchedules = Login.tempSchedules;

            var TempTrays = Login.TempTrays;

            int j = 0;

            for (int i = 0; i < countRow; i++)
            {
                if (meals.ElementAt(i).meal == 2)
                {
                    label.ElementAt(i).Text       = meals.ElementAt(i).date + "\n" + meals.ElementAt(i).day + "\n" + "((شام))";
                    panels.ElementAt(i).BackColor = Color.Blue;
                }

                else
                {
                    label.ElementAt(i).Text       = meals.ElementAt(i).date + "\n" + meals.ElementAt(i).day;
                    panels.ElementAt(i).BackColor = Color.Transparent;
                }

                PerSchedules = (from p in tempSchedules
                                where p.SDate.Equals(meals.ElementAt(i).date) & p.Restaurant_Id_Fk == restaurant_id
                                & p.Meal_Id_Fk == meals.ElementAt(i).meal
                                select p).ToList();

                Schedules.Add(PerSchedules.ElementAt(0));
                Schedules.Add(PerSchedules.ElementAt(1));
                Schedules.Add(PerSchedules.ElementAt(2));


                int t   = (int)PerSchedules.ElementAt(0).Tray_Id_Fk;
                int tt  = (int)PerSchedules.ElementAt(1).Tray_Id_Fk;
                int ttt = (int)PerSchedules.ElementAt(2).Tray_Id_Fk;
                PerTrays = (from qqq in TempTrays
                            where qqq.Id == t || qqq.Id == tt || qqq.Id == ttt
                            select qqq).ToList();


                Trays.Add(PerTrays.ElementAt(0));
                Trays.Add(PerTrays.ElementAt(1));
                Trays.Add(PerTrays.ElementAt(2));



                pic.ElementAt(j).Image = SetFood(PerTrays.ElementAt(0));


                pic.ElementAt(j + 1).Image = SetFood(PerTrays.ElementAt(1));



                pic.ElementAt(j + 2).Image = SetFood(PerTrays.ElementAt(2));

                j = j + 4;
            }

            ReservedFood();


            var dbb = db.Restaurants.ToList();

            lbResaturentName.Text = "رستوران مجاز  :" + "    " + dbb.FirstOrDefault(p => p.Id == restaurant_id).Name;


            tableLayoutPanel1.Visible = true;

            int x = 0;
        }