示例#1
0
        public String ConsultDateAdministrator(String initialDate, String finalDate, int process, int assistance,
                                               int office, int identification, char gender, String dateStatus, int consecutive, int age, int professional)
        {
            UserModels user = new UserModels();

            user.Cedula     = identification;
            user.Gender     = gender;
            user.OfficeID   = office;
            user.Assistance = assistance;
            AppointmentModels appointment = new AppointmentModels();

            appointment.Functionary = user;
            appointment.Id          = consecutive;
            AppointmentBusiness appointmentBusiness = new AppointmentBusiness();

            //appointmentBusiness.SearchAppointmentByFiltersAdministrator(appointment, initialDate, finalDate, process, dateStatus, age, age);
            return(JsonConvert.SerializeObject(appointmentBusiness.SearchAppointmentByFiltersAdministrator(appointment, initialDate, finalDate, process, dateStatus, age, professional)));
        }
        public string SearchAppointmentProfessional(string initialDate, string finalDate, int process, int assistance,
                                                    int office, int identification, char gender, string dateStatus, int consecutive, int age)

        {
            AppointmentModels appointment = new AppointmentModels();

            appointment.Id = consecutive;
            appointment.Functionary.Cedula          = identification;
            appointment.Functionary.Gender          = gender;
            appointment.Functionary.OfficeID        = office;
            appointment.Functionary.Assistance      = assistance;
            appointment.Professional.ProfessionalId = Int32.Parse((string)Session["Identification"]);
            appointment.SubProcess.ID = process;
            appointment.State         = dateStatus;

            AppointmentBusiness      appointmentBusiness = new AppointmentBusiness();
            List <AppointmentModels> appointmentList     = appointmentBusiness.SearchAppointmentsForProfesional(appointment, initialDate, finalDate, age);

            return(JsonConvert.SerializeObject(appointmentList));
        }
        internal async Task UpdateAppointmentsAsync()
        {
            List <Appointment> appointments = null;

            using (_controller = new AppointmentController())
                await Task.Run(() => appointments = (List <Appointment>) _controller.GetAppointments());

            if (appointments != null)
            {
                lock (_appointments)
                    lock (AppointmentModels)
                    {
                        _appointments.Clear();
                        AppointmentModels.Clear();
                        foreach (var appointment in appointments)
                        {
                            _appointments.Add(appointment);
                            AppointmentModels.Add(new AppointmentModel(appointment));
                        }
                    }
            }
        }
        //GET LIST APPOINTMENT BY FILTERS ADMI
        public List <AppointmentModels> SearchAppointmentByFiltersAdministrator(AppointmentModels _appointment, String initialDate,
                                                                                String finalDate, int process, String appointmentStatus, int age, int professional)
        {
            string sqlQuery = $"exec sp_buscar_cita_para_funcionario_admi " + _appointment.Functionary.Cedula + "," + _appointment.Id + ",'" + initialDate + "','" +
                              finalDate + "'," + process + "," + _appointment.Functionary.OfficeID + ", " + professional + ", '" + appointmentStatus + "'," + _appointment.Functionary.Assistance +
                              ", '" + _appointment.Functionary.Gender + "', " + age + " ;";
            List <AppointmentModels> appointments = new List <AppointmentModels>();

            using (SqlCommand command = new SqlCommand(sqlQuery, connection))
            {
                command.CommandType = CommandType.Text;
                command.CommandText = sqlQuery;
                connection.Open();
                SqlDataReader responseReader = command.ExecuteReader();

                while (responseReader.Read())
                {
                    AppointmentModels appointment = new AppointmentModels();
                    appointment.Id = Int32.Parse(responseReader["pk_id_cita"].ToString());
                    appointment.Functionary.Cedula         = Int32.Parse(responseReader["pk_cedula_usuario"].ToString());
                    appointment.Functionary.Name           = responseReader["tc_nombre"].ToString();
                    appointment.Functionary.FirstLastName  = responseReader["tc_primer_apellido"].ToString();
                    appointment.Functionary.SecondLastName = responseReader["tc_segundo_apellido"].ToString();
                    appointment.Date = responseReader["tf_fecha"].ToString();
                    appointment.Hour = responseReader["tc_hora"].ToString();
                    appointment.Professional.Cedula = Int32.Parse(responseReader["fk_id_profesional"].ToString());
                    appointment.SubProcess.Name     = responseReader["tc_nombre_proceso"].ToString();
                    appointment.SubActivity.Name    = responseReader["tc_nombre_actividad"].ToString();
                    appointments.Add(appointment);
                }

                connection.Close();
            }

            return(appointments);
        }
        public IcsClient(string url)
        {
            using (MemoryStream stream = new MemoryStream(Resource1.HugoCalender))
            {
                calendar = Ical.Net.Calendar.Load(stream);
            }

            foreach (var calEvent in calendar.Events)
            {
                if ((calEvent.Start.Year == DateTime.Now.Year && calEvent.RecurrenceRules.Count > 0) || calEvent.Start.Year == DateTime.Now.Year)
                {
                    IList <Ical.Net.DataTypes.Attendee> attendees = calEvent.Attendees;
                    DateTime dateStart = new DateTime(calEvent.Start.Ticks);
                    DateTime dateEnd;

                    if (calEvent.End != null)
                    {
                        dateEnd = new DateTime(calEvent.End.Ticks);
                    }
                    else
                    {
                        dateEnd = new DateTime(calEvent.Start.Ticks);
                    }

                    ScheduleAppointment appointment;

                    foreach (var a in attendees)
                    {
                        Attendee attender = new Attendee();
                        attender.Name  = a.Value.UserInfo;
                        attender.Email = a.CommonName;
                        attending.Add(attender);
                    }


                    if (calEvent.RecurrenceRules != null && calEvent.RecurrenceRules.Count != 0)
                    {
                        var    RecRule       = new List <RecurrencePattern>(calEvent.RecurrenceRules.AsEnumerable());
                        var    pattern       = RecRule.FirstOrDefault();
                        string stringPattern = pattern?.ToString();
                        var    ex            = pattern?.Frequency;
                        RecurrenceProperties recurrenceProperties = new RecurrenceProperties();
                        recurrenceProperties.RecurrenceType = (RecurrenceType)calEvent.RecurrenceRules[0].Frequency;

                        int[] dayInts = new int[pattern.ByDay.Count];

                        for (int i = 0; i < pattern.ByDay.Count; i++)
                        {
                            recurrenceProperties.WeekDays = (WeekDays)pattern.ByDay[i].DayOfWeek;
                        }

                        appointment = new ScheduleAppointment()
                        {
                            StartTime = dateStart, EndTime = dateEnd, Subject = calEvent.Summary, IsRecursive = true, RecurrenceRule = stringPattern, Location = calEvent.Location
                        };
                        AppointmentModels.Add(new AppointmentModel(new ScheduleAppointment()
                        {
                            StartTime = dateStart, EndTime = dateEnd, Subject = calEvent.Summary, IsRecursive = true, RecurrenceRule = stringPattern, Location = calEvent.Location
                        }, attending, stringPattern));
                    }
                    else
                    {
                        appointment = new ScheduleAppointment()
                        {
                            StartTime = dateStart, EndTime = dateEnd, Subject = calEvent.Summary, IsRecursive = true, Location = calEvent.Location
                        };
                        AppointmentModels.Add(new AppointmentModel(new ScheduleAppointment()
                        {
                            StartTime = dateStart, EndTime = dateEnd, Subject = calEvent.Summary, IsRecursive = true, Location = calEvent.Location
                        }, attending, null));
                    }

                    ScheduleAppointments.Add(appointment);
                }
            }
        }
示例#6
0
        public void CreateMail(AppointmentModels appointment)
        {
            CatalogueController catalogue      = new CatalogueController();
            int               process          = catalogue.GetProcessBySubprocess(appointment.SubProcess.ID);
            UserBusiness      userBusiness     = new UserBusiness();
            int               cedula           = appointment.Professional.Cedula;
            List <UserModels> professionals    = userBusiness.GetProfessionalByIdentification(cedula);
            String            nameProfessional = "";

            foreach (UserModels professional in professionals)
            {
                nameProfessional = professional.Name + " " + professional.FirstLastName + " " + professional.SecondLastName;
            }
            string email = (string)Session["email"];

            MailModels mail;
            String     message = "Su cita ha sido programada con éxito. \n " +
                                 "\n\tRESUMEN DE CITA:\n" +
                                 "Fecha: " + appointment.Date + "\n" +
                                 "Hora: " + appointment.Hour + "\n" +
                                 "Paciente: " + appointment.Functionary.Cedula + "\n" +
                                 "Psicólogo: " + nameProfessional +
                                 "\n\n Para cualquier consulta comuniquese al teléfono 2295-4181," +
                                 " al correo [email protected] o a nuestro sitio web de citas para cancelar o modificar su cita";

            switch (process)
            {
            case 1:
                mail = new MailModels("*****@*****.**", email,
                                      "ESTE CORREO ES PARA CONFIRMAR SU CITA DE PROCESO CLINICO EN SAPSO \n" + message,
                                      "CONFIRMACION CITA CLÍNICO", 0);
                break;

            case 2:
                mail = new MailModels("*****@*****.**", email,
                                      "ESTE CORREO ES PARA CONFIRMAR SU CITA DE PROCESO INCIDENTE CRÍTICO EN SAPSO\n" + message +
                                      "IMPORTANTE Complete el formulario adjunto y preséntelo el día de su cita",
                                      "CONFIRMACION CITA INCIDENTES CRITICOS", 2);
                break;

            case 3:
                mail = new MailModels("*****@*****.**", email,
                                      "ESTE CORREO ES PARA CONFIRMAR SU CITA DE PROCESO ARMAS EN SAPSO \n" + message,
                                      "CONFIRMACION DE CITA", 0);
                break;

            case 4:
                mail = new MailModels("*****@*****.**", email,
                                      "ESTE CORREO ES PARA CONFIRMAR SU CITA DE PROCESO CHARLAS EN SAPSO \n" + message,
                                      "CONFIRMACION DE CITA", 0);
                break;

            case 5:
                mail = new MailModels("*****@*****.**", email,
                                      "ESTE CORREO ES PARA CONFIRMAR SU CITA DE PROCESO CAPITULO \"V\" EN SAPSO \n" + message +
                                      "IMPORTANTE: Complete el formulario adjunto y preséntelo el día de su cita",
                                      "CONFIRMACION CITA CAPITULO V", 1);
                break;

            default:
                mail = new MailModels("*****@*****.**", email,
                                      "ESTE CORREO ES PARA CONFIRMAR SU CITA EN SAPSO \n" + message, "CONFIRMACION DE CITA", 0);
                break;
            }
            mail.SendMail();
        }
示例#7
0
        public void DeleteAppointment(AppointmentModels appointment)
        {
            AppointmentData appointmentData = new AppointmentData();

            appointmentData.DeleteAppointment(appointment);
        }
示例#8
0
        public List <AppointmentModels> getAppointmentDetail(AppointmentModels _appointment)
        {
            AppointmentData appointmentData = new AppointmentData();

            return(appointmentData.getAppointmentDetail(_appointment));
        }
示例#9
0
        public List <AppointmentModels> SearchAppointmentsForProfesional(AppointmentModels _appointment, string initialDate, string finalDate, int age)
        {
            AppointmentData appointmentData = new AppointmentData();

            return(appointmentData.SearchAppointmentsForProfesional(_appointment, initialDate, finalDate, age));
        }
示例#10
0
        public List <AppointmentModels> SearchAppointmentsForFunctionary(AppointmentModels _appointment)
        {
            AppointmentData appointmentData = new AppointmentData();

            return(appointmentData.SearchAppointmentsForFunctionary(_appointment));
        }
示例#11
0
        public void UpdateAppointment(AppointmentModels _appointment, int idAppointment)
        {
            AppointmentData appointmentData = new AppointmentData();

            appointmentData.UpdateAppointment(_appointment, idAppointment);
        }
示例#12
0
        public void RegisterAppointment(AppointmentModels _appointment)
        {
            AppointmentData appointmentData = new AppointmentData();

            appointmentData.SaveAppointment(_appointment);
        }