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; }
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(); }