Exemplo n.º 1
0
        /// <summary>
        ///
        /// Almacen del Appoiment
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void asignarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (frmShiftAppointment frm = new frmShiftAppointment())
            {
                AppointmentBE app = new AppointmentBE();
                frm.Profesional         = profesional;
                frm.State               = Fwk.Bases.EntityUpdateEnum.NEW;
                app.Status              = (int)AppoimantsStatus_SP.Reservado;
                app.ResourceId          = profesional.IdProfesional;
                app.HealthInstitutionId = Controller.CurrentHealthInstitution.HealthInstitutionId;

                DateTime            date = Fwk.HelperFunctions.DateFunctions.GetStartDateTime(this.Date);
                List <TimespamView> wTimespamViewList = null;
                try
                {
                    wTimespamViewList = GetSelectedShifts();
                }
                catch (Exception ex)
                {
                    this.ExceptionViewer.Show(ex);
                    return;
                }
                app.Start    = date.Add(wTimespamViewList[0].Time);
                app.Duration = wTimespamViewList[0].Duration;
                if (wTimespamViewList.Count > 1)
                {
                    app.End = date.Add(wTimespamViewList[wTimespamViewList.Count - 1].Time);
                }
                else
                {
                    app.End = date.Add(wTimespamViewList[0].Time).AddMinutes(wTimespamViewList[0].Duration);
                }

                frm.currentApt = app;
                frm.Refresh();
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    ///todo: analizar como crear grupos de turnos
                    foreach (TimespamView timeView in wTimespamViewList)
                    {
                        timeView.Appointment = app;
                    }
                    try
                    {
                        Controller.CreateAppointments(app);
                        if (OnCreateAppoimentsEvent != null)
                        {
                            OnCreateAppoimentsEvent(app, new EventArgs());
                        }
                    }

                    catch (Exception ex)
                    {
                        this.ExceptionViewer.Show(ex);
                    }
                    gridControl2.RefreshDataSource();
                    gridView2.RefreshData();
                }
            }
        }
        public frmPatientAtencion(AppointmentBE pAppointmentBE)
        {
            _Appointment = pAppointmentBE;
            InitializeComponent();

           
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
        public static void UpdateAppoimentStatus(AppointmentBE appointment)
        {
            AppointmentList wAppointmentList = new AppointmentList();

            wAppointmentList.Add(appointment);
            UpdateAppoiment(wAppointmentList);
        }
Exemplo n.º 5
0
        public static void CreateAppointments(AppointmentBE app)
        {
            AppointmentList l = new BE.AppointmentList();

            l.Add(app);
            CreateAppointments(l);
        }
Exemplo n.º 6
0
 private void uc_AllShiftGrid1_ChangeStatusEvent(object sender, EventArgs e)
 {
     if (((AppoimantsStatus_SP)sender) == AppoimantsStatus_SP.EnAtencion)
     {
         this.Appointment = this.uc_TimeLine1.SelectedAppointment;
         GetPatientRes res = ServiceCalls.GetPatient(this.Appointment.ProfesionalAppointment.PatientId);
         this.Patient      = res.BusinessData.Patient;
         this.DialogResult = System.Windows.Forms.DialogResult.OK;
         this.Close();
     }
 }
Exemplo n.º 7
0
        private void uc_AllShiftGrid1_ChangeStatusEvent(object sender, EventArgs e)
        {
            if (((AppoimantsStatus_SP)sender) == AppoimantsStatus_SP.EnAtencion)
            {
                this.Appointment = this.uc_TimeLine1.SelectedAppointment;
                GetPatientRes res = ServiceCalls.GetPatient(this.Appointment.ProfesionalAppointment.PatientId);
                this.Patient = res.BusinessData.Patient;
                this.DialogResult = System.Windows.Forms.DialogResult.OK;
                this.Close();
            }

        }
Exemplo n.º 8
0
        private void m_sobreturnoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (frmShiftAppointment frm = new frmShiftAppointment())
            {
                AppoimantsStatus_SP_type status = (AppoimantsStatus_SP_type)m_sobreturnoToolStripMenuItem.Tag;

                AppointmentBE app = SelectedTimespamView.Appointment.Clone <AppointmentBE>();
                app.Subject       = string.Concat(Enum.GetName(typeof(AppoimantsStatus_SP_type), status), " a las : ", SelectedTimespamView.Appointment.TimeEnd);
                app.Status        = (int)AppoimantsStatus_SP.Reservado;
                app.IsExceptional = true;

                frm.Profesional = profesional;
                frm.State       = Fwk.Bases.EntityUpdateEnum.NEW;

                app.ResourceId          = profesional.IdProfesional;
                app.HealthInstitutionId = Controller.CurrentHealthInstitution.HealthInstitutionId;
                app.CreationDate        = System.DateTime.Now;
                //DateTime date = Fwk.HelperFunctions.DateFunctions.GetStartDateTime(this.Date);
                //List<TimespamView> wTimespamViewList = null;

                //app.Start = date.Add(wTimespamViewList[0].Time);
                //app.Duration = wTimespamViewList[0].Duration;
                //if (wTimespamViewList.Count > 1)
                //    app.End = date.Add(wTimespamViewList[wTimespamViewList.Count - 1].Time);
                //else
                //    app.End = date.Add(wTimespamViewList[0].Time).AddMinutes(wTimespamViewList[0].Duration);

                frm.currentApt = app;
                frm.Refresh();
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        Controller.CreateAppointments(app);
                        if (OnCreateAppoimentsEvent != null)
                        {
                            OnCreateAppoimentsEvent(app, new EventArgs());
                        }
                    }

                    catch (Exception ex)
                    {
                        this.ExceptionViewer.Show(ex);
                    }
                    //gridControl2.RefreshDataSource();
                    //gridView2.RefreshData();
                }
            }
            Refresh();
            //UpdateStatus((AppoimantsStatus_SP)m_sobreturnoToolStripMenuItem.Tag);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Retorna wAppointmentBE por appointmentId
        /// </summary>
        /// <param name="appointmentId">appointmentId</param>
        /// <returns></returns>
        public static AppointmentBE Get_Appointment_By_Id(int appointmentId)
        {
            AppointmentBE wAppointmentBE = null;

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Appointment appointment_db = dc.Appointments.Where <Appointment>(p => p.AppointmentId.Equals(appointmentId)).FirstOrDefault <Appointment>();
                if (appointment_db != null)
                {
                    wAppointmentBE = new AppointmentBE(appointment_db);
                }
            }
            return(wAppointmentBE);
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
0
        private void gridView2_MouseDown(object sender, MouseEventArgs e)
        {


            _HitInfo = gridView2.CalcHitInfo(new Point(e.X, e.Y));
            SelectedAppointment = ((AppointmentBE)gridView2.GetRow(_HitInfo.RowHandle));
            if (SelectedAppointment == null) return;
            if (e.Button != System.Windows.Forms.MouseButtons.Right) return;

            if (SelectedAppointment == null)
            {
                m_atenderToolStripMenuItem.Enabled = false;
                m_cerrarTurnoToolStripMenuItem.Enabled = false;
                m_SetCanceled.Enabled = false;
                return;
            }

            if (gridView2.SelectedRowsCount > 1)
            {
                m_atenderToolStripMenuItem.Enabled = false;
                m_SetCanceled.Enabled = false;
                m_cerrarTurnoToolStripMenuItem.Enabled = false;
            }
            else
            {
                if (SelectedAppointment.Status == (int)AppoimantsStatus_SP.Expirado)
                {
                    m_atenderToolStripMenuItem.Enabled = false;
                    m_enEsperaToolStripMenuItem.Enabled = false;
                    m_SetCanceled.Enabled = false;
                    m_cerrarTurnoToolStripMenuItem.Enabled = false;
                    return;
                }
                if (SelectedAppointment.Status == (int)AppoimantsStatus_SP.Reservado)
                {
                    m_atenderToolStripMenuItem.Enabled = true;
                    m_enEsperaToolStripMenuItem.Enabled = true;
                    m_SetCanceled.Enabled = true;
                    m_cerrarTurnoToolStripMenuItem.Enabled = false;
                    return;
                    
                }
                if (SelectedAppointment.Status == (int)AppoimantsStatus_SP.EnAtencion)
                {
                    m_atenderToolStripMenuItem.Enabled = false;
                    m_enEsperaToolStripMenuItem.Enabled = false;
                    m_SetCanceled.Enabled = false;
                    m_cerrarTurnoToolStripMenuItem.Enabled = true;
                    
                    return;
                }
                if (SelectedAppointment.Status == (int)AppoimantsStatus_SP.Cerrado)
                {

                    m_atenderToolStripMenuItem.Enabled = false;
                    m_enEsperaToolStripMenuItem.Enabled = false;
                    m_SetCanceled.Enabled = false;
                    m_cerrarTurnoToolStripMenuItem.Enabled = false;
                    return;
                }
                if (SelectedAppointment.Status == (int)AppoimantsStatus_SP.Cancelado)
                {
                    m_atenderToolStripMenuItem.Enabled = true;
                    m_enEsperaToolStripMenuItem.Enabled = true;
                    m_SetCanceled.Enabled = false;
                    m_cerrarTurnoToolStripMenuItem.Enabled = false;
                    
                    return;
                }
            }
        }
Exemplo n.º 13
0
 public static void CreateAppointments(AppointmentBE app)
 {
     AppointmentList l = new BE.AppointmentList();
     l.Add(app);
     CreateAppointments(l);
 }
Exemplo n.º 14
0
 public static void UpdateAppoimentStatus(AppointmentBE appointment)
 {
     AppointmentList wAppointmentList = new AppointmentList();
     wAppointmentList.Add(appointment);
     UpdateAppoiment(wAppointmentList);
 }
Exemplo n.º 15
0
        private void gridView2_MouseDown(object sender, MouseEventArgs e)
        {
            _HitInfo            = gridView2.CalcHitInfo(new Point(e.X, e.Y));
            SelectedAppointment = ((AppointmentBE)gridView2.GetRow(_HitInfo.RowHandle));
            if (SelectedAppointment == null)
            {
                return;
            }
            if (e.Button != System.Windows.Forms.MouseButtons.Right)
            {
                return;
            }

            if (SelectedAppointment == null)
            {
                m_atenderToolStripMenuItem.Enabled     = false;
                m_cerrarTurnoToolStripMenuItem.Enabled = false;
                m_SetCanceled.Enabled = false;
                return;
            }

            if (gridView2.SelectedRowsCount > 1)
            {
                m_atenderToolStripMenuItem.Enabled = false;
                m_SetCanceled.Enabled = false;
                m_cerrarTurnoToolStripMenuItem.Enabled = false;
            }
            else
            {
                if (SelectedAppointment.Status == (int)AppoimantsStatus_SP.Expirado)
                {
                    m_atenderToolStripMenuItem.Enabled  = false;
                    m_enEsperaToolStripMenuItem.Enabled = false;
                    m_SetCanceled.Enabled = false;
                    m_cerrarTurnoToolStripMenuItem.Enabled = false;
                    return;
                }
                if (SelectedAppointment.Status == (int)AppoimantsStatus_SP.Reservado)
                {
                    m_atenderToolStripMenuItem.Enabled  = true;
                    m_enEsperaToolStripMenuItem.Enabled = true;
                    m_SetCanceled.Enabled = true;
                    m_cerrarTurnoToolStripMenuItem.Enabled = false;
                    return;
                }
                if (SelectedAppointment.Status == (int)AppoimantsStatus_SP.EnAtencion)
                {
                    m_atenderToolStripMenuItem.Enabled  = false;
                    m_enEsperaToolStripMenuItem.Enabled = false;
                    m_SetCanceled.Enabled = false;
                    m_cerrarTurnoToolStripMenuItem.Enabled = true;

                    return;
                }
                if (SelectedAppointment.Status == (int)AppoimantsStatus_SP.Cerrado)
                {
                    m_atenderToolStripMenuItem.Enabled  = false;
                    m_enEsperaToolStripMenuItem.Enabled = false;
                    m_SetCanceled.Enabled = false;
                    m_cerrarTurnoToolStripMenuItem.Enabled = false;
                    return;
                }
                if (SelectedAppointment.Status == (int)AppoimantsStatus_SP.Cancelado)
                {
                    m_atenderToolStripMenuItem.Enabled  = true;
                    m_enEsperaToolStripMenuItem.Enabled = true;
                    m_SetCanceled.Enabled = false;
                    m_cerrarTurnoToolStripMenuItem.Enabled = false;

                    return;
                }
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// 
        /// Almacen del Appoiment
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void asignarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (frmShiftAppointment frm = new frmShiftAppointment())
            {
                AppointmentBE app = new AppointmentBE();
                frm.Profesional = profesional;
                frm.State = Fwk.Bases.EntityUpdateEnum.NEW;
                app.Status = (int)AppoimantsStatus_SP.Reservado;
                app.ResourceId = profesional.IdProfesional;
                app.HealthInstitutionId = ServiceCalls.CurrentHealthInstitution.HealthInstitutionId;

                DateTime date = Fwk.HelperFunctions.DateFunctions.GetStartDateTime(this.Date);
                List<TimespamView> wTimespamViewList = null;
                try
                {
                    wTimespamViewList = GetSelectedShifts();
                }
                catch (Exception ex)
                {
                    this.ExceptionViewer.Show(ex);
                    return;
                }
                app.Start = date.Add(wTimespamViewList[0].Time);
                app.Duration = wTimespamViewList[0].Duration;
                if (wTimespamViewList.Count > 1)
                    app.End = date.Add(wTimespamViewList[wTimespamViewList.Count - 1].Time);
                else
                    app.End = date.Add(wTimespamViewList[0].Time).AddMinutes(wTimespamViewList[0].Duration);

                frm.currentApt = app;
                frm.Refresh();
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    ///todo: analizar como crear grupos de turnos
                    foreach (TimespamView timeView in wTimespamViewList)
                    {
                        timeView.Appointment = app;
                    }
                    try
                    {
                        ServiceCalls.CreateAppointments(app);
                        if (OnCreateAppoimentsEvent != null)
                            OnCreateAppoimentsEvent(app, new EventArgs());
                    }

                    catch (Exception ex)
                    {
                        this.ExceptionViewer.Show(ex);
                    }
                    gridControl2.RefreshDataSource();
                    gridView2.RefreshData();
                }

            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// Retorna wAppointmentBE por appointmentId
        /// </summary>
        /// <param name="appointmentId">appointmentId</param>
        /// <returns></returns>
        public static AppointmentBE Get_Appointment_By_Id(int appointmentId)
        {
            AppointmentBE wAppointmentBE = null;

            using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
            {
                Appointment appointment_db = dc.Appointments.Where<Appointment>(p => p.AppointmentId.Equals(appointmentId)).FirstOrDefault<Appointment>();
                if (appointment_db != null)
                    wAppointmentBE = new AppointmentBE(appointment_db);

            }
            return wAppointmentBE;
        }
Exemplo n.º 18
0
 public frmPatientAtencion(AppointmentBE pAppointmentBE)
 {
     _Appointment = pAppointmentBE;
     InitializeComponent();
 }