示例#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 LoadCash()
        {
            if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable())
            {
                try
                {
                    y  = DateTime.Now.ToPersianDateString();
                    db = new PoonehEntities1();

                    tempSchedules = db.Schedules.Where(p => p.SDate.CompareTo(y) == 1).Distinct().ToList();
                    var AllDays = tempSchedules.Select(p => new Date {
                        date = p.SDate
                    }).Distinct();


                    var ew = tempSchedules.Where(p => AllDays.Any(pe => pe.date == p.SDate)).Select(p => p.Tray_Id_Fk).Distinct().ToList();
                    TempTrays = db.Trays.Where(p => ew.Any(ll => ll == p.Id)).Select(s => s).ToList();
                }
                catch (Exception)
                {
                    MessageBox.Show("مشکل در لود");
                }
            }
        }
示例#3
0
 private void KeyPad_Load(object sender, EventArgs e)
 {
     db = new PoonehEntities1();
 }
示例#4
0
        public List <Date> GetList()
        {
            db = new PoonehEntities1();
            List <Date> q;

            dtnow = DateTime.Now.ToPersianDateString().AddDaysToShamsiDate(1);
            //string dtnow = DateTime.Now.ToPersianDateString();
            _resturentid = db.Person_Restaurant.FirstOrDefault(p => p.Person_Id_Fk == _person.Id).Restaurant_Id_Fk.Value;

            q = (from p in db.Schedules
                 where p.Restaurant_Id_Fk == _resturentid
                 where p.SDate.CompareTo(dtnow) == 1
                 select new Date {
                date = p.SDate
            }
                 ).Distinct().OrderBy(o => o.date).ToList();


            List <Date> w = q.ToList();

            if (_worksheet == (int)Shift.Rozkar)
            {
                List <Date> qq = (from pp in db.HoliDays
                                  where pp.HolidayDate.CompareTo(dtnow) == 1
                                  select new Date {
                    date = pp.HolidayDate, meal = 1
                }).Distinct().ToList();

                for (int i = 0; i < qq.Count; i++)
                {
                    var ee = q.Where(p => p.date == qq.ElementAt(i).date).FirstOrDefault();
                    q.Remove(ee);
                }

                foreach (var item in q)
                {
                    item.day  = item.date.ToPersianday();
                    item.meal = 1;
                }

                return(ExtraMealAdded(w, q));
            }

            else if (_worksheet == (int)Shift.A8)
            {
                return(ExtraMealAdded(w, ShiftFilter8(q, 0)));
            }

            else if (_worksheet == (int)Shift.B8)
            {
                return(ExtraMealAdded(w, ShiftFilter8(q, 4)));
            }

            else if (_worksheet == (int)Shift.C8)
            {
                return(ExtraMealAdded(w, ShiftFilter8(q, 8)));
            }

            else if (_worksheet == (int)Shift.D8)
            {
                return(ExtraMealAdded(w, ShiftFilter8(q, 12)));
            }

            else if (_worksheet == (int)Shift.A12)
            {
                return(ExtraMealAdded(w, ShiftFilter12(q, 8)));
            }

            else if (_worksheet == (int)Shift.B12)
            {
                return(ExtraMealAdded(w, ShiftFilter12(q, 4)));
            }

            else if (_worksheet == (int)Shift.C12)
            {
                return(ExtraMealAdded(w, ShiftFilter12(q, 0)));
            }
            else
            {
                List <Date> qq = (from pp in db.HoliDays
                                  where pp.HolidayDate.CompareTo(dtnow) == 1
                                  select new Date {
                    date = pp.HolidayDate, meal = 1
                }).Distinct().ToList();

                for (int i = 0; i < qq.Count; i++)
                {
                    var ee = q.Where(p => p.date == qq.ElementAt(i).date).FirstOrDefault();
                    q.Remove(ee);
                }

                foreach (var item in q)
                {
                    item.day  = item.date.ToPersianday();
                    item.meal = 1;
                }
                return(ExtraMealAdded(w, q));
            }
        }