예제 #1
0
        private void BtnActualizar_Click(object sender, EventArgs e)
        {
            try
            {
                if (validacionImgError())
                {
                    this.convertir();
                    EUsers Obj = new EUsers();
                    Obj.usuarioID = Convert.ToInt32(this.txtId.Text);
                    Obj.nombre    = this.txtNombre.Text.Trim();
                    Obj.apellido  = this.txtApellido.Text.Trim();
                    Obj.tipo      = this.cbAcceso.Text.Trim();
                    Obj.usuario   = this.txtUsuario.Text.Trim();
                    Obj.password  = this.txtPassword.Text.Trim();

                    NUsers.update(Obj);
                    this.MostrarDB();
                    this.LimpiarPRegistro();
                }
                else
                {
                    throw new Exception("Datos Obligatorios");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Sistema Odontograma");
            }
        }
예제 #2
0
        private void DataListado_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == dataListado.Columns["Eliminar"].Index)
            {
                DialogResult Opcion;
                Opcion = MessageBox.Show("Realmente desea Eliminar El Registro", "Sistema de Odontograma", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (Opcion == DialogResult.OK)
                {
                    string Codigo;
                    string Rpta = "";

                    Codigo = Convert.ToString(this.dataListado.CurrentRow.Cells["usuarioID"].Value);
                    EUsers Obj = new EUsers();
                    Obj.usuarioID = Convert.ToInt32(Codigo);
                    Rpta          = Convert.ToString(NUsers.delete(Obj));
                    if (Rpta.Equals("OK"))
                    {
                        this.MensajeOk("Se ELimino Correctamente el Registro");
                    }
                    else
                    {
                        this.MensajeError(Rpta);
                    }

                    this.MostrarDB();
                }
            }
            else
            {
                if (e.ColumnIndex == dataListado.Columns["Editar"].Index)
                {
                    this.LimpiarImgError();
                    this.txtId.Text       = Convert.ToString(this.dataListado.CurrentRow.Cells["usuarioID"].Value);
                    this.txtNombre.Text   = Convert.ToString(this.dataListado.CurrentRow.Cells["nombre"].Value);
                    this.txtApellido.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["apellido"].Value);
                    this.cbAcceso.Text    = Convert.ToString(this.dataListado.CurrentRow.Cells["tipo"].Value);
                    this.txtUsuario.Text  = Convert.ToString(this.dataListado.CurrentRow.Cells["usuario"].Value);
                    this.txtPassword.Text = Convert.ToString(this.dataListado.CurrentRow.Cells["password"].Value);


                    this.OcultarPRegistro(false, false);
                    this.lbModificar.Visible = true;
                    this.lbAgregar.Visible   = false;
                }
            }
        }
예제 #3
0
        private void loguear()
        {
            try
            {
                if (this.txtUser.Text != "USUARIO")
                {
                    if (this.txtPass.Text != "CONTRASEÑA")
                    {
                        EUsers user = new EUsers();
                        NUsers log  = new NUsers();

                        user.usuario  = this.txtUser.Text;
                        user.password = this.txtPass.Text;
                        user          = log.login(user);
                        if (user.usuarioID > 0)
                        {
                            FrmMenu mainMenu = new FrmMenu(user);
                            mainMenu.Show();
                            this.Hide();
                            txtPass.Clear();
                            txtUser.Focus();
                            mainMenu.FormClosed += logout;
                        }
                        else
                        {
                            throw new Exception("El Usuario que Ingresaste no coinciden con ninguna Cuenta");
                        }
                    }

                    else
                    {
                        msgError("Ingrese Ingrese su Contraseña");
                    }
                }
                else
                {
                    msgError("Ingrese su Nombre de Usuario");
                }
            }
            catch (Exception ex)
            {
                msgError(ex.Message);
                this.txtPass.Text = string.Empty;
            }
        }
예제 #4
0
        private void MostrarDB()
        {
            this.dataListado.DataSource = NUsers.mostrar(this.txtBuscarNombre.Text, this.txtBuscarApellido.Text, this.siguientePag);
            this.ordenarColumnas();
            this.dataListado.AutoResizeColumns();
            int dataTotal = NUsers.mostrarTotal(this.txtBuscarNombre.Text, this.txtBuscarApellido.Text) / 10;

            if (dataTotal == 0)
            {
                this.btnIncio.Enabled     = false;
                this.btnAtras.Enabled     = false;
                this.btnFin.Enabled       = false;
                this.btnSiguiente.Enabled = false;
            }
            else
            {
                if (dataTotal == siguientePag)
                {
                    this.btnIncio.Enabled     = true;
                    this.btnAtras.Enabled     = true;
                    this.btnFin.Enabled       = false;
                    this.btnSiguiente.Enabled = false;
                }
                else
                {
                    if (Convert.ToInt32(this.siguientePag) > 0)
                    {
                        this.btnAtras.Enabled     = true;
                        this.btnIncio.Enabled     = true;
                        this.btnFin.Enabled       = true;
                        this.btnSiguiente.Enabled = true;
                    }
                    else
                    {
                        this.btnIncio.Enabled     = false;
                        this.btnAtras.Enabled     = false;
                        this.btnFin.Enabled       = true;
                        this.btnSiguiente.Enabled = true;
                    }
                }
            }

            lblTotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count);
        }
예제 #5
0
        private void MostrarDB()
        {
            this.dataListado.DataSource = NUsers.mostrarOdontologo(this.txtNombre.Text, this.txtApellido.Text, this.siguientePag);
            this.ordenarColumnas();
            this.dataListado.AutoResizeColumns();

            int dataTotal = NUsers.mostrarTotal(this.txtNombre.Text, this.txtApellido.Text) / 10;

            if (dataTotal == 0)
            {
                this.btnIncio.Enabled     = false;
                this.btnAtras.Enabled     = false;
                this.btnFin.Enabled       = false;
                this.btnSiguiente.Enabled = false;
            }
            else
            {
                if (dataTotal == siguientePag)
                {
                    this.btnIncio.Enabled     = true;
                    this.btnAtras.Enabled     = true;
                    this.btnFin.Enabled       = false;
                    this.btnSiguiente.Enabled = false;
                }
                else
                {
                    if (Convert.ToInt32(this.siguientePag) > 0)
                    {
                        this.btnAtras.Enabled     = true;
                        this.btnIncio.Enabled     = true;
                        this.btnFin.Enabled       = true;
                        this.btnSiguiente.Enabled = true;
                    }
                    else
                    {
                        this.btnIncio.Enabled     = false;
                        this.btnAtras.Enabled     = false;
                        this.btnFin.Enabled       = true;
                        this.btnSiguiente.Enabled = true;
                    }
                }
            }
        }
예제 #6
0
 private void BtnFin_Click(object sender, EventArgs e)
 {
     this.siguientePag = NUsers.mostrarTotal(this.txtBuscarNombre.Text, this.txtBuscarApellido.Text) / 10;
     this.MostrarDB();
 }
예제 #7
0
        async void OnAuthCompleted(object sender, AuthenticatorCompletedEventArgs e)
        {
            var authenticator = sender as OAuth2Authenticator;

            if (authenticator != null)
            {
                authenticator.Completed -= OnAuthCompleted;
                authenticator.Error     -= OnAuthError;
            }


            if (e.IsAuthenticated)
            {
                if (authenticator.AuthorizeUrl.Host == "www.facebook.com")
                {
                    FacebookEmail facebookEmail = null;

                    var httpClient = new HttpClient();

                    var json = await httpClient.GetStringAsync($"https://graph.facebook.com/me?fields=id,name,first_name,last_name,email,picture.type(large)&access_token=" + e.Account.Properties["access_token"]);

                    facebookEmail = JsonConvert.DeserializeObject <FacebookEmail>(json);

                    await store.SaveAsync(account = e.Account, Constants.AppName);

                    Application.Current.Properties.Remove("Id");
                    Application.Current.Properties.Remove("FirstName");
                    Application.Current.Properties.Remove("LastName");
                    Application.Current.Properties.Remove("DisplayName");
                    Application.Current.Properties.Remove("EmailAddress");
                    Application.Current.Properties.Remove("ProfilePicture");

                    Application.Current.Properties.Add("Id", facebookEmail.Id);
                    Application.Current.Properties.Add("FirstName", facebookEmail.First_Name);
                    Application.Current.Properties.Add("LastName", facebookEmail.Last_Name);
                    Application.Current.Properties.Add("DisplayName", facebookEmail.Name);
                    Application.Current.Properties.Add("EmailAddress", facebookEmail.Email);
                    Application.Current.Properties.Add("ProfilePicture", facebookEmail.Picture.Data.Url);

                    await Navigation.PushAsync(new MainPage());
                }
                else
                {
                    NUsers user = null;

                    // If the user is authenticated, request their basic user data from Google
                    // UserInfoUrl = https://www.googleapis.com/oauth2/v2/userinfo
                    var request  = new OAuth2Request("GET", new Uri(Constants.GoogleUserInfoUrl), null, e.Account);
                    var response = await request.GetResponseAsync();

                    if (response != null)
                    {
                        // Deserialize the data and store it in the account store
                        // The users email address will be used to identify data in SimpleDB
                        string userJson = await response.GetResponseTextAsync();

                        user = JsonConvert.DeserializeObject <NUsers>(userJson);
                    }

                    if (account != null)
                    {
                        store.Delete(account, Constants.AppName);
                    }

                    await store.SaveAsync(account = e.Account, Constants.AppName);

                    Application.Current.Properties.Remove("Id");
                    Application.Current.Properties.Remove("FirstName");
                    Application.Current.Properties.Remove("LastName");
                    Application.Current.Properties.Remove("DisplayName");
                    Application.Current.Properties.Remove("EmailAddress");
                    Application.Current.Properties.Remove("ProfilePicture");

                    Application.Current.Properties.Add("Id", user.Id);
                    Application.Current.Properties.Add("FirstName", user.GivenName);
                    Application.Current.Properties.Add("LastName", user.FamilyName);
                    Application.Current.Properties.Add("DisplayName", user.Name);
                    Application.Current.Properties.Add("EmailAddress", user.Email);
                    Application.Current.Properties.Add("ProfilePicture", user.Picture);

                    await Navigation.PushAsync(new MainPage());
                }
            }
        }