void UpdateStatus(AppoimantsStatus_SP status)
        {
            AppointmentList appList = new AppointmentList();

            SelectedTimespamView.Appointment.Status = (int)status;

            if (status.Equals(AppoimantsStatus_SP.Cancelado))
            {
                if (SelectedTimespamView.Appointment.IsExceptional)
                {
                    appList.Add(SelectedTimespamView.Appointment);

                    Controller.RemoveAppoiment(SelectedTimespamView.Appointment.AppointmentId);

                    OnChangeStatus(status);
                    Refresh();
                    return;
                }
            }
            //    AppointmentBE app =  SelectedTimespamView.Appointment.Clone<AppointmentBE>();
            //    app.Subject = string.Concat(Enum.GetName(typeof(AppoimantsStatus_SP),status), " a las : ", SelectedTimespamView.Appointment.TimeEnd);
            //    app.Status = (int)status;
            //    appList.Add(app);

            //    try
            //    {
            //        Controller.CreateAppointments(app);

            //        if (OnCreateAppoimentsEvent != null)
            //            OnCreateAppoimentsEvent(app, new EventArgs());


            //    }

            //    catch (Exception ex)
            //    {
            //        this.ExceptionViewer.Show(ex);
            //    }

            //}

            try
            {
                appList.Add(SelectedTimespamView.Appointment);

                Controller.UpdateAppoiment(appList);

                OnChangeStatus(status);
                Refresh();
            }
            catch (Exception ex)
            {
                this.ExceptionViewer.Show(ex);
            }
        }
Exemple #2
0
        public async Task Init()
        {
            UserSearchRequest request = new UserSearchRequest {
                Username = APIService.Username
            };
            var list = await _userService.GetAll <List <User> >(request);

            var client = list[0];

            if (AppointmentList.Count > 0)
            {
                AppointmentList.Clear();
            }

            AppointmentSearchRequest request2 = new AppointmentSearchRequest {
                UserID = client.UserID
            };
            var appointments = await _appointmentService.GetAll <List <Appointment> >(request2);

            foreach (var appointment in appointments)
            {
                AppointmentList.Add(appointment);
            }

            if (AppointmentList.Count == 0)
            {
                await Application.Current.MainPage.DisplayAlert("Warning", "You don't have any appointments yet.", "OK");
            }
        }
Exemple #3
0
        public static void UpdateAppoimentStatus(AppointmentBE appointment)
        {
            AppointmentList wAppointmentList = new AppointmentList();

            wAppointmentList.Add(appointment);
            UpdateAppoiment(wAppointmentList);
        }
Exemple #4
0
        private void Timer1_Tick(object sender, System.EventArgs e)
        {
            //Get a refernece to the appointment "xyz"
            Appointment appointment = schedule1.AppointmentCollection["xyz"];

            //Create a skip collection to skip the test appointment itself
            //otherwise it will find itself as a conflict
            AppointmentList skipAppts = new AppointmentList(schedule1);

            skipAppts.Add(appointment);

            //Start the search at the appointment's current time + the schedule time increment (30 minutes)
            DateTime startTime = appointment.StartDateTime.Add(new TimeSpan(0, int.Parse(schedule1.TimeIncrement.ToString("d")), 0));

            //Find the next time slot
            Appointment testSlot = schedule1.AppointmentCollection.ToList().NextAreaAvailable(appointment.StartDate, startTime, appointment.Length, true, skipAppts);

            //Set the appointment's properties to reflect the new time slot
            if (testSlot == null)
            {
                appointment.StartDate = new DateTime(2004, 1, 1);
                appointment.StartTime = new DateTime(2004, 1, 1, 8, 0, 0);
            }
            else
            {
                appointment.StartDate = testSlot.StartDate;
                appointment.StartTime = testSlot.StartTime;
            }

            //Refresh the schedule
            schedule1.Refresh();
        }
Exemple #5
0
        void UpdateStatus(AppoimantsStatus_SP status)
        {
            try
            {
                SelectedAppointment.Status = (int)status;
                //TODO: Set SelectedTimespamView.Appoiment to canceled in database

                AppointmentList appList = new AppointmentList();
                //if (!String.IsNullOrEmpty(SelectedTimespamView.Appointment.GroupId))
                appList.Add(SelectedAppointment);
                //else
                //{
                //    var appList_aux = (from s in AppointmentList where s.GroupId.Equals(s) select s).ToList<AppointmentBE>();
                //    appList_aux.ForEach(p => { p.Status = (int)status; });
                //    appList.AddRange(appList_aux);
                //}
                ServiceCalls.UpdateAppoiment(appList);
            }
            catch (Exception ex)
            {
                this.ExceptionViewer.Show(ex);
            }


            OnChangeStatus(status);
            //gridControl2.RefreshDataSource();
            //gridView2.RefreshData();
            Refresh();
        }
Exemple #6
0
        /// <summary>
        /// Por el momento representa Turnos otorgados a un profesional
        /// </summary>
        /// <param name="startDate">Fecha desde</param>
        /// <param name="status">Estado que del appointment se desea cunsultar</param>
        /// <param name="resourceId">Id a quien pertenezca el appointment</param>
        /// <returns>AppointmentList, Appointment con ProfesionalAppointment</returns>
        public static AppointmentList Retrive_ProfessionalAppointment(DateTime?startDate, int?status, int?resourseId = null, Guid?healthInstitutionId = null)
        {
            AppointmentList list = new AppointmentList();

            if (startDate.HasValue)
            {
                startDate = Fwk.HelperFunctions.DateFunctions.GetStartDateTime(startDate.Value);
            }

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                var appointment_db = dc.Appointments.Where <Appointment>(p =>
                                                                         (!startDate.HasValue || p.Start.Value >= startDate.Value) &&
                                                                         (!status.HasValue || status.Value.Equals(p.Status.Value)) &&
                                                                         (!resourseId.HasValue || p.ResourceId.Value.Equals(resourseId.Value)) &&
                                                                         (!healthInstitutionId.HasValue || p.HealthInstitutionId.Value.Equals(healthInstitutionId.Value))
                                                                         );//.OrderByDescending(sort=>sort.CreationDate);

                foreach (Appointment r in appointment_db)
                {
                    AppointmentBE wAppoiment = (AppointmentBE)r;
                    wAppoiment.ProfesionalAppointment = (ProfesionalAppointmentBE)r.ProfesionalAppointment;
                    list.Add(wAppoiment);
                }
            }
            return(list);
        }
        void UpdateStatus(AppoimantsStatus_SP status)
        {
            try
            {
                SelectedAppointment.Status = (int)status;
                //TODO: Set SelectedTimespamView.Appoiment to canceled in datanbase

                AppointmentList appList = new AppointmentList();

                appList.Add(SelectedAppointment.Get_Appointments());

                //else
                //{
                //    var appList_aux = (from s in AppointmentList where s.GroupId.Equals(s) select s).ToList<AppointmentBE>();
                //    appList_aux.ForEach(p => { p.Status = (int)status; });
                //    appList.AddRange(appList_aux);
                //}
                Controller.UpdateAppoimentStatus(appList);
            }
            catch (Exception ex)
            {
                this.ExceptionViewer.Show(ex);
            }


            //OnChangeStatus(status);
            gridControl2.RefreshDataSource();
            gridView2.RefreshData();
        }
Exemple #8
0
    void Start()
    {
        appointments.Add(
            new Appointment(
                TimeManager.worldTime.HourMinuteToTime(9, 10), "confess",
                player, confession));

        appointments.Add(new Appointment(
                             TimeManager.worldTime.HourMinuteToTime(9, 20), "dance"
                             , () => PointOfInterrest.GetClosestByName("Well", transform.position).transform));

        OnPositionChange += UpdateDistance;
        if (appointments.GetNext().conversationPartner != null)
        {
            appointments.GetNext().conversationPartner.OnPositionChange += UpdateDistance;
        }
        UpdateDistance(transform.position);
    }
Exemple #9
0
        static public void SearchAppointment(ComboBox box, TextBox search, HairSpaContext context)
        {
            IQueryable <Appointment> list = null;

            AppointmentList.Clear();

            switch (box.SelectedItem)
            {
            case "Id":
                list = context.Appointments.Where(ap => ap.Id.ToString().Contains(search.Text));
                break;

            case "Type":
                list = context.Appointments.Where(ap => ap.Type.Contains(search.Text));
                break;

            case "Customer Id":
                list = context.Appointments.Where(ap => ap.CustomersId.ToString().Contains(search.Text));
                break;

            case "Employee Id":
                list = context.Appointments.Where(ap => ap.EmployeesId.ToString().Contains(search.Text));
                break;

            default:
                break;
            }

            try
            {
                if (list.ToList().Count <= 0)
                {
                    MessageBox.Show("No records were found", "No Results");
                    return;
                }
                else
                {
                    list.ToList().ForEach(ap => AppointmentList.Add(ap));
                }
            }
            catch (Exception)
            {
                MessageBox.Show("No records were found", "No Results");
                return;
            }
        }
Exemple #10
0
        /// <summary>
        /// 加载默认的工作计划表
        /// </summary>
        /// <param name="date">The start date.</param>
        /// <returns></returns>
        private static AppointmentList CreateDefualtAppointments(DateTime date)
        {
            List <Brush> brushes = new List <Brush>();

            brushes.Add(Brushes.LimeGreen);
            brushes.Add(Brushes.PowderBlue);
            brushes.Add(Brushes.DarkGreen);
            brushes.Add(Brushes.Green);
            brushes.Add(Brushes.DimGray);
            brushes.Add(Brushes.Red);
            brushes.Add(Brushes.Yellow);
            brushes.Add(Brushes.Aquamarine);
            brushes.Add(Brushes.Plum);
            brushes.Add(Brushes.Orange);
            brushes.Add(Brushes.Pink);



            //create 7am of last monday
            DateTime timeStart = new DateTime(date.Year, date.Month, date.Day, 8, 30, 0);
            //while (timeStart.DayOfWeek != DayOfWeek.Monday)
            //{
            //    timeStart = timeStart.AddDays(-1);
            //}

            AppointmentList appts = new AppointmentList();

            int hoursToAdd = 1;

            for (int i = 0; i < 12; i++)
            {
                BrakePlanAppointments app = new BrakePlanAppointments();

                app.Subject         = "无型号";
                app.ColorBlockBrush = Brushes.LimeGreen;
                app.DateStart       = timeStart.AddHours(i * hoursToAdd);
                app.DateEnd         = app.DateStart.AddMinutes(60);
                appts.Add(app);
            }


            appts.SortAppointments();

            return(appts);
        }
Exemple #11
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="resourceId"></param>
        /// <param name="startDate"></param>
        /// <param name="Status"></param>
        /// <param name="healthInstId">Opcional </param>
        /// <returns></returns>
        public static AppointmentList Retrive_Appointment_By_Params_1(int resourceId, DateTime?startDate, int?Status, Guid?healthInstId)
        {
            AppointmentList list = new AppointmentList();

            //TODO Implmetar startDate
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                var appointment_db = dc.Appointments.Where <Appointment>(p => p.ResourceId.Value.Equals(resourceId) && p.Start >= startDate &&
                                                                         (!healthInstId.HasValue || p.HealthInstitutionId.Equals(healthInstId.Value))
                                                                         );

                foreach (Appointment r in appointment_db)
                {
                    AppointmentBE wResourceScheduling = (AppointmentBE)r;
                    list.Add(wResourceScheduling);
                }
            }
            return(list);
        }
Exemple #12
0
        async Task SearchAppointments()
        {
            if (EndDate < StartDate)
            {
                await Application.Current.MainPage.DisplayAlert("Warning", "End date must be greater than start date", "Try again");

                return;
            }

            UserSearchRequest request = new UserSearchRequest {
                Username = APIService.Username
            };
            var list = await _userService.GetAll <List <User> >(request);

            var client = list[0];

            if (AppointmentList.Count > 0)
            {
                AppointmentList.Clear();
            }

            AppointmentSearchRequest request2 = new AppointmentSearchRequest
            {
                UserID        = client.UserID,
                TreatmentName = TreatmentName,
                StartDate     = StartDate.Date,
                EndDate       = EndDate.Date
            };

            var appointments = await _appointmentService.GetAll <List <Appointment> >(request2);

            foreach (var appointment in appointments)
            {
                AppointmentList.Add(appointment);
            }

            if (AppointmentList.Count == 0)
            {
                await Application.Current.MainPage.DisplayAlert("Warning", "There are no results for this search", "OK");
            }
        }
Exemple #13
0
        /// <summary>
        /// Busca turnos de una fecha detrerminada y recurso determinado.
        /// Opcional: Status
        /// </summary>
        /// <param name="resourceId"></param>
        /// <param name="date"></param>
        /// <param name="Status"></param>
        /// <returns></returns>
        public static AppointmentList Retrive_Appointment_By_Params_2(int resourceId, DateTime date, int?Status, Guid?healthInstitutionId)
        {
            AppointmentList list   = new AppointmentList();
            DateTime        dEnd   = Fwk.HelperFunctions.DateFunctions.GetEndDateTime(date);
            DateTime        dStart = Fwk.HelperFunctions.DateFunctions.GetStartDateTime(date);

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                // dStaqrt <= FECHA_BD <= dEnd
                var appointment_db = dc.Appointments.Where <Appointment>(p =>
                                                                         p.ResourceId.Value.Equals(resourceId) && (dStart <= p.Start && p.Start <= dEnd) &&
                                                                         (healthInstitutionId.HasValue == false || p.HealthInstitutionId.Value.Equals(healthInstitutionId.Value)));

                //var x = from p in dc.Appointments from pa in dc.ProfesionalAppointments
                foreach (Appointment r in appointment_db)
                {
                    AppointmentBE wAppointmentBE = (AppointmentBE)r;
                    wAppointmentBE.ProfesionalAppointment = (ProfesionalAppointmentBE)r.ProfesionalAppointment;
                    list.Add(wAppointmentBE);
                }
            }
            return(list);
        }
Exemple #14
0
        private void BtnRegister_Click(object sender, RoutedEventArgs e)
        {
            bool flag = ValidateValues();

            if (slot <= appointmentArray.Length && flag == true)
            {
                if (appointmentArray[slot].Patient == null)
                {
                    appointmentError.Content            = "";
                    appointmentArray[slot].Patient      = CreateNewPatient();
                    appointmentArray[slot].Patient.Time = appointmentCombo.SelectedValue.ToString();
                    appointmentArray[slot].Time         = appointmentCombo.SelectedValue.ToString();
                    saveList.Add(appointmentArray[slot]);
                    saveList.Sort();
                }
                else if (appointmentArray[slot].Patient != null)
                {
                    appointmentError.Foreground = Brushes.Red;
                    appointmentError.Content    = "Slot Aready Taken";
                }
            }
            else
            {
                genralError.Foreground = Brushes.Red;
                genralError.Content    = "Error Registering Customer";
            }

            if (appointmentArray[slot].Patient != null)
            {
                Applist.Add(appointmentArray[slot].Patient);
                TimeList.RemoveAt(selectedIndex);
            }
            MyGrid.ItemsSource = Applist;

            //TimeList.Remove(appointmentCombo.SelectedValue.ToString());
        }
Exemple #15
0
 public static void UpdateAppoimentStatus(AppointmentBE appointment)
 {
     AppointmentList wAppointmentList = new AppointmentList();
     wAppointmentList.Add(appointment);
     UpdateAppoiment(wAppointmentList);
 }
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            bool flag = true;

            if (txtAppointmentCount.Text.Length == 0 || cmbAppointmentTime.SelectedIndex == -1)
            {
                MessageBox.Show("Enter appointment count and click the 'Show Timings'", "Error", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else
            {
                if (cmbAppointmentTime.SelectedIndex == -1)
                {
                    MessageBox.Show("Select an appointment time");
                    flag = false;
                }
                else if (cmbTestLocation.SelectedIndex == -1)
                {
                    MessageBox.Show("Select a test location");
                    flag = false;
                }
                else
                {
                    int slot = cmbAppointmentTime.SelectedIndex + 1;
                    if (appArray[slot - 1].CandidateData == null)
                    {
                        Candidate candidate = new Domestic();
                        appArray[slot - 1].AppointmentTime = appArray[slot - 1].AppointmentTime;
                        appArray[slot - 1].TestLocation    = cmbTestLocation.Text;
                        appArray[slot - 1].SlotNumber      = slot;
                        int candidateType = cmbCandidateType.SelectedIndex + 1;


                        switch (candidateType)
                        {
                        case (int)CandidateType.Domestic:
                            candidate = new Domestic();
                            candidate.CandidateType = "Domestic";
                            string IsFeeDeduction = cmbIndividualTask.Text;
                            ((Domestic)candidate).IsFeeDeduction = (IsFeeDeduction.ToUpper() == "YES") ? true : false;
                            break;

                        case (int)CandidateType.International:
                            candidate = new International();
                            candidate.CandidateType = "International";
                            string isWorkPermit = cmbIndividualTask.Text;
                            ((International)candidate).IsWorkPermit = (isWorkPermit.ToUpper() == "YES") ? true : false;
                            break;

                        case (int)CandidateType.LicenseRenew:
                            candidate = new LicenseRenew();
                            candidate.CandidateType = "LicenseRenew";
                            string isLicenseExpired = cmbIndividualTask.Text;
                            ((LicenseRenew)candidate).IsLicenseExpired = (isLicenseExpired.ToUpper() == "YES") ? true : false;
                            break;
                        }

                        string  candidateName    = txtName.Text;
                        string  candidateAddress = txtAddress.Text;
                        string  candidateEmail   = txtEmail.Text;
                        string  passport         = txtPassport.Text;
                        decimal amount;
                        string  amountString = txtAmount.Text;
                        string  creditCard   = txtCreditcard.Text;
                        candidate.CreditCard = creditCard;
                        candidate.Passport   = passport;
                        candidate.Email      = candidateEmail;
                        if (candidateName.Length == 0)
                        {
                            if (Validation.GetHasError(txtName) == true)
                            {
                                return;
                            }
                            txtName.Foreground = Brushes.Red;
                            txtName.Select(0, txtName.Text.Length);
                            flag = false;
                        }
                        else
                        {
                            txtName.Foreground = Brushes.Black;
                        }
                        if (candidateAddress.Length == 0)
                        {
                            txtAddress.Foreground = Brushes.Red;
                            txtAddress.Select(0, txtAddress.Text.Length);
                            flag = false;
                        }
                        else
                        {
                            txtAddress.Foreground = Brushes.Black;
                        }
                        if (!candidate.CheckEmail())
                        {
                            txtEmail.Foreground = Brushes.Red;
                            txtEmail.Select(0, txtEmail.Text.Length);
                            flag = false;
                        }
                        else
                        {
                            txtEmail.Foreground = Brushes.Black;
                        }
                        if (!(decimal.TryParse(amountString, out amount)))
                        {
                            txtAmount.Foreground = Brushes.Red;
                            txtAmount.Select(0, txtAmount.Text.Length);
                            flag = false;
                        }
                        else
                        {
                            txtAmount.Foreground = Brushes.Black;
                        }
                        if (!candidate.CheckCreditCard())
                        {
                            txtCreditcard.Foreground = Brushes.Red;
                            txtCreditcard.Select(0, txtCreditcard.Text.Length);
                            flag = false;
                        }
                        else
                        {
                            txtCreditcard.Foreground = Brushes.Black;
                        }
                        if (!candidate.CheckPassport())
                        {
                            txtPassport.Foreground = Brushes.Red;
                            txtPassport.Select(0, txtPassport.Text.Length);
                            flag = false;
                        }
                        else
                        {
                            txtPassport.Foreground = Brushes.Black;
                        }
                        if (cmbAppointmentTime.SelectedIndex == -1)
                        {
                            MessageBox.Show("Select an appointment time");
                            flag = false;
                        }
                        if (cmbTestLocation.SelectedIndex == -1)
                        {
                            MessageBox.Show("Select a test location");
                            flag = false;
                        }
                        if (cmbCandidateType.SelectedIndex == -1)
                        {
                            MessageBox.Show("Select an landscape type");
                            flag = false;
                        }
                        if (cmbIndividualTask.SelectedIndex == -1)
                        {
                            MessageBox.Show("Select individual task");
                            flag = false;
                        }
                        if (flag)
                        {
                            candidate.CandidateName          = candidateName;
                            candidate.CandidateAddress       = candidateAddress;
                            candidate.Email                  = candidateEmail;
                            candidate.Passport               = passport;
                            candidate.AmountPaid             = amount;
                            candidate.CreditCard             = creditCard;
                            appArray[slot - 1].CandidateData = candidate;
                            appointmentList.Add(appArray[slot - 1]);
                            //DisplayAppointment.Add(appArray[slot - 1]);
                            slotCount--;
                            // AddToAppointment(appArray);
                            xmlObject.WriteToXMLFile(appointmentList);
                            MessageBox.Show("Successfully added candidate details to file");

                            ResetFields();
                        }
                        else
                        {
                            MessageBox.Show("Fill all the fields..");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Slot Taken..");
                    }
                }
            }
        }
        void UpdateStatus(AppoimantsStatus_SP status)
        {
            AppointmentList appList = new AppointmentList();
            SelectedTimespamView.Appointment.Status = (int)status;

            if (status.Equals(AppoimantsStatus_SP.Cancelado) )
            {
                if (SelectedTimespamView.Appointment.IsExceptional                    )
                {
                    appList.Add(SelectedTimespamView.Appointment);
                    
                    ServiceCalls.RemoveAppoiment(SelectedTimespamView.Appointment.AppointmentId);

                    OnChangeStatus(status);
                    Refresh();
                    return;
                }
            }
            //    AppointmentBE app =  SelectedTimespamView.Appointment.Clone<AppointmentBE>();
            //    app.Subject = string.Concat(Enum.GetName(typeof(AppoimantsStatus_SP),status), " a las : ", SelectedTimespamView.Appointment.TimeEnd);
            //    app.Status = (int)status;
            //    appList.Add(app);
               
            //    try
            //    {
            //        Controller.CreateAppointments(app);
                    
            //        if (OnCreateAppoimentsEvent != null)
            //            OnCreateAppoimentsEvent(app, new EventArgs());

                   
            //    }

            //    catch (Exception ex)
            //    {
            //        this.ExceptionViewer.Show(ex);
            //    }

            //}

            try
            {
      
                appList.Add(SelectedTimespamView.Appointment);
        
                ServiceCalls.UpdateAppoiment(appList);

                OnChangeStatus(status);
                Refresh();
            }
            catch (Exception ex)
            {
                this.ExceptionViewer.Show(ex);
            }
        }
Exemple #18
0
      /// <summary>
      /// 
      /// </summary>
      /// <param name="resourceId"></param>
      /// <param name="startDate"></param>
      /// <param name="Status"></param>
      /// <param name="healthInstId">Opcional </param>
      /// <returns></returns>
        public static AppointmentList Retrive_Appointment_By_Params_1(int resourceId, DateTime? startDate, int? Status, Guid? healthInstId)
        {
            AppointmentList list = new AppointmentList();
            //TODO Implmetar startDate
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                var appointment_db = dc.Appointments.Where<Appointment>(p => p.ResourceId.Value.Equals(resourceId) && p.Start >= startDate && 
                    (!healthInstId.HasValue || p.HealthInstitutionId.Equals(healthInstId.Value))
                    ); 

                foreach (Appointment r in appointment_db)
                {
                    AppointmentBE wResourceScheduling = (AppointmentBE)r;
                    list.Add(wResourceScheduling);
                }
            }
            return list;
        }
Exemple #19
0
        /// <summary>
        /// Busca turnos de una fecha detrerminada y recurso determinado.
        /// Opcional: Status
        /// </summary>
        /// <param name="resourceId"></param>
        /// <param name="date"></param>
        /// <param name="Status"></param>
        /// <returns></returns>
        public static AppointmentList Retrive_Appointment_By_Params_2(int resourceId, DateTime date, int? Status,  Guid? healthInstitutionId)
        {
            AppointmentList list = new AppointmentList();
            DateTime dEnd = Fwk.HelperFunctions.DateFunctions.GetEndDateTime(date);
            DateTime dStart = Fwk.HelperFunctions.DateFunctions.GetStartDateTime(date);
            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                // dStaqrt <= FECHA_BD <= dEnd
                var appointment_db = dc.Appointments.Where<Appointment>(p =>
                    p.ResourceId.Value.Equals(resourceId) && (dStart <= p.Start && p.Start <= dEnd) &&
                    (healthInstitutionId.HasValue == false || p.HealthInstitutionId.Value.Equals(healthInstitutionId.Value)));

                //var x = from p in dc.Appointments from pa in dc.ProfesionalAppointments
                foreach (Appointment r in appointment_db)
                {
                    AppointmentBE wAppointmentBE = (AppointmentBE)r;
                    wAppointmentBE.ProfesionalAppointment = (ProfesionalAppointmentBE) r.ProfesionalAppointment;
                    list.Add(wAppointmentBE);
                }
            }
            return list;
        }
        void UpdateStatus(AppoimantsStatus_SP status)
        {
            try
            {
                SelectedAppointment.Status = (int)status;
                //TODO: Set SelectedTimespamView.Appoiment to canceled in database

                AppointmentList appList = new AppointmentList();
                //if (!String.IsNullOrEmpty(SelectedTimespamView.Appointment.GroupId))
                appList.Add(SelectedAppointment);
                //else
                //{
                //    var appList_aux = (from s in AppointmentList where s.GroupId.Equals(s) select s).ToList<AppointmentBE>();
                //    appList_aux.ForEach(p => { p.Status = (int)status; });
                //    appList.AddRange(appList_aux);
                //}
                ServiceCalls.UpdateAppoiment(appList);

                
            }
            catch (Exception ex)
            {
                this.ExceptionViewer.Show(ex);
            }

           
            OnChangeStatus(status);
            //gridControl2.RefreshDataSource();
            //gridView2.RefreshData();
            Refresh();
        }
Exemple #21
0
        /// <summary>
        /// This method provides List of Appointments available in Database.
        /// </summary>
        /// <param name="strWhere">Specifies condition for retrieving records.</param>
        /// <returns>Collection of Appointment Objects.</returns>
        public static AppointmentList GetList(string strWhere, string strAppointmentNo, string strName, bool flgClose)
        {
            AppointmentList objList = null;
            //string strSql = "Select * from APPOINTMENTMASTER ";
            string strSql = "SELECT AP.*, EMP.INITIALS, DEPT.DEPTNAME " +
                            " FROM APPOINTMENTMASTER AP, EMPMAST EMP, DEPTMAST DEPT " +
                            " WHERE EMP.DBID = AP.EMPLOYEEID " +
                            " AND DEPT.DBID = EMP.DEPT " +
                            " and AP.APMTCLOSE = @ApmtClose ";

            if (strAppointmentNo != string.Empty & strName == string.Empty)
            {
                strSql += " AND APPOINTMENTNO = '" + strAppointmentNo + "'";
            }
            else if (strAppointmentNo == string.Empty & strName != string.Empty)
            {
                strSql += " AND NAME = '" + strName + "'";
            }
            else if ((strAppointmentNo != string.Empty) & (strName != string.Empty))
            {
                strSql += " AND APPOINTMENTNO = '" + strAppointmentNo +
                          "' AND NAME = '" + strName + "'";
            }

            if (strWhere != string.Empty & strWhere != null)
            {
                strSql = strSql + " AND " + strWhere;
            }
            strSql += " ORDER BY Entrydate DESC, ENTRYNO DESC";

            using (SqlConnection Conn = new SqlConnection(General.GetSQLConnectionString()))
            {
                using (SqlCommand objCmd = new SqlCommand())
                {
                    objCmd.Connection  = Conn;
                    objCmd.CommandType = CommandType.Text;
                    objCmd.CommandText = strSql;
                    objCmd.Parameters.AddWithValue("@ApmtClose", flgClose);

                    if (Conn.State != ConnectionState.Open)
                    {
                        Conn.Open();
                    }

                    using (SqlDataReader oReader = objCmd.ExecuteReader())
                    {
                        if (oReader.HasRows)
                        {
                            objList = new AppointmentList();
                            while (oReader.Read())
                            {
                                objList.Add(FillDataRecord(oReader));
                            }
                        }
                        oReader.Close();
                        oReader.Dispose();
                    }
                }
            }
            return(objList);
        }
Exemple #22
0
        /// <summary>
        /// Por el momento representa Turnos otorgados a un profesional
        /// </summary>
        /// <param name="startDate">Fecha desde</param>
        /// <param name="status">Estado que del appointment se desea cunsultar</param>
        /// <param name="resourceId">Id a quien pertenezca el appointment</param>
        /// <returns>AppointmentList, Appointment con ProfesionalAppointment</returns>
        public static AppointmentList Retrive_ProfessionalAppointment(DateTime? startDate, int? status, int? resourseId = null, Guid? healthInstitutionId=null)
        {
            AppointmentList list = new AppointmentList();
            if (startDate.HasValue)
                startDate = Fwk.HelperFunctions.DateFunctions.GetStartDateTime(startDate.Value);

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                var appointment_db = dc.Appointments.Where<Appointment>(p =>
                    (!startDate.HasValue || p.Start.Value >= startDate.Value)
                    && (!status.HasValue || status.Value.Equals(p.Status.Value))
                    && (!resourseId.HasValue || p.ResourceId.Value.Equals(resourseId.Value))
                    && (!healthInstitutionId.HasValue || p.HealthInstitutionId.Value.Equals(healthInstitutionId.Value))
                    );//.OrderByDescending(sort=>sort.CreationDate);

                foreach (Appointment r in appointment_db)
                {
                    AppointmentBE wAppoiment = (AppointmentBE)r;
                    wAppoiment.ProfesionalAppointment = (ProfesionalAppointmentBE)r.ProfesionalAppointment;
                    list.Add(wAppoiment);
                }
            }
            return list;
        }
Exemple #23
0
        /// <summary>
        /// 获取产线点
        /// </summary>
        /// <param name="table"></param>
        /// <returns></returns>
        private AppointmentList GetPlanPoints(DataTable table)
        {
            try
            {
                AppointmentList list = new AppointmentList();

                DateTime timeStart = new DateTime(this.dateTimePicker1.Value.Year,
                                                  this.dateTimePicker1.Value.Month,
                                                  this.dateTimePicker1.Value.Day, 7, 30, 0);
                DateTime timeEnd = timeStart;

                int hoursToAdd  = 1;
                int minuteToAdd = 60;

                List <TimeRange> rangs = new List <TimeRange>();

                //获取小时
                for (int i = 0; i < 12; i++)
                {
                    timeStart = timeStart.AddHours(hoursToAdd);

                    timeEnd = timeStart.AddMinutes(minuteToAdd);

                    TimeRange rang = new TimeRange();
                    rang.StartTime = timeStart;
                    rang.EndTime   = timeEnd;
                    rangs.Add(rang);
                }


                foreach (DataRow itemRow in table.Rows)
                {
                    foreach (TimeRange item in rangs)
                    {
                        DateTime ptime1 = Convert.ToDateTime(itemRow["start_time"].ToString());
                        DateTime ptime2 = Convert.ToDateTime(itemRow["end_time"]);

                        if (item.IsInFullRange(ptime1, ptime2))
                        {
                            ProductionPlanMDL mdl = new ProductionPlanMDL();
                            mdl.Prase(itemRow);

                            BrakePlanAppointments app = new BrakePlanAppointments();

                            app.Subject = string.Format("型号:{0} 预计产量:{1}实际产量:{2}",
                                                        mdl.BreakeID.ToString(), mdl.PlanNum.ToString(), mdl.Actual_num.ToString());
                            app.ColorBlockBrush = Brushes.OrangeRed;
                            app.DateStart       = ptime1;
                            app.DateEnd         = ptime2;
                            app.MDL             = mdl;
                            list.Add(app);
                            break;
                        }

                        if (item.IsInRange(ptime1))
                        {
                            ProductionPlanMDL mdl = new ProductionPlanMDL();
                            mdl.Prase(itemRow);

                            BrakePlanAppointments app = new BrakePlanAppointments();

                            app.Subject = string.Format("型号:{0} 预计产量:{1}/r/n实际产量:{2}",
                                                        mdl.BreakeID.ToString(), mdl.PlanID.ToString(), mdl.Actual_num.ToString());
                            app.ColorBlockBrush = Brushes.OrangeRed;
                            app.DateStart       = ptime1;
                            app.DateEnd         = ptime2;
                            app.MDL             = mdl;
                            list.Add(app);
                            break;
                        }
                    }
                }


                return(list);
            }
            catch (Exception ex)
            {
                CLog.WriteErrLogInTrace(ex.StackTrace);
                return(null);
            }
        }
        void UpdateStatus(AppoimantsStatus_SP status)
        {
            try
            {
                SelectedAppointment.Status = (int)status;
                //TODO: Set SelectedTimespamView.Appoiment to canceled in datanbase

                AppointmentList appList = new AppointmentList();
           
                appList.Add(SelectedAppointment.Get_Appointments());
                
                //else
                //{
                //    var appList_aux = (from s in AppointmentList where s.GroupId.Equals(s) select s).ToList<AppointmentBE>();
                //    appList_aux.ForEach(p => { p.Status = (int)status; });
                //    appList.AddRange(appList_aux);
                //}
                Controller.UpdateAppoimentStatus(appList);


            }
            catch (Exception ex)
            {
                this.ExceptionViewer.Show(ex);
            }


            //OnChangeStatus(status);
            gridControl2.RefreshDataSource();
            gridView2.RefreshData();
        }
Exemple #25
0
        private void ReadFile()
        {
            FileStream fs = null;

            try
            {
                using (BinaryReader br = new BinaryReader(File.Open("clientDetails.bin", FileMode.Open)))
                {
                    while (br.BaseStream.Position != br.BaseStream.Length)
                    {
                        Client client       = null;
                        int    customerType = br.ReadInt32();
                        switch (customerType)
                        {
                        case (int)Customer.Gentlemen:
                            client = new Gentlemen();
                            break;

                        case (int)Customer.Ladies:
                            client = new Ladies();
                            break;

                        case (int)Customer.Children:
                            client = new Children();
                            break;
                        }
                        client.Name             = br.ReadString();
                        client.Age              = br.ReadInt32();
                        client.Height           = br.ReadDecimal();
                        client.CreditCardNumber = br.ReadString();
                        client.Slot             = br.ReadString();
                        switch (customerType)
                        {
                        case (int)Customer.Gentlemen:
                            ((Gentlemen)client).IsTrimmingNeeded = (br.ReadBoolean()) ? true : false;
                            ((Gentlemen)client).Moustaches       = (br.ReadBoolean()) ? true : false;
                            break;

                        case (int)Customer.Ladies:
                            ((Ladies)client).HairStyle = (br.ReadBoolean()) ? true : false;
                            break;

                        case (int)Customer.Children:
                            ((Children)client).SensitiveTrimmers = (br.ReadBoolean()) ? true : false;
                            ((Children)client).AdjustableSeats   = (br.ReadBoolean()) ? true : false;
                            break;
                        }
                        myList.Add(client);
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
            finally
            {
                if (fs != null)
                {
                    fs.Close();
                }
            }
        }
Exemple #26
0
 //Appointment Methods
 static public void GetAllAppointments(HairSpaContext context)
 {
     //Clear appointment list, then add appointment table records to the list.
     AppointmentList.ToList().ForEach(ap => AppointmentList.Remove(ap));
     context.Appointments.ToList().ForEach(ap => AppointmentList.Add(ap));
 }