Exemple #1
0
        private void gridView2_DoubleClick(object sender, EventArgs e)
        {
            //Esta siendo consultado por un medico
            //if (profesional.IdProfesional != null && profesional.IdProfesion.Value.Equals((int)RubroProfesionalEnum.Medico))
            //{
            //    if (SelectedAppointment.Status == (int)AppoimantsStatus_SP.Reservado)
            //    {
            //        //Actualizar el estado a En atencion
            //        UpdateStatus(AppoimantsStatus_SP.EnAtencion);
            //    }
            //}
            //else
            //{
            if (SelectedAppointment == null)
            {
                return;
            }
            ///Ver - consultar
            using (frmShiftAppointment frm = new frmShiftAppointment())
            {
                frm.State = Fwk.Bases.EntityUpdateEnum.NONE;

                //Este caso se presenta cuando la consulta no es por medio del mismo profesional
                //sino de una secretaria que ve turnos de varios
                //profesionales
                frm.Profesional = new Profesional_FullViewBE();

                frm.AceptCancelButtonBar_Visible = false;
                if (this.profesional == null)
                {
                    //Busco el profesional
                    this.profesional = ServiceCalls.GetProfesional(SelectedAppointment.ResourceId, false, false, false).BusinessData.profesional;
                    //Relleno frm.profesional con info minima
                    frm.Profesional.Nombre             = this.profesional.Persona.Nombre;
                    frm.Profesional.Apellido           = this.profesional.Persona.Apellido;
                    frm.Profesional.IdEspecialidad     = this.profesional.IdEspecialidad;
                    frm.Profesional.NombreEspecialidad = this.profesional.NombreEspecialidad;
                    frm.Profesional.IdProfesion        = this.profesional.IdProfesion;
                }
                else
                {
                    frm.Profesional.Nombre             = this.profesional.Persona.Nombre;
                    frm.Profesional.Apellido           = this.profesional.Persona.Apellido;
                    frm.Profesional.IdEspecialidad     = this.profesional.IdEspecialidad;
                    frm.Profesional.NombreEspecialidad = this.profesional.NombreEspecialidad;
                    frm.Profesional.IdProfesion        = this.profesional.IdProfesion;
                }


                frm.currentApt = SelectedAppointment;
                frm.Refresh();
                frm.ShowDialog();
            }
            //}
        }
        /// <summary>
        /// Se produce despues de Load (uc_Profesionales_Card_Load) y
        /// Antes del load del formujlario
        /// </summary>
        /// <param name="idProfesional"></param>
        /// <param name="state"></param>
        internal void Populate(int idProfesional, EntityUpdateEnum state)
        {
            //El prof puede modificar sus propios datos
            if (idProfesional.Equals(ServiceCalls.CurrentProfesional.IdProfesional))
            {
                uc_MedioContacto1.Enabled = panelControl2.Enabled = uc_Persona1.Enabled = true;
            }

            this.State = state;
            if (State == Fwk.Bases.EntityUpdateEnum.NEW)
            {
                profesionalBE         = new ProfesionalBE();
                profesionalBE.Persona = new PersonaBE();
                this.lblTitle.Text    = "Alta de profesional";
            }

            if (State == Fwk.Bases.EntityUpdateEnum.UPDATED || State == Fwk.Bases.EntityUpdateEnum.NONE)
            {
                btnCheckUserName.Enabled        = false;
                txtUsername.Properties.ReadOnly = true;
                GetProfesionalRes res = ServiceCalls.GetProfesional(idProfesional, true, true, false, null, ServiceCalls.CurrentHealthInstitution.HealthInstitutionId);

                profesionalBE          = res.BusinessData.profesional;
                resourceSchedulingList = res.BusinessData.ResourceSchedulerList;
                profesionalRolList     = res.BusinessData.User.Roles;

                this.lblTitle.Text = String.Concat("Targeta del profesional", "  ", profesionalBE.Persona.ApellidoNombre);
            }

            uc_Persona1.Populate(profesionalBE.Persona, State);
            txtUsername.Text  = profesionalBE.UserName;
            txtMatricula.Text = profesionalBE.Matricula;
            schedulerShiftBindingSource.DataSource = resourceSchedulingList;
            gridView1.RefreshData();


            //cmbEspecialidad.Properties.DataSource = _EspecialidadList.Where(p => p.IdParametroRef.Equals(profesionalBE.IdProfesion));

            int index = 0;

            index = cmbEspecialidad.Properties.GetDataSourceRowIndex("IdParametro", (int)CommonValuesEnum.Ninguno);
            if (State == Fwk.Bases.EntityUpdateEnum.NEW)
            {
                cmbEspecialidad.ItemIndex = index;
                cmbProfecion.ItemIndex    = 0;
            }
            else
            {
                if (profesionalBE.IdEspecialidad.HasValue)
                {
                    index = cmbEspecialidad.Properties.GetDataSourceRowIndex("IdParametro", profesionalBE.IdEspecialidad);
                }
                cmbEspecialidad.ItemIndex = index;

                index = cmbProfecion.Properties.GetDataSourceRowIndex("IdParametro", profesionalBE.IdProfesion);
                cmbProfecion.ItemIndex = index;
            }

            cmbEspecialidad.Refresh();
            cmbProfecion.Refresh();

            MachRolesGrid(profesionalRolList);



            uc_MedioContacto1.Persona = profesionalBE.Persona;
            uc_Persona1.Refresh();
            uc_MedioContacto1.Init();
            this.cmbProfecion.EditValueChanged += new System.EventHandler(this.cmbProfecion_EditValueChanged);
        }
Exemple #3
0
        /// <summary>
        /// Método que se va a ejecutar al hacer click en el botón "Aceptar" o en "Cambiar Clave"
        /// </summary>
        /// <param name="pChangePassword">Parámetro que determina si se hizo click o no en Cambiar clave</param>
        /// <returns></returns>
        private bool AcceptForm(bool pChangePassword)
        {
            try
            {
                //Validamos si los ErrorProviders tienen error
                if (!dxErrorProvider1.HasErrors && ValidateValues())
                {
                    //Autenticamos el usuario
                    AuthenticateUser();


                    //Validamos si el usuario Debe cambiar el password o si presionó el botón "Cambiar Clave"
                    if (!ValidateChangePassword(pChangePassword))
                    {
                        return(false);
                    }

                    if (HealthInst == null)
                    {
                        MessageBox.Show("Selecione una institución donde iniciar sesión");
                        return(false);
                    }
                    Guid guid = Guid.Parse(frmBase_TabForm.IndentityUserInfo.ProviderId.ToString());
                    //Validamos Profesional Vs HealthInstitution
                    AuthHealthInstitutionRes resAtuh = ServiceCalls.AuthHealthInstitution(HealthInst.HealthInstitutionId, null, guid);

                    if (resAtuh.BusinessData.Authenticated)
                    {
                        GetProfesionalRes resProf = ServiceCalls.GetProfesional(null, false, true, true, guid, HealthInst.HealthInstitutionId);
                        ServiceCalls.CurrentProfesional = resProf.BusinessData.profesional;
                        ServiceCalls.CurrentHealthInstitution_Profesional = resProf.BusinessData.HealthInstitution_Profesional;
                        ServiceCalls.CurrentHealthInstitution             = HealthInst;
                        FormBase.IndentityUserInfo.Roles = resProf.BusinessData.User.Roles;
                    }
                    else
                    {
                        this.MessageViewer.Title = "Mensaje de seguridad";
                        this.MessageViewer.Show(resAtuh.BusinessData.Message);
                        return(false);
                    }

                    //Validamos si el usuario posee Roles y el InitAuthorizationFactory
                    //Esta validacion se realiza aqui por que si se trata de usuarios Profesionales vinculados a Instituciones los roles se obtienen en base al Profesional y usuario
                    // No solo con el User de ASPNET
                    if (!ValidateRoles() || !FormBaseInitAuthorizationFactory())
                    {
                        return(false);
                    }


                    //Si pasa todas las validaciones establecemos el DialogResult en OK y devolvemos true
                    this.DialogResult = DialogResult.OK;
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Fwk.Exceptions.FunctionalException funcionalEx)
            {
                this.MessageViewer.Title = "Mensaje de seguridad";
                this.MessageViewer.Show(funcionalEx);
                return(false);
            }
            catch (Exception ex)
            {
                this.MessageViewer.Title = "Mensaje de seguridad";
                this.ExceptionViewer.Show(ex);
                return(false);
            }
        }