Ejemplo n.º 1
0
        /// <summary>
        /// Solo establece clave y nombre de usuario . Los demas valores se establecen por propiedad : Ej AuthenticationMode, IsEnvironmentUser, Titulo etc etc.
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        public void InitCredentials(FwkSimpleStorageBase <ClientUserSettings> storage)
        {
            if (storage.StorageObject == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(storage.StorageObject.Password))
            {
                txtPassword.Text = storage.StorageObject.Password;
            }
            if (!string.IsNullOrEmpty(storage.StorageObject.User))
            {
                txtUserName.Text = storage.StorageObject.User;
            }

            if (!string.IsNullOrEmpty(storage.StorageObject.HealthInstitutionName) && storage.StorageObject.HealthInstitutionId.HasValue)
            {
                txtIsnttitucion.Text = storage.StorageObject.HealthInstitutionName;
                try
                {
                    HealthInst = ServiceCalls.GetHealthInstitutionById(storage.StorageObject.HealthInstitutionId.Value);
                }
                catch (Exception ex)
                {
                    btnFind.Enabled           = false;
                    btnCheckAuth.Enabled      = false;
                    btnChangePassword.Enabled = false;
                    aceptCancelButtonBar1.AceptButtonEnabled = false;
                    btnCheckAuth.Enabled = false;
                    txtError.Height      = 200;
                    txtError.Visible     = true;
                    this.Height          = this.Height + 200;
                    if (ex.InnerException != null)
                    {
                        txtError.Text = String.Concat(ex.Message, "\r\n", ex.InnerException.Message);
                    }
                    else
                    {
                        txtError.Text = ex.Message;
                    }
                }
            }
        }