예제 #1
0
        public JsonResult GETTREATMENT(string roomno, string dated)
        {
            DateTime scheduledate = DateTime.ParseExact(dated, "dd/MM/yyyy", CultureInfo.InvariantCulture);

            if (roomno == "null")
            {
                var TREATMENTS = (from TP in pema.TreatmentAvaileds
                                  join TRM in pema.TreatmentRoomMasters on TP.RoomID equals TRM.ID
                                  where TP.ScheduleDate == scheduledate && TP.StartTime <= EntityFunctions.CreateTime(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second) && TP.EndTime >= EntityFunctions.CreateTime(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second)
                                  select new { RoomNo = TRM.RoomName }).ToList();
                return(Json(TREATMENTS, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var TREATMENTS = (from TP in pema.TreatmentAvaileds
                                  join TRM in pema.TreatmentRoomMasters on TP.RoomID equals TRM.ID
                                  join TM in pema.Treatment_Master on TP.TreatmentID equals TM.TreatmentID
                                  join RS in pema.NC_TBL_ROOM_Status on TP.PRNO equals RS.PRNO
                                  join HD in pema.HealerDetails on TP.HealerID equals HD.EMPNO
                                  where TP.ScheduleDate == scheduledate &&
                                  TP.StartTime <= EntityFunctions.CreateTime(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second) && TP.EndTime >= EntityFunctions.CreateTime(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second) &&
                                  TRM.RoomName == roomno

                                  select new
                {
                    RoomNo = TRM.RoomName,
                    GuestName = RS.Guest_Name,
                    TreatmentName = TM.TreatName,
                    HealerName = HD.EMPNAME
                }).ToList();
                return(Json(TREATMENTS, JsonRequestBehavior.AllowGet));
            }
        }
예제 #2
0
        public ActionResult Gervacantcount()
        {
            var list = (from TA in pema.TreatmentAvaileds
                        join TRM in pema.TreatmentRoomMasters on TA.RoomID equals TRM.ID
                        where TA.ScheduleDate == DateTime.Today && TA.StartTime <= EntityFunctions.CreateTime(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second) && TA.EndTime >= EntityFunctions.CreateTime(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second)
                        select new { TA, TRM }).Count();

            return(View(list));
        }
예제 #3
0
        public void getOutcoems(DateTime fromDate, DateTime toDate, GridControl y)
        {
            var outcome = from x in db.Outcomes
                          let z = EntityFunctions.CreateTime(x.Date.Value.Hour, x.Date.Value.Minute, x.Date.Value.Second)
                                  where EntityFunctions.TruncateTime(x.Date) >= fromDate && EntityFunctions.TruncateTime(x.Date) <= toDate
                                  select new { المستخدم = x.userName, الوقت = z, حساب_المصروف = x.Category.CategoryName, الوصف = x.Desc, رقم_الإيصال = x.RecieptID, المبلغ = x.Price };

            y.DataSource = outcome.ToList();
        }
예제 #4
0
        public void getIncomes(DateTime fromDate, DateTime toDate, GridControl y)
        {
            var income = from x in db.CashIns
                         let z = EntityFunctions.CreateTime(x.Date.Hour, x.Date.Minute, x.Date.Second)
                                 where ((EntityFunctions.TruncateTime(x.Date)) >= fromDate && (EntityFunctions.TruncateTime(x.Date)) <= toDate && x.Category.CategoryName != "إشتراكات" && x.Category.CategoryName != "جلسات" && x.Category.Type == "income") || x.Desc == "غلق اليوم"
                                 select new { المستخدم = x.userName, الوقت = z, القسم = x.Category.CategoryName, الصنف = x.Desc, رقم_الإيصال = x.RecieptID, المبلغ = x.Price, الدفع = x.Type };

            y.DataSource = income.ToList();
        }
예제 #5
0
        public void getJoining(DateTime fromDate, DateTime toDate, GridControl y)
        {
            var joins = from x in db.CashIns
                        let z = EntityFunctions.CreateTime(x.Date.Hour, x.Date.Minute, x.Date.Second)
                                where ((EntityFunctions.TruncateTime(x.Date)) >= fromDate && (EntityFunctions.TruncateTime(x.Date)) <= toDate) && (x.Category.CategoryName == "إشتراكات" || x.Category.CategoryName == "جلسات")
                                select new { المستخدم = x.userName, الوقت = z, العملية = x.Desc, المشترك = x.TraineeName, الإشتراك = x.OfferName, الإيصال = x.RecieptID, دفع = x.Price, طريقة_الدفع = x.Type };

            y.DataSource = joins.ToList();
        }
예제 #6
0
        public void getLoginLog(DateTime fromDate, DateTime toDate, GridControl y)
        {
            var logs = from x in db.Logins
                       let z = EntityFunctions.CreateTime(x.date.Hour, x.date.Minute, x.date.Second)
                               where ((EntityFunctions.TruncateTime(x.date)) >= fromDate && (EntityFunctions.TruncateTime(x.date)) <= toDate)
                               select new { المستخدم = x.userName, الوقت = z, العملية = x.action };

            y.DataSource = logs.ToList();
        }
예제 #7
0
        protected internal Room GetAlternateRoom(TimeSpan startTime, TimeSpan endTime, int numberOfAttendees, int locationId, bool orderAsc)
        {
            Location location       = _locationRepository.GetLocationById(locationId);
            var      availableRooms = _roomRepository.GetByLocationAndSeatCount(location, numberOfAttendees)
                                      .Where(x => x.Bookings.Where(b => startTime <EntityFunctions.CreateTime(b.EndDate.Hour, b.EndDate.Minute, b.EndDate.Second) && endTime> EntityFunctions.CreateTime(b.StartDate.Hour, b.StartDate.Minute, b.StartDate.Second)).Count() == 0);


            availableRooms = (orderAsc) ? availableRooms.OrderBy(r => r.SeatCount) : availableRooms.OrderByDescending(r => r.SeatCount);

            return(availableRooms.FirstOrDefault());
        }
예제 #8
0
        /// <summary>
        /// Finds meetings that clash with a certain time on specific dates.
        /// </summary>
        /// <param name="room">Room to check for meetings in. Provided as this allows us to specify the room, rather than riskly grabbing the room of a random booking</param>
        /// <param name="startTime">Time for which the meetings will begin</param>
        /// <param name="endTime">Time for which the meetings will end</param>
        /// <param name="dates">Dates for to check for meeting clashes</param>
        /// <param name="clashedBookings">OUT bookings which clash with the given parameters</param>
        /// <returns>Boolean based on whether there were any clashes</returns>
        bool DoMeetingsClashRecurringly(Room room, TimeSpan startTime, TimeSpan endTime, DateTime date, out IEnumerable <Booking> clashedBookings)
        {
            ////Get dates only as we are checking against only the date portion in the DB
            //var datesOnly = dates.Select(x => x.Date);

            var totalBookingsClashed = _bookingRepository.GetByDateOnlyAndRoom(date, room)
                                       //Only bookings on the days that intersect our given time period
                                       .Where(z => startTime <= EntityFunctions.CreateTime(z.StartDate.Hour, z.StartDate.Minute, z.StartDate.Second) && endTime > EntityFunctions.CreateTime(z.StartDate.Hour, z.StartDate.Minute, z.StartDate.Second) ||
                                              startTime >= EntityFunctions.CreateTime(z.StartDate.Hour, z.StartDate.Minute, z.StartDate.Second) && startTime < EntityFunctions.CreateTime(z.EndDate.Hour, z.EndDate.Minute, z.EndDate.Second))
                                       .ToList();   // bug fix

            clashedBookings = totalBookingsClashed; // WORKING
            return(totalBookingsClashed.Count > 0);
        }
예제 #9
0
        public void CreateTime()
        {
#if !EFOLD
            var q = this.Entities
                    .Select(x =>
                            DbFunctions.CreateTime(x.Time.Hours - 1, 2, 1));
#else
            var q = this.Entities
                    .Select(x =>
                            EntityFunctions.CreateTime(x.Time.Hours - 1, 2, 1));
#endif

            var q2 = q.AsEnumerable().Where(x => x.Value.Hours == 2);

            q2.Should().NotBeEmpty();
        }
예제 #10
0
        /// <summary>
        /// Finds meetings that clash with a certain time on specific dates.
        /// </summary>
        /// <param name="room">Room to check for meetings in. Provided as this allows us to specify the room, rather than riskly grabbing the room of a random booking</param>
        /// <param name="startTime">Time for which the meetings will begin</param>
        /// <param name="endTime">Time for which the meetings will end</param>
        /// <param name="dates">Dates for to check for meeting clashes</param>
        /// <param name="clashedBookings">OUT bookings which clash with the given parameters</param>
        /// <returns>Boolean based on whether there were any clashes</returns>
        bool DoMeetingsClashRecurringly(Room room, TimeSpan startTime, TimeSpan endTime, DateTime date, out IEnumerable <Booking> clashedBookings)
        {
            ////Get dates only as we are checking against only the date portion in the DB
            //var datesOnly = dates.Select(x => x.Date);

            var totalBookingsClashed = _bookingRepository.GetByDateOnlyAndRoom(date, room)
                                       //Only bookings on the days that intersect our given time period
                                       .Where(z => startTime <= EntityFunctions.CreateTime(z.StartDate.Hour, z.StartDate.Minute, z.StartDate.Second) && endTime > EntityFunctions.CreateTime(z.StartDate.Hour, z.StartDate.Minute, z.StartDate.Second) ||
                                              startTime >= EntityFunctions.CreateTime(z.StartDate.Hour, z.StartDate.Minute, z.StartDate.Second) && startTime < EntityFunctions.CreateTime(z.EndDate.Hour, z.EndDate.Minute, z.EndDate.Second))
                                       .ToList();

            clashedBookings = totalBookingsClashed;
            bool result = totalBookingsClashed.Count > 0;

            _logger.Trace(LoggerHelper.ExecutedFunctionMessage(result, room, startTime, endTime, date, clashedBookings));

            return(result);
        }
예제 #11
0
 public ActionResult GetTreatment(string roomno)
 {
     if (roomno == "null")
     {
         var x = (from TP in db.TreatmentPlans
                  join TPD in db.TreatmentPlanDetails on TP.PlanDetailID equals TPD.TPNumber
                  where TP.ScheduleDate == DateTime.Today && TP.StartTime <= EntityFunctions.CreateTime(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second) && TP.EndTime >= EntityFunctions.CreateTime(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second)
                  select new { TP, TPD }).ToList();
         var y         = (from PD in pema.NC_TBL_PERSONAL_DETAILS select new { PD }).ToList();
         var roomslist = (from a in x
                          join b in y on a.TP.PRNO equals b.PD.PRNO
                          select new
         {
             RoomNo = a.TPD.RoomNo
         }).ToList();
         return(Json(roomslist, JsonRequestBehavior.AllowGet));
     }
     else
     {
         var x = (from TP in db.TreatmentPlans
                  join TPD in db.TreatmentPlanDetails on TP.PlanDetailID equals TPD.TPNumber
                  where TP.ScheduleDate == DateTime.Today && TP.StartTime <= EntityFunctions.CreateTime(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second) && TP.EndTime >= EntityFunctions.CreateTime(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second)
                  select new { TP, TPD }).ToList();
         var y         = (from PD in pema.NC_TBL_PERSONAL_DETAILS select new { PD }).ToList();
         var roomslist = (from a in x
                          join b in y on a.TP.PRNO equals b.PD.PRNO
                          where a.TPD.RoomNo == roomno
                          select new
         {
             RoomNo = a.TPD.RoomNo,
             GuestName = b.PD.FirstName + " " + b.PD.LastName,
             TreatmentName = a.TPD.TreatmentName,
             HealerName = a.TPD.HealerName
         }).ToList();
         return(Json(roomslist, JsonRequestBehavior.AllowGet));
     }
     //var roomnolist = (from TP in db.TreatmentPlans
     //                  join TPD in db.TreatmentPlanDetails on TP.PlanDetailID equals TPD.TPNumber
     //                  join PD in pema.NC_TBL_PERSONAL_DETAILS on TP.PRNO equals PD.PRNO
     //                  where TP.ScheduleDate == DateTime.Today && TP.StartTime >= DateTime.Now.TimeOfDay && TP.EndTime <= DateTime.Now.TimeOfDay select new
     //                  {
     //                      RoomNo = TPD.RoomNo
     //                  }).ToList();
 }
예제 #12
0
        public void fill()
        {
            gridControl1.DataSource = null;
            if (type == "المشتركين")
            {
                labels(true);
                var d = from x in db.TraineesDailies
                        let DateComing = EntityFunctions.CreateTime(x.Date.Hour, x.Date.Minute, x.Date.Second)
                                         where EntityFunctions.TruncateTime(x.Date) == dt
                                         select new { المشترك = x.Trainee.TraineeName, الإشتراك = x.TraineeProfile.Offer.OfferName, المحمول = x.Trainee.Phone, الوقت = DateComing, النوع = x.Trainee.Gender, };

                var m = from x in db.TraineesDailies
                        let DateComing = EntityFunctions.CreateTime(x.Date.Hour, x.Date.Minute, x.Date.Second)
                                         where x.Date > dt && x.Trainee.Gender == "ذكر"
                                         select new { المشترك = x.Trainee.TraineeName, الإشتراك = x.TraineeProfile.Offer.OfferName, المحمول = x.Trainee.Phone, الوقت = DateComing, النوع = x.Trainee.Gender };

                var w = from x in db.TraineesDailies
                        let DateComing = EntityFunctions.CreateTime(x.Date.Hour, x.Date.Minute, x.Date.Second)
                                         where x.Date > dt && x.Trainee.Gender == "أنثي"
                                         select new { المشترك = x.Trainee.TraineeName, الإشتراك = x.TraineeProfile.Offer.OfferName, المحمول = x.Trainee.Phone, الوقت = DateComing, النوع = x.Trainee.Gender };

                gridView1.PopulateColumns();
                gridControl1.DataSource = d.ToList();
                txtTotal.Text           = (m.ToList().Count + w.ToList().Count).ToString();
                txtMen.Text             = m.ToList().Count.ToString();
                txtWomen.Text           = w.ToList().Count.ToString();
            }
            if (type == "الموظفين")
            {
                labels(false);
                var emp = from x in db.EmployeesDailies

                          let DateComing = EntityFunctions.CreateTime(x.DateComing.Hour, x.DateComing.Minute, x.DateComing.Second)
                                           let DateLeaving = EntityFunctions.CreateTime(x.DateLeaving.Value.Hour, x.DateLeaving.Value.Minute, x.DateLeaving.Value.Second)

                                                             where x.DateComing > dt
                                                             select new { الموظف = x.Employee.EmployeeName, حضور = DateComing, إنصراف = DateLeaving, المحمول = x.Employee.Phone, الوظيفة = x.Employee.Job.JobName };
                gridView1.PopulateColumns();
                gridControl1.DataSource = emp.ToList();
            }
        }
예제 #13
0
 public ActionResult GetTreatment(string roomno)
 {
     if (roomno == "null")
     {
         var x = (from TA in pema.TreatmentAvaileds
                  join TRM in pema.TreatmentRoomMasters on TA.RoomID equals TRM.ID
                  where TA.ScheduleDate == DateTime.Today && TA.StartTime <= EntityFunctions.CreateTime(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second) && TA.EndTime >= EntityFunctions.CreateTime(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second)
                  select new { TA, TRM }).ToList();
         var y         = (from RS in pema.NC_TBL_ROOM_Status select new { RS }).ToList();
         var roomslist = (from a in x
                          join b in y on a.TA.PRNO equals b.RS.PRNO
                          select new
         {
             RoomNo = a.TRM.RoomName
         }).ToList();
         return(Json(roomslist, JsonRequestBehavior.AllowGet));
     }
     else
     {
         var x = (from TA in pema.TreatmentAvaileds
                  join TRM in pema.TreatmentRoomMasters on TA.RoomID equals TRM.ID
                  join TM in pema.Treatment_Master on TA.TreatmentID equals TM.TreatmentID
                  join HD in pema.HealerDetails on TA.HealerID equals HD.EMPNO
                  where TA.ScheduleDate == DateTime.Today && TA.StartTime <= EntityFunctions.CreateTime(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second) && TA.EndTime >= EntityFunctions.CreateTime(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second)
                  select new { TA, TRM, TM, HD }).ToList();
         var y         = (from RS in pema.NC_TBL_ROOM_Status select new { RS }).ToList();
         var roomslist = (from a in x
                          join b in y on a.TA.PRNO equals b.RS.PRNO
                          where a.TRM.RoomName == roomno
                          select new
         {
             RoomNo = a.TRM.RoomName,
             GuestName = b.RS.Guest_Name,
             TreatmentName = a.TM.TreatName,
             HealerName = a.HD.EMPNAME
         }).ToList();
         return(Json(roomslist, JsonRequestBehavior.AllowGet));
     }
 }