private void BtnDisplay_Click(object sender, RoutedEventArgs e)
        {
            grdAppointment.ItemsSource = "";
            try
            {
                appointmentListXML = new AppointmentList();
                appointmentListXML = xmlObject.ReadFromXMLFile();
                appointmentListXML.Sort();
                //grdAppointment.ItemsSource = appointmentListXML;
                DisplayAppointment.Clear();
                for (int i = 0; i < appointmentListXML.Count(); i++)
                {
                    Appointment appt = appointmentListXML[i];
                    DisplayAppointment.Add(appt);
                }

                grdAppointment.ItemsSource = displayAppointment;
            }
            catch (IOException ioe)
            {
                Console.WriteLine(ioe.ToString());
            }
            finally
            {
            }
        }
Beispiel #2
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);
        }
Beispiel #3
0
        private void FillList(string strAppointmentNo, string strName)
        {
            AppointmentList objList = new AppointmentList();

            if (strAppointmentNo == "All")
            {
                strAppointmentNo = "";
            }
            if (strName == "All")
            {
                strName = "";
            }
            objList = AppointmentManager.GetList(Condition, strAppointmentNo, strName, chkClosed.Checked);

            lvwAppoints.Items.Clear();

            if (objList != null)
            {
                foreach (Appointment objAppoint in objList)
                {
                    ListViewItem objLvwItem = new ListViewItem();
                    objLvwItem.Name = Convert.ToString(objAppoint.DBID);
                    objLvwItem.Text = Convert.ToString(objAppoint.EntryNo);
                    objLvwItem.SubItems.Add(objAppoint.EntryDate.ToShortDateString());
                    objLvwItem.SubItems.Add(Convert.ToString(objAppoint.AppointmentNo));
                    objLvwItem.SubItems.Add(objAppoint.Name);
                    objLvwItem.SubItems.Add(objAppoint.AppointmentDate.ToShortDateString());
                    objLvwItem.SubItems.Add(objAppoint.ScheduleTime.ToShortTimeString());

                    lvwAppoints.Items.Add(objLvwItem);
                }
            }
        }
Beispiel #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();
        }
Beispiel #5
0
        /// <summary>
        /// Sort the unassigned appointments first on the priority and then the date. Uses a SortedSet vir IComparable and IComparer
        /// </summary>
        /// <returns></returns>
        public List <AppointmentPriority> sortUnassignedAppointments()
        {
            List <AppointmentPriority> usSortedAppointments = new AppointmentList().getAllUnassignedAppointments();

            SortedSet <AppointmentPriority> sorted = new SortedSet <AppointmentPriority>();

            // Check if there are immediate appointments that needs to be done!
            foreach (AppointmentPriority appointment in usSortedAppointments)
            {
                TimeSpan duration = appointment.Time - DateTime.UtcNow;

                if (duration.TotalDays <= 7)
                {
                    sorted.Add(appointment);
                }
            }

            if (sorted.Count != 0)
            {
                return(sorted.ToList());
            }

            foreach (AppointmentPriority appointment in usSortedAppointments)
            {
                TimeSpan duration = appointment.Time - DateTime.UtcNow;

                sorted.Add(appointment);
            }



            //return sortedAppointments;
            return(sorted.ToList());
        }
        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();
        }
Beispiel #7
0
 private void DoGetAppointments(DateTime date, AppointmentList appointments)
 {
     if (OnGetWeekViewAppointments != null)
     {
         OnGetWeekViewAppointments(this, date, appointments);
     }
 }
Beispiel #8
0
        public ActionResult Edit(int Id)
        {
            AppointmentList appoinmentList = new AppointmentList();

            appoinmentList = AppoinmentListsServices.Instance.GetAppointmentList(Id);
            return(PartialView(appoinmentList));
        }
Beispiel #9
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");
            }
        }
Beispiel #10
0
        public List <AppointmentList> getAppointments()
        {
            List <Appointment>   bookedAppointments = ((IAppointmentRepository)repositoryFactory.getRepository("APPOINTMENT")).getBookings();
            List <TreatmentPlan> treatmentPlans     = ((ITreatmentPlanRepository)repositoryFactory.getRepository("TREATMENTPLAN")).getTreatmentPlans();

            foreach (Appointment appointment in bookedAppointments)
            {
                AppointmentList appointments = new AppointmentList();
                appointments.patientID = appointment.patientID;
                Patient patient = ((IPatientRepository)repositoryFactory.getRepository("PATIENT")).getPatient(appointment.patientID);
                appointments.email         = patient.email;
                appointments.treatmentType = appointment.treatmentType;
                appointments.bookingSlot   = appointment.bookingSlot;
                appointments.bookingdate   = appointment.bookingDate;
                appointmentList.Add(appointments);
            }
            foreach (TreatmentPlan treatmentPlan in treatmentPlans)
            {
                AppointmentList appointments = new AppointmentList();
                appointments.patientID = treatmentPlan.patientID;
                Patient patient = ((IPatientRepository)repositoryFactory.getRepository("PATIENT")).getPatient(treatmentPlan.patientID);
                appointments.email         = patient.email;
                appointments.treatmentType = treatmentPlan.proposedTreatment;
                appointments.bookingSlot   = "NOT BOOKED";
                appointments.bookingdate   = null;
                appointmentList.Add(appointments);
            }

            return(appointmentList);
        }
Beispiel #11
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();
        }
Beispiel #12
0
        public WebAppointments()
        {
            appts = new AppointmentList();

            string url = Configurator.getCloudWebURL();

            cloud = new RiskApps3.HraCloudServices.RiskAppsCloudServices(url);

            InitializeComponent();

            label14.Visible           = true;
            progressBar1.Visible      = true;
            progressBar1.Enabled      = true;
            label14.Text              = "Fetching Available Web Surveys...";
            button1.Enabled           = false;
            fastDataListView1.Enabled = false;
            backgroundWorker1.RunWorkerAsync();

            foreach (Clinic c in SessionManager.Instance.ActiveUser.UserClinicList)
            {
                comboBox1.Items.Add(c);
            }
            if (comboBox1.Items.Count > 0)
            {
                comboBox1.SelectedIndex = 0;
            }
            webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(DocLoadComplete);
        }
Beispiel #13
0
        public static void UpdateAppoimentStatus(AppointmentBE appointment)
        {
            AppointmentList wAppointmentList = new AppointmentList();

            wAppointmentList.Add(appointment);
            UpdateAppoiment(wAppointmentList);
        }
Beispiel #14
0
 private void DoGetAppointments(int employeeID, AppointmentList appointments)
 {
     if (OnGetAppointments != null)
     {
         OnGetAppointments(this, employeeID, appointments);
     }
 }
Beispiel #15
0
        private void ok_Click(object sender, EventArgs e)
        {
            if (textBoxMrn.Text.Length == 0)
            {
                MessageBox.Show(PleaseEnterAMedicalRecordNumberToAddAnAppointment);
                return;
            }
            if (!_init)
            {
                _init = true;

                this.Enabled = false;

                this._appointment.MRN = this.textBoxMrn.Text;
                this._appointment.Load();

                AddAppointmentView view;
                if (this._appointment.apptid.HasValue)
                {
                    AppointmentList appts = new AppointmentList();
                    appts.LoadFullList();
                    appts.LoadList();

                    Appointment goldenAppointment = appts.First(appt => appt.apptID == this._appointment.apptid);

                    view = new AddAppointmentView(goldenAppointment, this._clinicId, AddAppointmentView.Mode.Copy);
                }
                else
                {
                    view = new AddAppointmentView(this._appointment.MRN, this._clinicId);
                }
                view.ShowDialog();
                this.Close();
            }
        }
        public override void Refresh()
        {
            if (this.DesignMode)
            {
                return;
            }
            this.Date         = Fwk.HelperFunctions.DateFunctions.GetStartDateTime(this.Date);
            _TimespamViewList = Get_ArrayOfTimes();


            TimespamView wTimespamView = null;

            if (AppointmentList != null)
            {
                //Recorrer todos los turnos a partir de Date
                foreach (AppointmentBE a in AppointmentList.Where <AppointmentBE>(p => DateFunctions.GetStartDateTime(p.Start.Value).Equals(this.Date) &&
                                                                                  !p.IsExceptional))

                {
                    TimeSpan t = a.TimeStart_timesp;
                    //Este cilo permite pintar Varios appointments como uno solo
                    //El caso se da cuando el usuario selecciona varios concecutivos y los asigna a un TURNO. Por lo tanto se crea un
                    //solo Appoiment en la bace de datos donde TimeStart_timesp y TimeEnd_timesp incluira todos los turnos seleccionados
                    while (true)
                    {
                        //Creo ej: 10:15 para buscarlo dentro de los TimesView de la Grilla
                        string wTimeStart = String.Concat(t.ToString("hh"), ":", t.ToString("mm"));
                        wTimespamView = _TimespamViewList.Where <TimespamView>(p => p.TimeString.Equals(wTimeStart)).FirstOrDefault <TimespamView>();

                        if (wTimespamView != null)
                        {
                            wTimespamView.Appointment = a;
                        }
                        t = t.Add(TimeSpan.FromMinutes(a.Duration.Value));
                        //Revisar que pasa si t > a.TimeEnd_timesp
                        if (t >= a.TimeEnd_timesp)
                        {
                            break;
                        }
                    }
                }
            }

            #region sobreturnos
            //Si existen sobreturnos agregarlos al la lista de timelines
            var sobreturnos = AppointmentList.Where <AppointmentBE>(p => p.IsExceptional);

            Insert_Sobreturnos(sobreturnos.ToList());
            #endregion

            _TimespamViewList.Sort(new TimeSpanComparer());
            //_TimespamViewList = _TimespamViewList.OrderBy(p => p.Time).ToList<TimespamView>();
            timespamViewBindingSource.DataSource = _TimespamViewList;


            gridControl2.RefreshDataSource();
            gridView2.RefreshData();
            base.Refresh();
        }
Beispiel #17
0
        private void WriteToXML(AppointmentList myList)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(AppointmentList));
            TextWriter    writer     = new StreamWriter("appointments.xml");

            serializer.Serialize(writer, myList);
            writer.Close();
        }
Beispiel #18
0
 public void SaveService(AppointmentList dispensaryServices)
 {
     using (var context = new CBContext())
     {
         context.AppointmentList.Add(dispensaryServices);
         context.SaveChanges();
     }
 }
Beispiel #19
0
 public void Update(AppointmentList appointmentList)
 {
     using (var context = new CBContext())
     {
         context.Entry(appointmentList).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Beispiel #20
0
 public void DeleteProduct(AppointmentList product)
 {
     using (var context = new CBContext())
     {
         context.Entry(product).State = System.Data.Entity.EntityState.Deleted;
         //context.catagories.Remove(catagory);
         context.SaveChanges();
     }
 }
Beispiel #21
0
        public void WriteToXMLFile(AppointmentList appointmentList)
        {
            XmlSerializer mySerializer =
                new XmlSerializer(typeof(AppointmentList));
            TextWriter myWriter = new StreamWriter("AppointmentList.xml");

            mySerializer.Serialize(myWriter, appointmentList);
            myWriter.Close();
        }
        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);
            }
        }
 public ViewAppointmentsVM()
 {
     // try
     // {
     ApptList = new AppointmentList();
     //  }
     // catch (Exception ex)
     // {
     //     MessageBox.Show(ex.Message);
     // }
 }
Beispiel #24
0
        public AppointmentList ReadFromXMLFile()
        {
            AppointmentList appointmentList = null;
            string          path            = "AppointmentList.xml";
            XmlSerializer   serializer      = new XmlSerializer(typeof(AppointmentList));
            StreamReader    reader          = new StreamReader(path);

            appointmentList = (AppointmentList)serializer.Deserialize(reader);
            reader.Close();
            return(appointmentList);
        }
Beispiel #25
0
        private void ReadFromXML()
        {
            XmlSerializer serializer = new XmlSerializer(typeof(AppointmentList));

            if (File.Exists("appointments.xml"))
            {
                TextReader tr = new StreamReader("appointments.xml");
                saveList = (AppointmentList)serializer.Deserialize(tr);
                tr.Close();
            }
        }
Beispiel #26
0
 private void BtnShow_Click(object sender, RoutedEventArgs e)
 {
     myList          = new AppointmentList();
     txtDisplay.Text = "";
     ReadFile();
     myList.Sort();
     foreach (Client c in myList)
     {
         txtDisplay.Text += (c.ToString());
     }
 }
Beispiel #27
0
        public ActionResult ShowAppointment(int id, int year, int month, int day)
        {
            var date = new DateTime(year, month, day);
            IEnumerable <Appointment> appointments = Get <IAttendingDoctorService>().GetAppointmentForDoctorByDate(id, date);
            var form = new AppointmentList {
                Appointments = appointments
            };

            ViewBag.Date     = date;
            ViewBag.DoctorId = id;
            return(View("ShowAppointment", form));
        }
Beispiel #28
0
        protected virtual void OnResolveAppointments(ResolveAppointmentsEventArgs args)
        {
            System.Diagnostics.Debug.WriteLine("Resolve app");

            if (ResolveAppointments != null)
            {
                ResolveAppointments(this, args);
            }

            this.allDayEventsHeaderHeight = 0;

            // cache resolved appointments in hashtable by days.
            cachedAppointments.Clear();

            if ((selectedAppointmentIsNew) && (selectedAppointment != null))
            {
                if ((selectedAppointment.StartDate > args.StartDate) && (selectedAppointment.StartDate < args.EndDate))
                {
                    args.Appointments.Add(selectedAppointment);
                }
            }

            foreach (Appointment appointment in args.Appointments)
            {
                int             key = -1;
                AppointmentList list;

                if (appointment.StartDate.Day == appointment.EndDate.Day)
                {
                    key = appointment.StartDate.Day;
                }
                else
                {
                    // use -1 for exceeding one more than day
                    key = -1;

                    /* ALL DAY EVENTS IS NOT COMPLETE
                     * this.allDayEventsHeaderHeight += horizontalAppointmentHeight;
                     */
                }

                list = (AppointmentList)cachedAppointments[key];

                if (list == null)
                {
                    list = new AppointmentList();
                    cachedAppointments[key] = list;
                }

                list.Add(appointment);
            }
        }
        protected void ScheduleList_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
        {
            if (e.Container.Mode == SchedulerFormMode.Insert)
            {
                RadDropDownList tempActivityList = (RadDropDownList)e.Container.FindControl("ActivityList");
                tempActivityList.Items.Clear();

                var activitylist = GetActivityList();

                foreach (var item in activitylist)
                {
                    tempActivityList.Items.Add(new DropDownListItem {
                        Text = $"{item.VolunteerFullName} ({item.ActivityName})", Value = item.Id.ToString()
                    });
                }
            }

            if (e.Container.Mode == SchedulerFormMode.Edit)
            {
                RadDropDownList tempActivityList = (RadDropDownList)e.Container.FindControl("ActivityList");
                tempActivityList.Items.Clear();

                var activitylist = GetActivityList();

                foreach (var item in activitylist)
                {
                    tempActivityList.Items.Add(new DropDownListItem {
                        Text = $"{item.VolunteerFullName} ({item.ActivityName})", Value = item.Id.ToString()
                    });
                }

                var selectedAppointment = AppointmentList.Single(p => p.ID == e.Appointment.ID.ToString());

                if (selectedAppointment != null)
                {
                    var projectDetailActivity = selectedAppointment.Resources.SingleOrDefault(p => p.Key.ToString() == "ProjectDetailActivityId");

                    if (projectDetailActivity != null)
                    {
                        tempActivityList.SelectedValue = projectDetailActivity.Text;
                    }
                }

                RadTimePicker tempStartTime = (RadTimePicker)e.Container.FindControl("StartTime");
                tempStartTime.SelectedTime = new TimeSpan(e.Container.Appointment.Start.Hour, e.Container.Appointment.Start.Minute, e.Container.Appointment.Start.Second);

                RadTimePicker tempEndTime = (RadTimePicker)e.Container.FindControl("EndTime");
                tempEndTime.SelectedTime = new TimeSpan(e.Container.Appointment.End.Hour, e.Container.Appointment.End.Minute, e.Container.Appointment.End.Second);
            }
        }
Beispiel #30
0
        public static void UpdateAppoimentStatus(AppointmentList appointments)
        {
            UpdateAppointmentStatusReq req = new UpdateAppointmentStatusReq();

            req.BusinessData = appointments;
            req.ContextInformation.UserId = frmBase_TabForm.IndentityUserInfo.ProviderId.ToString();
            req.ContextInformation.AppId  = Controller.CurrentHealthInstitution.HealthInstitutionId.ToString();

            UpdateAppointmentStatusRes res = req.ExecuteService <UpdateAppointmentStatusReq, UpdateAppointmentStatusRes>(req);

            if (res.Error != null)
            {
                throw Fwk.Exceptions.ExceptionHelper.ProcessException(res.Error);
            }
        }
Beispiel #31
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;
        }
Beispiel #32
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;
        }
Beispiel #33
0
        public static void Create_Appointments(AppointmentList appointmentList, Guid userId)
        {
            Appointment a = null;
            DateTime creationDate = System.DateTime.Now;

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {

                foreach (AppointmentBE abe in appointmentList)
                {
                    a = new Appointment();
                    a.ProfesionalAppointment = new ProfesionalAppointment();
                    a.CreationDate = creationDate;
                    
                    a.CreationUserId = userId;
                    a.Description = abe.Description;
                    a.Duration = abe.Duration;
                    a.Start = abe.Start;
                    a.End = abe.End;
                    
                    a.ResourceId = abe.ResourceId;
                    a.HealthInstitutionId = abe.HealthInstitutionId;
                    a.ProfesionalAppointment.PatientId = abe.ProfesionalAppointment.PatientId;
                    a.ProfesionalAppointment.PatientName = abe.ProfesionalAppointment.PatientName;
                    a.ProfesionalAppointment.IdMotivoConsulta = abe.ProfesionalAppointment.IdMotivoConsulta;
                    a.ProfesionalAppointment.RoomId = abe.ProfesionalAppointment.RoomId;
                    a.Location = abe.Location;
                    a.Status = abe.Status;
                    a.Label = abe.Label;
                    a.Subject = abe.Subject;


                    a.WeekDays = abe.WeekDays;
                    a.WeekOfMonth = abe.WeekOfMonth;
                    a.IsExceptional = abe.IsExceptional;
                    dc.Appointments.AddObject(a);
                }
                dc.SaveChanges();
            }
          
        }
Beispiel #34
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;
        }
Beispiel #35
0
 public static void UpdateAppoimentStatus(AppointmentBE appointment)
 {
     AppointmentList wAppointmentList = new AppointmentList();
     wAppointmentList.Add(appointment);
     UpdateAppoiment(wAppointmentList);
 }
Beispiel #36
0
        public static void UpdateAppoimentStatus(AppointmentList appointments)
        {
            UpdateAppointmentStatusReq req = new UpdateAppointmentStatusReq();

            req.BusinessData = appointments;
            req.ContextInformation.UserId = frmBase_TabForm.IndentityUserInfo.ProviderId.ToString();
            req.ContextInformation.AppId = Controller.CurrentHealthInstitution.HealthInstitutionId.ToString();

            UpdateAppointmentStatusRes res = req.ExecuteService<UpdateAppointmentStatusReq, UpdateAppointmentStatusRes>(req);

            if (res.Error != null)
                throw Fwk.Exceptions.ExceptionHelper.ProcessException(res.Error);
        }
Beispiel #37
0
        /// <summary>
        /// Actualiza un AppointmentList. El userId Viene de la context info del requets del servicio
        /// La UpdatedDate se crea en este método
        /// </summary>
        /// <param name="appointmentList">Lista de appointments</param>
        /// <param name="userId">El userId Viene de la context info del requets del servicio</param>
        public static void Update_Appointments(AppointmentList appointmentList, Guid userId)
        {
            DateTime updatedDate = System.DateTime.Now;

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {

                foreach (AppointmentBE abe in appointmentList)
                {
                    var appointment_db = dc.Appointments.Where<Appointment>(p => p.AppointmentId.Equals(abe.AppointmentId)).FirstOrDefault(); 
                    
                    appointment_db.UpdatedDate = updatedDate;
                    appointment_db.UpdateUserId = userId;
                    appointment_db.Description = abe.Description;
                    appointment_db.Location = abe.Location;
                    appointment_db.Status = abe.Status;
                    appointment_db.Label = abe.Label;
                    appointment_db.Subject = abe.Subject;
                }
                dc.SaveChanges();
            }
        }
        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();
        }
        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);
            }
        }
Beispiel #40
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();
        }
Beispiel #41
0
        public static void CreateAppointments(AppointmentList list)
        {
            CreateAppointmentsReq req = new CreateAppointmentsReq();

            req.BusinessData = list;
            req.ContextInformation.UserId = frmBase_TabForm.IndentityUserInfo.ProviderId.ToString();
            req.ContextInformation.AppId = ServiceCalls.CurrentHealthInstitution.HealthInstitutionId.ToString();

            CreateAppointmentsRes res = req.ExecuteService<CreateAppointmentsReq, CreateAppointmentsRes>(req);


            if (res.Error != null)
                throw Fwk.Exceptions.ExceptionHelper.ProcessException(res.Error);

        }