Пример #1
0
        public ReserveFood(NeedToReserve need)
        {
          
                _need = need;
                InitializeComponent();
                _person = need.Person;
                _date = need.date;
               // _dayName = need.date.ToPersianday();
                _restaurant_id = need.restaurent;
                _meal = need.meal;
                Schedules = need.Schedules;
                Trays = _need.Trays;
                AllSchedules = need.Schedules;
                AllTrays = need.Trays;
                AllDays = need.AllDays;
                db = new PoonehEntities1();
                tableLayoutPanel1.Visible = false;
                loop = false;
      

        }
Пример #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            db    = new  PoonehEntities1();
            dtnow = DateTime.Now.ToPersianDateString();


            //p1 = db.People.Where(p => p.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

            needs = new NeedToReserve(p1);


            restaurant_id = db.Person_Restaurant.FirstOrDefault(p => p.Person_Id_Fk == p1.Id).Restaurant_Id_Fk.Value;
            //restaurant_id = 26;
            lbName.Text = p1.Name + " " + p1.LastName;

            var y = Login.tempSchedules.Min(pp => pp.Id);

            Reserved = (from p in db.PoonehReservations
                        where p.Person_Id_Fk.Value == p1.Id & p.Schedule_Id_Fk > y
                        select p).ToList();



            SetPicturebox(needs.AllDays);
            tableLayoutPanel1.Visible = true;

            int x = 0;

            needs.restaurent = restaurant_id;
            var dbb = db.Restaurants;

            lbRestuarent.Text = "رستوران مجاز:  " + dbb.FirstOrDefault(p => p.Id == restaurant_id).Name;
            lbShift.Text      = GiveMeShiftName();
        }
Пример #3
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;
        }