Exemplo n.º 1
0
        private void BtnUsuario_Click(object sender, EventArgs e)
        {
            if (TxtIdPessoa.Text == "")
            {
                Geral.Erro("Cadestre a pessoa para cadastrar os dados de usuário!");
                return;
            }

            if (BD.AcessoLiberado("Acessar dados de usuário") == false)
            {
                return;
            }

            //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
            //{

            //    //Geral.Erro("Você não tem permissão para este acesso!");
            //    //aula 25
            //    FrmLiberaPermissao frm = new FrmLiberaPermissao();
            //    frm.ShowDialog();
            //}
            //else
            //{
            MudarPanel(1);
            TxtLogin.Focus();
            PegarUsuario();
            //}
        }
Exemplo n.º 2
0
        private async void Btn_acessar_Clicked(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(TxtLogin.Text))
            {
                await DisplayAlert("Aviso", "Ops, Algo errado, campo CPF vazio.", "Ok");

                TxtLogin.Focus();
                return;
            }
            if (string.IsNullOrEmpty(TxtPass.Text))
            {
                await DisplayAlert("Aviso", "Ops, Algo errado, campo senha vazio.", "Ok");

                TxtPass.Focus();
                return;
            }
            this.IsBusy = true;
            await Delay(200);

            IDictionary <string, string> parametros = new Dictionary <string, string>();

            parametros.Add("login", TxtLogin.Text.Replace("-", "").Replace(".", ""));
            parametros.Add("senha", TxtPass.Text);
            this.Logar(parametros);
        }
Exemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Session.Clear();
        Session.RemoveAll();

        if (!IsPostBack)
        {
            TxtLogin.Focus();
        }
    }
        private void Reset()
        {
            TxtName.Clear();
            TxtSurname.Clear();
            TxtLogin.Clear();
            TxtPassword.Clear();

            BtnCreate.Visibility = Visibility.Visible;
            BtnUpdate.Visibility = Visibility.Hidden;
            BtnDelete.Visibility = Visibility.Hidden;

            FillUsers();
        }
Exemplo n.º 5
0
        private void Reset()
        {
            BtnAdd.Visible    = true;
            BtnDel.Visible    = false;
            BtnUpdate.Visible = false;

            TxtLogin.ResetText();
            TxtName.ResetText();
            TxtPhone.ResetText();
            TxtPw.ResetText();
            TxtSurname.ResetText();
            CkbIsBoss.Checked = false;
        }
Exemplo n.º 6
0
        /// <summary>
        /// Method TryLogin
        /// Gets login and password, and try login in site.
        /// </summary>
        /// <param name="login">String with login</param>
        /// <param name="password">String with password.</param>
        /// <returns>Answers whether you managed to enter.</returns>
        public bool TryLogin(string login, string password)
        {
            WaitUntil(TxtLogin).Click();
            TxtLogin.Clear();
            TxtLogin.SendKeys(login);

            WaitUntil(TxtPassword).Click();
            TxtPassword.Clear();
            TxtPassword.SendKeys(password);

            WaitUntil(BtnLogin).Click();
            return(Browser.WebDriver.Url.Contains(BuyTicketPage.Url));
        }
Exemplo n.º 7
0
        //Validar email

        /*private void ValidarEmail(TextBox textBox, ErrorProvider errorProvider) {
         *  string email = textBox.Text;
         *  string modelo = "@''[\w\.-]+(\+[\w-]*)?@([\w-]+\.)+[\w-]+";
         *
         *  if (System.Text.RegularExpressions.Regex.IsMatch(email, modelo))
         *      errorProvider.SetError(textBox, "");
         *  else
         *      errorProvider.SetError(textBox, "Email inválido");
         * }*/

        //Verifica se login ja existe
        private void TxtLogin_Leave(object sender, EventArgs e)
        {
            List <Funcionario> ListaLogin = FuncionarioController.ConsultaLogin(TxtLogin.Text);

            try {
                if (ListaLogin.Count != 0)
                {
                    MessageBox.Show("Login já existente!", "Sistema Recepção", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    TxtLogin.Text = ("");
                    TxtLogin.Select();
                }
            } catch (Exception) {
                MessageBox.Show("Verificar conexão com o Banco de dados");
            }
        }
Exemplo n.º 8
0
 private void TxtLogin_Changed(object sender, DependencyPropertyChangedEventArgs e)
 {
     if (TxtLogin.Text == "Адрес электронной почты")
     {
         TxtLogin.Clear();
         TxtLogin.Foreground = Brushes.Black;
     }
     else
     {
         if (string.IsNullOrWhiteSpace(TxtLogin.Text))
         {
             TxtLogin.Foreground = Brushes.Gray;
             TxtLogin.Text       = "Адрес электронной почты";
         }
     }
 }
Exemplo n.º 9
0
        private async void Btn_cadastrar_clicked(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(TxtLogin.Text))
            {
                await DisplayAlert("Aviso", "Olá, para efetuar um novo cadastro digite um CPF", "Ok");

                TxtLogin.Focus();
                return;
            }
            else
            {
                IDictionary <string, string> cpf_buscar = new Dictionary <string, string>();
                cpf_buscar.Add("cpf", TxtLogin.Text.Replace("-", "").Replace(".", ""));
                this.BuscarUsuario(cpf_buscar);
            }
        }
Exemplo n.º 10
0
 private void BtnEntrar_Click(object sender, EventArgs e)
 {
     if ((TxtLogin.Text == "Cassiano" && TxtSenha.Text == "1234") || (TxtLogin.Text == "Rafael" && TxtSenha.Text == "1234") || (TxtLogin.Text == "Thales" && TxtSenha.Text == "1234"))
     {
         this.Close();
         nt = new Thread(NovoForm);
         nt.SetApartmentState(ApartmentState.STA);
         nt.Start();
     }
     else
     {
         Mensagens.MsgLoginInvalidos();
         TxtLogin.Text = "";
         TxtSenha.Text = "";
         TxtLogin.Focus();
     }
 }
Exemplo n.º 11
0
    protected void BtnLogin_Click(object sender, EventArgs e)
    {
        string Login    = TxtLogin.Text;
        string Password = TxtPassword.Text;

        if (string.IsNullOrEmpty(Login))
        {
            Config.MsgBoxAjax("İstifadəçi adı daxil edin.");
            TxtLogin.Focus();
            return;
        }

        if (string.IsNullOrEmpty(Password))
        {
            Config.MsgBoxAjax("Şifrə daxil edin.");
            TxtPassword.Focus();
            return;
        }

        int CheckResult = DALC.SetByUsersInfo(Login, Password.SHA1Special());

        if (CheckResult == -1)
        {
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }

        if (CheckResult == 0)
        {
            Config.MsgBoxAjax("Giriş baş tutmadı! İstifadəçi adınızın və ya şifrənizin doğruluğuna əmin olun.");
            return;
        }

        string ReturnResult = Config._GetQueryString("return");

        if (ReturnResult.Length > 0)
        {
            Config.RedirectURL(ReturnResult);
            return;
        }
        else
        {
            Config.RedirectURL("/tools");
        }
    }
Exemplo n.º 12
0
        private void BtnEntrar_Click(object sender, EventArgs e)
        {
            string senhaDecripto;

            senhaDecripto = FuncionarioController.AcertaSenha(TxtLogin.Text, TxtSenha.Text);

            try {
                List <Funcionario> lista = FuncionarioDataAccess.ObterLogin(TxtLogin.Text, senhaDecripto);
                if (lista.Count != 0)
                {
                    MessageBox.Show("Bem vindo ao Sistema Recepção", "Prefeitura de Jacareí", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                if (lista.Count == 0)
                {
                    MessageBox.Show("Usuário ou senha incorretos\nDeseja tentar novamente?", "Prefeitura de Jacareí", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    TxtLogin.Text = "";
                    TxtSenha.Text = "";
                    TxtLogin.Focus();
                }
            } catch (Exception) {
                throw;
            }
        }
Exemplo n.º 13
0
        protected void BtnIngresar_Click(object sender, EventArgs e)
        {
            if (TxtLogin.Text.Trim() == "")
            {
                LblMensaje.Text = "Ingrese Nombre de Usuario";
                TxtLogin.Focus();
                return;
            }
            if (TxtPassword.Text.Trim() == "")
            {
                LblMensaje.Text = "Ingrese Contraseña";
                TxtPassword.Focus();
                return;
            }
            EntUsuario.Login    = TxtLogin.Text.Trim();
            EntUsuario.Password = TxtPassword.Text.Trim();
            DataTable Tabla = new DataTable();

            Tabla = NegUsuario.Sesion(EntUsuario);
            if (Tabla.Rows.Count > 0)
            {
                Session.RemoveAll();
                Session.Add("IdUsuario", Tabla.Rows[0]["IdUsuario"].ToString());
                Session.Add("Login", Tabla.Rows[0]["Login"].ToString());
                Session.Add("Password", Tabla.Rows[0]["Password"].ToString());
                Session.Add("IdPerfil", Tabla.Rows[0]["IdPerfil"].ToString());
                LblMensaje.Text         = "Bienvenido";
                LblSesion.Text          = "Usuario: " + Session["Login"].ToString();
                TxtLogin.Text           = "";
                TxtPassword.Text        = "";
                BtnCerrarSesion.Visible = true;
            }
            else
            {
                LblMensaje.Text = "Incorrecto";
            }
        }
Exemplo n.º 14
0
        void ReleaseDesignerOutlets()
        {
            if (CboKey != null)
            {
                CboKey.Dispose();
                CboKey = null;
            }

            if (CboServersScoringRule != null)
            {
                CboServersScoringRule.Dispose();
                CboServersScoringRule = null;
            }

            if (CboSpeedResolutions != null)
            {
                CboSpeedResolutions.Dispose();
                CboSpeedResolutions = null;
            }

            if (ChkLockedMode != null)
            {
                ChkLockedMode.Dispose();
                ChkLockedMode = null;
            }

            if (ChkRemember != null)
            {
                ChkRemember.Dispose();
                ChkRemember = null;
            }

            if (ChkServersLockCurrent != null)
            {
                ChkServersLockCurrent.Dispose();
                ChkServersLockCurrent = null;
            }

            if (ChkServersShowAll != null)
            {
                ChkServersShowAll.Dispose();
                ChkServersShowAll = null;
            }

            if (CmdAreasBlackList != null)
            {
                CmdAreasBlackList.Dispose();
                CmdAreasBlackList = null;
            }

            if (CmdAreasUndefined != null)
            {
                CmdAreasUndefined.Dispose();
                CmdAreasUndefined = null;
            }

            if (CmdAreasWhiteList != null)
            {
                CmdAreasWhiteList.Dispose();
                CmdAreasWhiteList = null;
            }

            if (CmdCancel != null)
            {
                CmdCancel.Dispose();
                CmdCancel = null;
            }

            if (CmdConnect != null)
            {
                CmdConnect.Dispose();
                CmdConnect = null;
            }

            if (CmdDisconnect != null)
            {
                CmdDisconnect.Dispose();
                CmdDisconnect = null;
            }

            if (CmdLogin != null)
            {
                CmdLogin.Dispose();
                CmdLogin = null;
            }

            if (CmdLogsClean != null)
            {
                CmdLogsClean.Dispose();
                CmdLogsClean = null;
            }

            if (CmdLogsCommand != null)
            {
                CmdLogsCommand.Dispose();
                CmdLogsCommand = null;
            }

            if (CmdLogsCopy != null)
            {
                CmdLogsCopy.Dispose();
                CmdLogsCopy = null;
            }

            if (CmdLogsOpenVpnManagement != null)
            {
                CmdLogsOpenVpnManagement.Dispose();
                CmdLogsOpenVpnManagement = null;
            }

            if (CmdLogsSave != null)
            {
                CmdLogsSave.Dispose();
                CmdLogsSave = null;
            }

            if (CmdLogsSupport != null)
            {
                CmdLogsSupport.Dispose();
                CmdLogsSupport = null;
            }

            if (CmdMainMenu != null)
            {
                CmdMainMenu.Dispose();
                CmdMainMenu = null;
            }

            if (CmdNetworkLock != null)
            {
                CmdNetworkLock.Dispose();
                CmdNetworkLock = null;
            }

            if (CmdProviderAdd != null)
            {
                CmdProviderAdd.Dispose();
                CmdProviderAdd = null;
            }

            if (CmdProviderEdit != null)
            {
                CmdProviderEdit.Dispose();
                CmdProviderEdit = null;
            }

            if (CmdProviderRemove != null)
            {
                CmdProviderRemove.Dispose();
                CmdProviderRemove = null;
            }

            if (CmdServersBlackList != null)
            {
                CmdServersBlackList.Dispose();
                CmdServersBlackList = null;
            }

            if (CmdServersConnect != null)
            {
                CmdServersConnect.Dispose();
                CmdServersConnect = null;
            }

            if (CmdServersMore != null)
            {
                CmdServersMore.Dispose();
                CmdServersMore = null;
            }

            if (CmdServersRefresh != null)
            {
                CmdServersRefresh.Dispose();
                CmdServersRefresh = null;
            }

            if (CmdServersRename != null)
            {
                CmdServersRename.Dispose();
                CmdServersRename = null;
            }

            if (CmdServersUndefined != null)
            {
                CmdServersUndefined.Dispose();
                CmdServersUndefined = null;
            }

            if (CmdServersWhiteList != null)
            {
                CmdServersWhiteList.Dispose();
                CmdServersWhiteList = null;
            }

            if (ImgConnectedCountry != null)
            {
                ImgConnectedCountry.Dispose();
                ImgConnectedCountry = null;
            }

            if (ImgNetworkLock != null)
            {
                ImgNetworkLock.Dispose();
                ImgNetworkLock = null;
            }

            if (ImgProgress != null)
            {
                ImgProgress.Dispose();
                ImgProgress = null;
            }

            if (ImgTopFlag != null)
            {
                ImgTopFlag.Dispose();
                ImgTopFlag = null;
            }

            if (ImgTopPanel != null)
            {
                ImgTopPanel.Dispose();
                ImgTopPanel = null;
            }

            if (LblConnect != null)
            {
                LblConnect.Dispose();
                LblConnect = null;
            }

            if (LblConnectedLocation != null)
            {
                LblConnectedLocation.Dispose();
                LblConnectedLocation = null;
            }

            if (LblConnectedServerName != null)
            {
                LblConnectedServerName.Dispose();
                LblConnectedServerName = null;
            }

            if (LblDevice != null)
            {
                LblDevice.Dispose();
                LblDevice = null;
            }

            if (LblKey != null)
            {
                LblKey.Dispose();
                LblKey = null;
            }

            if (LblLogin != null)
            {
                LblLogin.Dispose();
                LblLogin = null;
            }

            if (LblLoginIcon != null)
            {
                LblLoginIcon.Dispose();
                LblLoginIcon = null;
            }

            if (LblNetLockStatus != null)
            {
                LblNetLockStatus.Dispose();
                LblNetLockStatus = null;
            }

            if (LblPassword != null)
            {
                LblPassword.Dispose();
                LblPassword = null;
            }

            if (LblTopStatus != null)
            {
                LblTopStatus.Dispose();
                LblTopStatus = null;
            }

            if (LblVersion != null)
            {
                LblVersion.Dispose();
                LblVersion = null;
            }

            if (LblWaiting1 != null)
            {
                LblWaiting1.Dispose();
                LblWaiting1 = null;
            }

            if (LblWaiting2 != null)
            {
                LblWaiting2.Dispose();
                LblWaiting2 = null;
            }

            if (MnuAreasBlacklist != null)
            {
                MnuAreasBlacklist.Dispose();
                MnuAreasBlacklist = null;
            }

            if (MnuAreasUndefined != null)
            {
                MnuAreasUndefined.Dispose();
                MnuAreasUndefined = null;
            }

            if (MnuAreasWhitelist != null)
            {
                MnuAreasWhitelist.Dispose();
                MnuAreasWhitelist = null;
            }

            if (MnuLogsCopyAll != null)
            {
                MnuLogsCopyAll.Dispose();
                MnuLogsCopyAll = null;
            }

            if (MnuLogsCopySelected != null)
            {
                MnuLogsCopySelected.Dispose();
                MnuLogsCopySelected = null;
            }

            if (MnuLogsSaveAll != null)
            {
                MnuLogsSaveAll.Dispose();
                MnuLogsSaveAll = null;
            }

            if (MnuLogsSaveSelected != null)
            {
                MnuLogsSaveSelected.Dispose();
                MnuLogsSaveSelected = null;
            }

            if (MnuServersBlacklist != null)
            {
                MnuServersBlacklist.Dispose();
                MnuServersBlacklist = null;
            }

            if (MnuServersConnect != null)
            {
                MnuServersConnect.Dispose();
                MnuServersConnect = null;
            }

            if (MnuServersMore != null)
            {
                MnuServersMore.Dispose();
                MnuServersMore = null;
            }

            if (MnuServersRefresh != null)
            {
                MnuServersRefresh.Dispose();
                MnuServersRefresh = null;
            }

            if (MnuServersRename != null)
            {
                MnuServersRename.Dispose();
                MnuServersRename = null;
            }

            if (MnuServersUndefined != null)
            {
                MnuServersUndefined.Dispose();
                MnuServersUndefined = null;
            }

            if (MnuServersWhitelist != null)
            {
                MnuServersWhitelist.Dispose();
                MnuServersWhitelist = null;
            }

            if (MnuTray != null)
            {
                MnuTray.Dispose();
                MnuTray = null;
            }

            if (MnuTrayAbout != null)
            {
                MnuTrayAbout.Dispose();
                MnuTrayAbout = null;
            }

            if (MnuTrayClientArea != null)
            {
                MnuTrayClientArea.Dispose();
                MnuTrayClientArea = null;
            }

            if (MnuTrayConnect != null)
            {
                MnuTrayConnect.Dispose();
                MnuTrayConnect = null;
            }

            if (MnuTrayForwardingPorts != null)
            {
                MnuTrayForwardingPorts.Dispose();
                MnuTrayForwardingPorts = null;
            }

            if (MnuTrayHome != null)
            {
                MnuTrayHome.Dispose();
                MnuTrayHome = null;
            }

            if (MnuTrayPreferences != null)
            {
                MnuTrayPreferences.Dispose();
                MnuTrayPreferences = null;
            }

            if (MnuTrayQuit != null)
            {
                MnuTrayQuit.Dispose();
                MnuTrayQuit = null;
            }

            if (MnuTrayRestore != null)
            {
                MnuTrayRestore.Dispose();
                MnuTrayRestore = null;
            }

            if (MnuTraySpeedTest != null)
            {
                MnuTraySpeedTest.Dispose();
                MnuTraySpeedTest = null;
            }

            if (MnuTrayStatus != null)
            {
                MnuTrayStatus.Dispose();
                MnuTrayStatus = null;
            }

            if (MnuTrayUpdate != null)
            {
                MnuTrayUpdate.Dispose();
                MnuTrayUpdate = null;
            }

            if (PanelConnected != null)
            {
                PanelConnected.Dispose();
                PanelConnected = null;
            }

            if (PanelWaiting != null)
            {
                PanelWaiting.Dispose();
                PanelWaiting = null;
            }

            if (PanelWelcome != null)
            {
                PanelWelcome.Dispose();
                PanelWelcome = null;
            }

            if (PnlChart != null)
            {
                PnlChart.Dispose();
                PnlChart = null;
            }

            if (ServersContextMenu != null)
            {
                ServersContextMenu.Dispose();
                ServersContextMenu = null;
            }

            if (TableAreas != null)
            {
                TableAreas.Dispose();
                TableAreas = null;
            }

            if (TableLogs != null)
            {
                TableLogs.Dispose();
                TableLogs = null;
            }

            if (TableProviders != null)
            {
                TableProviders.Dispose();
                TableProviders = null;
            }

            if (TableServers != null)
            {
                TableServers.Dispose();
                TableServers = null;
            }

            if (TableStats != null)
            {
                TableStats.Dispose();
                TableStats = null;
            }

            if (TabMain != null)
            {
                TabMain.Dispose();
                TabMain = null;
            }

            if (TabOverview != null)
            {
                TabOverview.Dispose();
                TabOverview = null;
            }

            if (TxtCommand != null)
            {
                TxtCommand.Dispose();
                TxtCommand = null;
            }

            if (TxtConnectedDownload != null)
            {
                TxtConnectedDownload.Dispose();
                TxtConnectedDownload = null;
            }

            if (TxtConnectedExitIp != null)
            {
                TxtConnectedExitIp.Dispose();
                TxtConnectedExitIp = null;
            }

            if (TxtConnectedSince != null)
            {
                TxtConnectedSince.Dispose();
                TxtConnectedSince = null;
            }

            if (TxtConnectedUpload != null)
            {
                TxtConnectedUpload.Dispose();
                TxtConnectedUpload = null;
            }

            if (TxtLogin != null)
            {
                TxtLogin.Dispose();
                TxtLogin = null;
            }

            if (TxtPassword != null)
            {
                TxtPassword.Dispose();
                TxtPassword = null;
            }

            if (CmdUpdater != null)
            {
                CmdUpdater.Dispose();
                CmdUpdater = null;
            }
        }
        private bool validarCamposObrigatorios()
        {
            if (string.IsNullOrWhiteSpace(TxtNome.Text))
            {
                MessageBox.Show("Favor informar o nome"
                                , "Aviso"
                                , MessageBoxButtons.OK
                                , MessageBoxIcon.Warning);
                TxtNome.Focus();
                return(false);
            }

            if (!TxtCpf.MaskCompleted)
            {
                MessageBox.Show("Favor informar o CPF"
                                , "Aviso"
                                , MessageBoxButtons.OK
                                , MessageBoxIcon.Warning);
                TxtCpf.Focus();
                return(false);
            }

            if (string.IsNullOrWhiteSpace(TxtLogin.Text))
            {
                MessageBox.Show("Favor informar o login"
                                , "Aviso"
                                , MessageBoxButtons.OK
                                , MessageBoxIcon.Warning);
                TxtLogin.Focus();
                return(false);
            }

            if (aEstadoForm == Enumeradores.EnumEstadoForm.CADASTRO)
            {
                if (string.IsNullOrWhiteSpace(TxtSenha.Text))
                {
                    MessageBox.Show("Favor informar a senha"
                                    , "Aviso"
                                    , MessageBoxButtons.OK
                                    , MessageBoxIcon.Warning);
                    TxtSenha.Focus();
                    return(false);
                }

                if (!TxtSenha.Text.Equals(TxtConfirmacaoSenha.Text))
                {
                    MessageBox.Show("As senhas não são iguais"
                                    , "Aviso"
                                    , MessageBoxButtons.OK
                                    , MessageBoxIcon.Warning);
                    TxtSenha.Focus();
                    return(false);
                }
            }

            if (string.IsNullOrWhiteSpace(TxtPercentualComissao.Text))
            {
                MessageBox.Show("Favor informar o percentual de comissão"
                                , "Aviso"
                                , MessageBoxButtons.OK
                                , MessageBoxIcon.Warning);
                TxtPercentualComissao.Focus();
                return(false);
            }

            return(true);
        }
Exemplo n.º 16
0
 protected void BtnRegistrar_Click(object sender, EventArgs e)
 {
     if (Session.Count == 0)
     {
         if (Existe() > 0)
         {
             LblMensaje.Text = "Login ya Existe, elija otro";
             LblMensaje.Focus();
             return;
         }
     }
     if (TxtNombre.Text.Trim() == "")
     {
         LblMensaje.Text = "Ingrese Nombres";
         TxtNombre.Focus();
         return;
     }
     if (TxtApePat.Text.Trim() == "")
     {
         LblMensaje.Text = "Ingrese Apellido Paterno";
         TxtApePat.Focus();
         return;
     }
     if (TxtApeMat.Text.Trim() == "")
     {
         LblMensaje.Text = "Ingrese Apellido Materno";
         TxtApeMat.Focus();
         return;
     }
     if (TxtDireccion.Text.Trim() == "")
     {
         LblMensaje.Text = "Ingrese Direccion";
         TxtDireccion.Focus();
         return;
     }
     if (TxtEmail.Text.Trim() == "")
     {
         LblMensaje.Text = "Ingrese Email";
         TxtEmail.Focus();
         return;
     }
     if (TxtLogin.Text.Trim() == "")
     {
         LblMensaje.Text = "Ingrese Login";
         TxtLogin.Focus();
         return;
     }
     if (TxtPassword.Text.Trim() == "")
     {
         LblMensaje.Text = "Ingrese Password";
         TxtPassword.Focus();
         return;
     }
     if (Session.Count > 0)
     {
         if (TxtLogin.Text.Trim() != Session["Login"].ToString())
         {
             LblMensaje.Text = "Ingrese Login Igual al que Inicio Sesión";
             TxtLogin.Focus();
             return;
         }
     }
     EntUsuario.Nombre    = TxtNombre.Text.Trim();
     EntUsuario.Apepat    = TxtApePat.Text.Trim();
     EntUsuario.Apemmat   = TxtApeMat.Text.Trim();
     EntUsuario.Direccion = TxtDireccion.Text.Trim();
     EntUsuario.Telefono  = TxtTelefono.Text.Trim();
     EntUsuario.Celular   = TxtCelular.Text.Trim();
     EntUsuario.Email     = TxtEmail.Text.Trim();
     EntUsuario.Password  = TxtPassword.Text.Trim();
     EntUsuario.Login     = TxtLogin.Text.Trim();
     EntUsuario.Idperfil  = 2;
     try
     {
         int filas;
         filas = NegUsuario.Grabar(EntUsuario);
         if (filas > 0)
         {
             if (Session.Count > 0)
             {
                 EntUsuario.Idusuario = int.Parse(Session["IdUsuario"].ToString());
                 Session["Password"]  = TxtPassword.Text.Trim();
                 NegPrefxUsu.EliminaXIdUsuario(EntUsuario);
             }
             List <Entidad> EntPrefxUsuLista = new List <Entidad>();
             for (filas = 0; filas < ChkPreferencias.Items.Count; filas++)
             {
                 if (ChkPreferencias.Items[filas].Selected)
                 {
                     Entidad ENT = new Entidad();
                     ENT.Tipopreferencia = ChkPreferencias.Items[filas].Text;
                     ENT.Login           = TxtLogin.Text.Trim();
                     EntPrefxUsuLista.Add(ENT);
                 }
             }
             NegPrefxUsu.Grabar(EntPrefxUsuLista);
             if (Session.Count > 0)
             {
                 LblMensaje.Text = "Usuario Actualizado";
             }
             else
             {
                 LblMensaje.Text = "Usuario Registrado";
                 Limpiar();
             }
         }
     }
     catch (Exception ex)
     {
         LblMensaje.Text = ex.Message;
     }
 }
Exemplo n.º 17
0
        private void MemberClick(UInt32 MemberID_UL)
        {
            // Load client info in each control
            String        SQLRequest_ST;
            SqlDataReader SqlDataReader_O;
            UInt32        CPID_UL         = 0;
            UInt32        PersStatusID_UL = 0;

            mInitializingData_b = true;

            TxtTel.Clear();
            DTPBirthdate.Value = DTPBirthdate.MinDate;
            DTPEntryDate.Value = DTPEntryDate.MinDate;

            TxtCost.Clear();
            TxtBankAccount.Clear();
            TxtRegNumber.Clear();
            TxtChilds.Clear();
            TxtAdress.Clear();
            ComBoxFamilyState.SelectedItem = null;
            CheckBoxActivePartner.Checked  = false;
            DBComboxStatus.ClearSelectedItem();
            ComboxPostalCode.ClearSelectedItem();
            ComboxLocality.ClearSelectedItem();
            LblMemberName.Text            = "";
            CheckBoxActivePartner.Checked = false;
            DepartmentSelector.Clear();
            MemberDayChickingViewer.ChangePers(0, true);
            TxtLogin.Clear();

            bool ActivePartner_b = false;

            if (mDBManager_O != null && mDBManager_O.mConnected_b)
            {
                // Fill fields of member
                SQLRequest_ST   = "SELECT * FROM Pers WHERE PersID=" + MemberID_UL;
                SqlDataReader_O = mDBManager_O.Select(SQLRequest_ST);

                while (SqlDataReader_O.Read())
                {
                    bool.TryParse(SqlDataReader_O["ConjActif"].ToString(), out ActivePartner_b);

                    // Fill info in panel edit controls
                    TxtTel.Text = SqlDataReader_O["NumTel"].ToString();
                    try
                    {
                        DTPBirthdate.Value = Convert.ToDateTime(SqlDataReader_O["DateNaissance"].ToString());
                    }
                    catch (FormatException e)
                    {
                        DTPBirthdate.Value = DTPBirthdate.MinDate;
                    }

                    try
                    {
                        DTPEntryDate.Value = Convert.ToDateTime(SqlDataReader_O["DateEntreeService"].ToString());
                    }
                    catch (FormatException e)
                    {
                        DTPEntryDate.Value = DTPEntryDate.MinDate;
                    }

                    TxtCost.Text           = SqlDataReader_O["CoutHeure"].ToString() + "\u20AC";
                    TxtBankAccount.Text    = SqlDataReader_O["CompteBanq"].ToString();
                    TxtRegNumber.Text      = SqlDataReader_O["NumRegNat"].ToString();
                    TxtChilds.Text         = SqlDataReader_O["NbrEnfCharge"].ToString();
                    TxtAdress.Text         = SqlDataReader_O["Adresse"].ToString();
                    ComBoxFamilyState.Text = SqlDataReader_O["SitFam"].ToString();
                    TxtLogin.Text          = SqlDataReader_O["UserLogin"].ToString();

                    CheckBoxActivePartner.Checked = ActivePartner_b;

                    if (UInt32.TryParse(SqlDataReader_O["PersStatutID"].ToString(), out PersStatusID_UL))
                    {
                        DBComboxStatus.SelectItemByID(PersStatusID_UL);
                    }
                    if (UInt32.TryParse(SqlDataReader_O["CodePostalID"].ToString(), out CPID_UL))
                    {
                        ComboxPostalCode.SelectItemByID(CPID_UL);
                        ComboxLocality.SelectItemByID(CPID_UL);
                    }
                    else
                    {
                        ComboxPostalCode.ClearSelectedItem();
                        ComboxLocality.ClearSelectedItem();
                    }

                    // Fill info in panel check controls
                    LblMemberName.Text = SqlDataReader_O["PersNom"].ToString();

                    CheckBoxActivePartner.Checked = ActivePartner_b;

                    // Refresh checking recap
                    //int NbDays = DateTime.Today.DayOfWeek - DayOfWeek.Monday;
                    if (!String.IsNullOrEmpty(SqlDataReader_O["PersNom"].ToString()))
                    {
                        MemberDayChickingViewer.ChangePers(MemberID_UL, true);
                    }
                }

                SqlDataReader_O.Close();

                // Fill associated departments
                SQLRequest_ST   = "SELECT DepID FROM RelDepPers WHERE PersID=" + MemberID_UL;
                SqlDataReader_O = mDBManager_O.Select(SQLRequest_ST);
                List <UInt32> DepID_UL = new List <UInt32>();
                UInt32        ID_UL;

                while (SqlDataReader_O.Read())
                {
                    if (UInt32.TryParse(SqlDataReader_O["DepID"].ToString(), out ID_UL))
                    {
                        DepID_UL.Add(ID_UL);
                    }
                }

                DepartmentSelector.CheckDepartments(DepID_UL);

                SqlDataReader_O.Close();
            }

            mInitializingData_b = false;
        }