public async Task <IActionResult> GetCustomerAppointments([FromRoute] AppointmentQuery query)
        {
            try
            {
                CustomerAppointmentsDto patientBookings = await _dispatcher.QueryAsync <CustomerAppointmentsDto>(query);

                return(Ok(patientBookings));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
        public async Task <IActionResult> GetSpecialistAppointments([FromRoute] AppointmentQuery query)
        {
            try
            {
                SpecialistAppointmentsDto bookings = await _dispatcher.QueryAsync <SpecialistAppointmentsDto>(query);

                return(Ok(bookings));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Пример #3
0
        public AddAppointment()
        {
            InitializeComponent();
            ap            = new AppointmentQuery();
            m             = new CustomerManagement();
            this.Closing += delegate(object sender, CancelEventArgs args)
            {
                args.Cancel = true; Reset(); this.Hide();
            };
            cbEndTime.SelectedIndex   = 1;
            cbStartTime.SelectedIndex = 1;

            //cbStartTime.Hide();
            //cbEndTime.Hide();
        }
Пример #4
0
 public MainWindow()
 {
     InitializeComponent();
     q = new AppointmentQuery();
     addAppointment = new AddAppointment();
     addAppointment.AppointmentAdded += AddAppointmentOnAppointmentAdded;
     CheckForIllegalCrossThreadCalls  = false;
     customerManagement            = new CustomerManagement();
     addCustomer                   = new AddCustomer();
     addCustomer.NewCustomerAdded += AddCustomerOnNewCustomerAdded;
     LoadAllCustomers();
     LoadAllAppointments("*");
     addCustomer.CustomerUpdated       += AddCustomerOnCustomerUpdated;
     addAppointment.AppointmentUpdated += AddAppointmentOnAppointmentUpdated;
     this.Closing += OnClosing;
 }
        public async Task <List <AppointmentEntity> > Post([FromBody] AppointmentQuery appointment)
        {
            try
            {
                IAppointmentRepository <AppointmentEntity> Respository = new AppointmentRepository <AppointmentEntity>(config);
                if (appointment.queryParameter == "findbyuserid")
                {
                    var appointments = await Respository.GetItemsAsync(d => d.userId == appointment.userId && d.userId != null && d.isActive == true, "AppointmentMaster");

                    return(appointments.ToList());
                }
                else if (appointment.queryParameter == "findbydate")
                {
                    var appointments = await Respository.GetItemsAsync(d => d.date == appointment.date && d.isActive == true && d.isAvailable == true, "AppointmentMaster");

                    return(appointments.ToList());
                }
                else
                {
                    AppointmentEntity newAppointment = new AppointmentEntity();
                    newAppointment.id           = null;
                    newAppointment.date         = appointment.date;
                    newAppointment.from         = appointment.from;
                    newAppointment.to           = appointment.to;
                    newAppointment.userId       = appointment.userId;
                    newAppointment.email        = appointment.email;
                    newAppointment.phone        = appointment.phone;
                    newAppointment.username     = appointment.username;
                    newAppointment.isActive     = appointment.isActive;
                    newAppointment.isAvailable  = appointment.isAvailable;
                    newAppointment.createdBy    = appointment.createdBy;
                    newAppointment.createdDate  = appointment.createdDate;
                    newAppointment.modifiedBy   = appointment.modifiedBy;
                    newAppointment.modifiedDate = appointment.modifiedDate;

                    var appt = await Respository.CreateItemAsync(newAppointment, "AppointmentMaster");

                    List <AppointmentEntity> apptList = new List <AppointmentEntity>();
                    return(apptList);
                }
            }
            catch
            {
                List <AppointmentEntity> apptList = new List <AppointmentEntity>();
                return(apptList);
            }
        }
Пример #6
0
        public List <Model.Appointment> ToList(AppointmentQuery query)
        {
            var l = Appointment_BuildQuery(query)
                    .AsNoTracking()
                    .ToList();

            var result = l.Select(x => new Model.Appointment
            {
                AppointmentNumber = x.AppointmentNumber,
                CustomerId        = x.CustomerId,
                DivisionId        = x.DivisionId,
                DateAdded         = x.DateAdd,
                PickTicket        = x.PickTicketId,
                Posted            = x.Posted,
                PtBulk            = x.PtBulk,
                ScacCode          = x.ScacCode,
                ShippingDate      = x.ShipDate,
                ShippingTime      = x.ShipTime,
                ShippingTimeLimit = x.ShippingTimeLimit,
                Status            = x.Status,
                Transfered        = x.Transferred,
                UserName          = x.UserName,
                Carrier           = x.CatScacCode.ScacCodeName,
                CustomerName      = x.Customer != null ? x.Customer.CompanyName : string.Empty,
                //DivisionName = x.Division != null ? x.Division.Description : string.Empty,
                DivisionName     = x.DivisionName,   // != null ? x.Division.Description : string.Empty,
                DivisionNameId   = x.DivisionNameId, // != null ? x.Division.NameId : null,
                DeliveryTypeId   = x.DeliveryTypeId,
                ReScheduleDate   = x.ReScheduleDate,
                IsReSchedule     = x.IsReSchedule,
                Pallets          = x.Pallets,
                DriverId         = x.DriverId,
                DriverName       = x.Driver != null ? $"{x.Driver.Name} {x.Driver.SurName}" : null,
                TruckId          = x.TruckId,
                TruckDescription = x.Truck?.Description,
                RescheduleCount  = x.RescheduleCount
            });

            return(result.ToList());
        }
Пример #7
0
 public IList <Model.Appointment> ToList(AppointmentQuery query)
 {
     return(Repository.ToList(query));
 }
Пример #8
0
 public async Task <IList <Model.Appointment> > ToListAsync(AppointmentQuery query)
 {
     return(await Repository.ToListAsync(query));
 }
        public void CanConstruct()
        {
            var instance = new AppointmentQuery(_appointmentService);

            Assert.IsNotNull(instance);
        }
 public void SetUp()
 {
     _appointmentService = new Mock <IAppointmentService>().Object;
     _testClass          = new AppointmentQuery(_appointmentService);
 }
Пример #11
0
        private IQueryable <dynamic> Appointment_BuildQuery(AppointmentQuery query)
        {
            //var q = context.Appointments.Where(x => true)
            //  .Include("Customer")
            //  .Include("Division");

            var q = (from a in context.Appointments
                     join orders in context.OrderAppointments on new { a.CustomerId, a.PickTicketId } equals new { orders.CustomerId, orders.PickTicketId }
                     join customer in context.Customers on a.CustomerId equals customer.CustomerId
                     join division in context.CustomerDivisions on a.DivisionId equals division.DivisionId
                     into y
                     from z in y.DefaultIfEmpty()
                     select new { a.PickTicketId, a.Pallets, a.IsReSchedule, a.Posted, a.AppointmentNumber, a.CustomerId, a.DivisionId, a.UserName, a.PtBulk, a.DeliveryTypeId, a.DateAdd, a.ReScheduleDate, a.ScacCode, a.ShippingTimeLimit, a.ShipTime, a.Status, a.Transferred, ShipDate = orders.ShipFor, DivisionName = z != null? z.Description : string.Empty, DivisionNameId = z != null ? z.NameId : string.Empty, Customer = customer, a.CatScacCode, a.DriverId, a.TruckId, a.Driver, a.Truck, BillOfLading = orders.BillOfLading, PurchaseOrder = orders.PurchaseOrderId, MasterBillOfLading = orders.MasterBillOfLading, RescheduleCount = a.RescheduleCount });



            if (string.IsNullOrEmpty(query.KeySearch))
            {
                if (!string.IsNullOrEmpty(query.PickTicketId))
                {
                    q = q.Where(x => x.PickTicketId == query.PickTicketId);
                    // anotherq = anotherq.Where(x => x.PickTicketId == query.PickTicketId);
                }
                else if (query.PickTicketsIds != null && query.PickTicketsIds.Any())
                {
                    q = q.Where(x => query.PickTicketsIds.Contains(x.PickTicketId));
                    // anotherq = anotherq.Where(x => query.PickTicketsIds.Contains(x.PickTicketId));
                }


                if (!string.IsNullOrEmpty(query.AppointmentNumber))
                {
                    q = q.Where(x => x.AppointmentNumber == query.AppointmentNumber);
                    //anotherq = anotherq.Where(x => x.AppointmentNumber == query.AppointmentNumber);
                }
            }
            else
            {
                q = q.Where(x => x.PickTicketId == query.KeySearch || x.AppointmentNumber == query.KeySearch || x.PurchaseOrder == query.KeySearch);
            }


            if (!string.IsNullOrEmpty(query.CustomerId))
            {
                q = q.Where(x => x.CustomerId == query.CustomerId);
                //anotherq = anotherq.Where(x => x.CustomerId == query.CustomerId);
            }
            else if (query.CustomerIds != null && query.CustomerIds.Any())
            {
                q = q.Where(x => query.CustomerIds.Contains(x.CustomerId));
                //anotherq = anotherq.Where(x => query.CustomerIds.Contains(x.CustomerId));
            }


            if (query.Posted.HasValue)
            {
                q = q.Where(x => x.Posted == query.Posted.Value);
                // anotherq = anotherq.Where(x => x.Posted == query.Posted.Value);
            }

            if (query.ShippingDateStart.HasValue)
            {
                q = q.Where(x => x.ShipDate >= query.ShippingDateStart.Value);
                //anotherq = anotherq.Where(x => x.ShipDate >= query.ShippingDateStart.Value);
            }
            if (query.ShippingDateEnd.HasValue)
            {
                q = q.Where(x => x.ShipDate <= query.ShippingDateEnd.Value);
                //anotherq = anotherq.Where(x => x.ShipDate <= query.ShippingDateEnd.Value);
            }
            if (query.ShippingDate.HasValue)
            {
                q = q.Where(x => (x.ShipDate.Value.Year == query.ShippingDate.Value.Year && x.ShipDate.Value.Month == query.ShippingDate.Value.Month && x.ShipDate.Value.Day == query.ShippingDate.Value.Day) ||
                            (x.ReScheduleDate.Value.Year == query.ShippingDate.Value.Year && x.ReScheduleDate.Value.Month == query.ShippingDate.Value.Month && x.ReScheduleDate.Value.Day == query.ShippingDate.Value.Day));
            }
            if (!string.IsNullOrEmpty(query.Status))
            {
                q = q.Where(x => x.Status == query.Status);
                //  anotherq = anotherq.Where(x => x.Status == query.Status);
            }
            if (query.DeliveryTypeId.HasValue)
            {
                q = q.Where(x => x.DeliveryTypeId == query.DeliveryTypeId.Value);
                // anotherq = anotherq.Where(x => x.DeliveryTypeId == query.DeliveryTypeId.Value);
            }
            if (query.DivisionId.HasValue)
            {
                q = q.Where(x => x.DivisionId == query.DivisionId.Value);
                //anotherq = anotherq.Where(x => x.DivisionId == query.DivisionId.Value);
            }
            else if (query.DivisionIds != null && query.DivisionIds.Any())
            {
                q = q.Where(x => x.DivisionId.HasValue && query.DivisionIds.Contains(x.DivisionId.Value));
                //anotherq = anotherq.Where(x => x.DivisionId.HasValue && query.DivisionIds.Contains(x.DivisionId.Value));
            }

            if (query.IsReschedule.HasValue)
            {
                q = q.Where(x => x.IsReSchedule == query.IsReschedule.Value);
                // anotherq = anotherq.Where(x => x.IsReSchedule == query.IsReschedule.Value);
            }

            if (query.hasBool.HasValue)
            {
                if (query.hasBool.Value)
                {
                    q = q.Where(x => !string.IsNullOrEmpty(x.BillOfLading));
                }
                else
                {
                    q = q.Where(x => string.IsNullOrEmpty(x.BillOfLading));
                }
            }
            if (!String.IsNullOrEmpty(query.BillOfLading))
            {
                q = q.Where(x => x.BillOfLading == query.BillOfLading);
            }
            if (!String.IsNullOrEmpty(query.MasterBillOfLading))
            {
                q = q.Where(x => x.MasterBillOfLading == query.MasterBillOfLading);
            }

            if (query.ShipFor.HasValue)
            {
                q = q.Where(x => x.ShipDate == query.ShipFor.Value);
            }
            // var q1 = q.ToList().Count();
            //  var q2 = anotherq.ToList().Count();
            return(q);
        }