/// <summary> /// Crea o actualiza informacion del profeional /// </summary> /// <returns></returns> internal bool CreateOrUpdate() { User wUser = null; if (uc_Persona1.HasErrors()) { xtraTabControl1.SelectedTabPage = xtraTabPage1; return(false); } if (HasErrors()) { return(false); } try { uc_Persona1.SetPersona(); uc_MedioContacto1.SetPersona(); profesionalBE.Persona = uc_Persona1.Persona; profesionalBE.Matricula = this.txtMatricula.Text; profesionalBE.IdEspecialidad = (int)this.cmbEspecialidad.EditValue; profesionalBE.IdProfesion = (int)this.cmbProfecion.EditValue; if (State == Fwk.Bases.EntityUpdateEnum.NEW) { wUser = new User(); wUser.UserName = txtUsername.Text; wUser.Password = txtPassword.Text.Trim(); wUser.IsApproved = true; wUser.IsLockedOut = false; List <String> wNewRolList = GetCheckedRolList(); wUser.Roles = wNewRolList.ToArray(); ServiceCalls.CrearProfesional(profesionalBE, wUser); if (resourceSchedulingList != null && resourceSchedulingList.Count != 0) { ServiceCalls.CreateResourceScheduling(resourceSchedulingList, ServiceCalls.CurrentHealthInstitution.HealthInstitutionId); } this.MessageViewer.Show(String.Format("{0}, se creo con exito", profesionalBE.Persona.ApellidoNombre.Trim())); } if (State == Fwk.Bases.EntityUpdateEnum.UPDATED) { if (CheckRolesChanged()) { wUser = new User(); wUser.UserName = txtUsername.Text; wUser.ProviderId = profesionalBE.Persona.UserId; wUser.Roles = GetCheckedRolList().ToArray(); } ServiceCalls.UpdateProfesional(profesionalBE, wUser, ServiceCalls.CurrentHealthInstitution.HealthInstitutionId); //La lista de las posibles actualizaciones no se envian en este metodo ya que se actualizan automaticamente cuando se trata de un Patient en state = UPDATED var varlist = resourceSchedulingList.Where(p => p.EntityState.Equals(Fwk.Bases.EntityState.Added)).ToList <ResourceSchedulingBE>(); ResourceSchedulingList list = new ResourceSchedulingList(); list.AddRange(varlist); if (list.Count != 0) { ServiceCalls.CreateResourceScheduling(list, ServiceCalls.CurrentHealthInstitution.HealthInstitutionId); } this.MessageViewer.Show(String.Format("{0}, se actualizó con exito", profesionalBE.Persona.ApellidoNombre.Trim())); } } catch (Exception ex) { this.ExceptionViewer.Show(ex); return(false); } return(true); }