public PantallaMenuControlPedidos(string User)
 {
     InitializeComponent();
     this.Usuario = User;
     Interface    = new InterfaceUsuario(this);
     tipoUsuario  = Interface.ObtenerTipoUser(Usuario);
 }
Esempio n. 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            int    renglon = 0;
            string id      = "";

            if (dtvDatos2.CurrentCell != null)
            {
                renglon = Convert.ToInt32(dtvDatos2.CurrentCell.RowIndex.ToString());
                if (dtvDatos2[0, renglon].Value != null)
                {
                    id = dtvDatos2[0, renglon].Value.ToString();
                    if (validarCancelacion(dtvDatos2, renglon))
                    {
                    }
                    else
                    {
                        if (MessageBox.Show("Desea cancelar el pedido " + id.ToString(), "Cancelar pedido", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
                            == DialogResult.Yes)
                        {
                            Interface = new InterfaceUsuario(this);
                            Interface.CancelarPedido(dtvDatos2, id.ToString());
                            MessageBox.Show("Pedido cancelado", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button1);
                            ActualizarData();
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("Pedido invalido", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 private void ActualizarData()
 {
     Interface = new InterfaceUsuario(this);
     Interface.DatosPedidos(dtvDatos);
     valida = new Validar(this);
     valida.validarData(dtvDatos);
 }
Esempio n. 4
0
 private void btnModificarPedido_Click(object sender, System.EventArgs e)
 {
     if (!Validar.ValidarUnaPantalla(new PantallaModificarPedido(null).GetType()))
     {
         Interface = new InterfaceUsuario(this);
         PantallaPedirInformación temp = new PantallaPedirInformación();
         bool           Cancelado      = true;
         RegistroPedido Pedido         = temp.PedirPedido(out Cancelado);
         if (!Cancelado)
         {
             if (Pedido != null)
             {
                 Interface.DesplegarPantallaModificarPedido(Pedido);
             }
             else
             {
                 if (DialogResult.Yes == MessageBox.Show("El número de pedido ingresado no existe\n\n¿Desea ver una lista de pedidos existentes?", "AVISO", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1))
                 {
                     if (!Validar.ValidarUnaPantalla(new PantallaMenuControlPedidos(Usuario).GetType()))
                     {
                         Interface.DesplegarPantallaControlPedidos(Usuario);
                     }
                 }
             }
         }
     }
 }
 private void btnAceptar_Click(object sender, EventArgs e)
 {
     if (!FaltanCampos)
     {
         Interface = new InterfaceUsuario(this);
         RegistroDentista t = ObtenerRegistroDentista, Encontrado = Interface.ObtenerUnDentista(tbCedula.Text);
         if (Interface.RegistrarDentista(t) && Encontrado?.Cedula != tbCedula.Text)
         {
             MessageBox.Show("Dentista registrado correctamente", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Information);
             AceptarCambios = true;
             Close();
         }
         else
         {
             if (tbCedula.Text == Encontrado?.Cedula)
             {
                 Validar.MensajeErrorOK("Cedula registrada anteriormente, favor de cambiarla");
             }
             else
             {
                 Validar.MensajeErrorBaseDeDatos();
             }
         }
     }
 }
 private void btnActivarUsuario_Click(object sender, EventArgs e)
 {
     if (dgvDatos[0, dgvDatos.SelectedCells[0].RowIndex].Value != null)
     {
         if (dgvDatos[0, dgvDatos.SelectedCells[0].RowIndex].Value.ToString() != "")
         {
             int Empleado = Convert.ToInt32(dgvDatos[0, dgvDatos.SelectedCells[0].RowIndex].Value);
             Interface = new InterfaceUsuario(this);
             string Usuario = dgvDatos[1, dgvDatos.SelectedCells[0].RowIndex].Value.ToString();
             if (Usuario != this.Usuario)
             {
                 DialogResult temp = MessageBox.Show("¿Desea permitirle acceso al sistema al usuario: " + Usuario, "AVISO", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
                 if (temp == DialogResult.Yes)
                 {
                     if (Interface.ActivarUsuario(Usuario))
                     {
                         MessageBox.Show("Usuario activado con éxito", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                         RefrescarData();
                     }
                     else
                     {
                         MessageBox.Show("Hubo un problema con la base de datos", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                     }
                 }
             }
             else
             {
                 MessageBox.Show("No puede activar su propio Usuario", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
             }
         }
     }
 }
        public RegistroPedido PedirPedido(out bool Cancelado)
        {
            InterfaceUsuario Interface = new InterfaceUsuario(this);

            Validacion = new Validar(this);
            tbNumEmpleado.MaxLength = 10;
            bool Cerrado = true;

            tbNumEmpleado.KeyPress += delegate(object sender, KeyPressEventArgs e)
            {
                if (e.KeyChar == 13 || e.KeyChar == Convert.ToChar(Keys.Escape))
                {
                    if (!Validacion.ValidarTextBox(tbNumEmpleado))
                    {
                        Close();
                        Cerrado = false;
                    }
                    if (e.KeyChar == Convert.ToChar(Keys.Escape))
                    {
                        Close();
                        Cerrado = true;
                    }
                }
            };
            ShowDialog();
            Cancelado = Cerrado;
            RegistroPedido temp = null;

            if (!Cerrado)
            {
                temp = Interface.ObtenerUnPedido(tbNumEmpleado.Text);
            }
            return(temp);
        }
Esempio n. 8
0
 private void LlenarMateriales(DataGridViewComboBoxCell Celda, RegistroMaterial Material1)
 {
     Interface = new InterfaceUsuario(this);
     if (Celda.ColumnIndex == dgvProductos.Columns["Material1"].Index || Celda.ColumnIndex == dgvProductos.Columns["Material2"].Index)
     {
         Celda.Items.Clear();
         Celda.Value = null;
         (dgvProductos[dgvProductos.Columns["Material2"].Index, Celda.RowIndex] as DataGridViewComboBoxCell).Items.Clear();
         (dgvProductos[dgvProductos.Columns["Material2"].Index, Celda.RowIndex] as DataGridViewComboBoxCell).Value = null;
         dgvProductos[4, Celda.RowIndex].Value = null;
     }
     RegistroProMat[] temp = Interface.ObtenerProMat(-1, ObtenerProducto(Celda.RowIndex)?.Clave ?? -1);
     for (int i = 0; i < temp?.Length; i++)
     {
         if (temp[i]?.Activo == 1)
         {
             for (int k = 0; k < Materiales?.Length; k++)
             {
                 if (temp[i]?.ClaveMat != Material1?.Clave && Materiales[k].Activo == 1 && Materiales[k].Nombre == temp[i].Material)
                 {
                     (dgvProductos?[Celda.ColumnIndex, Celda.RowIndex] as DataGridViewComboBoxCell).Items.Add(temp[i].Material + " $" + temp[i].Precio);
                     k = Materiales.Length;
                 }
             }
         }
     }
     if (Celda.Items.Count == 0)
     {
         Celda.Items.Add("");
     }
     if ((dgvProductos[dgvProductos.Columns["Material2"].Index, Celda.RowIndex] as DataGridViewComboBoxCell).Items.Count == 0)
     {
         (dgvProductos[dgvProductos.Columns["Material2"].Index, Celda.RowIndex] as DataGridViewComboBoxCell).Items.Add("");
     }
 }
Esempio n. 9
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            bool CamposVacios = false || Validaciones.ValidarComboBox(tbBanco);

            CamposVacios = Validaciones.ValidarMaskedTextBox(tbTarjeta) || CamposVacios;
            CamposVacios = Validaciones.ValidarTextBox(tbNombre, tbApellido);
            if (CamposVacios)
            {
                MessageBox.Show("Favor de llenar la información correctamente", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            }
            else
            {
                Interface = new InterfaceUsuario(this);
                tbTarjeta.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;
                RegistroTarjeta Tarjeta = ObtenerRegistro;
                if (Interface.ActualizarTarjeta(Tarjeta))
                {
                    MessageBox.Show("La tarjeta fue actualizada con éxito", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                    Close();
                }
                else
                {
                    MessageBox.Show("Se presentó algún error, por favor vuelva a interntarlo más tarde", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                }
            }
        }
Esempio n. 10
0
 private void ActualizarData()
 {
     Interface = new InterfaceUsuario(this);
     Interface.ObtenerProductos(dtvDatos2);
     valida = new Validar(this);
     valida.validarData(dtvDatos2);
 }
        private void btnEliminarMaterial_Click(object sender, EventArgs e)
        {
            PantallaPedirInformación temp      = new PantallaPedirInformación();
            bool             Cancelado         = true;
            RegistroMaterial MaterialAEliminar = temp.PedirMaterial(out Cancelado);

            if (!Cancelado)
            {
                if (MaterialAEliminar == null)
                {
                    if (DialogResult.Yes == MessageBox.Show("No se encontró el Material a eliminar\n\n¿desea ver una lista de todos los materiales?", "AVISO", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1))
                    {
                        btnModificarMaterial_Click(sender, e);
                    }
                }
                else
                {
                    if (!Validar.ValidarUnaPantalla(new PantallaEliminarProducto(null).GetType()))
                    {
                        Interface = new InterfaceUsuario(this);
                        Interface.DesplegarPantallaEliminarMaterial(MaterialAEliminar);
                    }
                }
            }
        }
 public PantallaAdministrarUsuarios(string user) : base()
 {
     InitializeComponent();
     ActualizarData();
     Usuario   = user;
     Interface = new InterfaceUsuario(this);
 }
Esempio n. 13
0
 private void btnAceptar_Click(object sender, EventArgs e)
 {
     Interface = new InterfaceUsuario(this);
     //Cambiar Validar campos por validacio por separado
     if (!Validaciones.ValidarCampos())
     {
         tbTarjeta.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;
         if (!Interface.ValidarDatosTarjeta(User))
         {
             if (!SacandoRegistro)
             {
                 RegistroTarjeta Tarjeta = ObtenerRegistro;
                 if (Interface.AgregarTarjeta(Tarjeta))
                 {
                     MessageBox.Show("Tarjeta registrada con éxito", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
                 }
                 else
                 {
                     MessageBox.Show("Hubo algun problema, intente más tarde", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
                 }
             }
         }
         this.Close();
     }
 }
Esempio n. 14
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     if (!ValidarCampos)
     {
         Interface = new InterfaceUsuario(this);
         RegistroProducto Modificar = ObtenerRegistro;
         Modificar.Clave = Convert.ToInt32(tbClave.Text);
         if (Interface.ActualizarProducto(Modificar))
         {
             if (Interface.ObtenerUnProducto(Modificar.Nombre).Clave == Modificar.Clave)
             {
                 string msg = "";
                 if (!ActualizarProMat(out msg))
                 {
                     MessageBox.Show("Producto actualizado con éxito", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
                     Validar.MensajeErrorBaseDeDatos();
                 }
                 LlamarEventoCerrar();
                 Close();
             }
             else
             {
                 Validar.MensajeErrorOK("El nombre " + Modificar.Nombre + " ya ha sido usado y no puede repetirse");
             }
         }
         else
         {
             Validar.MensajeErrorBaseDeDatos();
         }
     }
 }
Esempio n. 15
0
        private void cbTrabaja_SelectedIndexChanged(object sender, EventArgs e)
        {
            cbLabora.DropDownStyle = ComboBoxStyle.DropDownList;
            Interface = new InterfaceUsuario(this);
            int    renglon = Convert.ToInt32(dtvDatos.CurrentCell.RowIndex.ToString());
            string valor = "", estado = "", user = "";
            string id = dtvDatos[0, renglon].Value.ToString();

            estado = dtvDatos[7, renglon].Value.ToString();
            valor  = cbLabora.SelectedItem.ToString();
            user   = cbLabora.SelectedItem.ToString();

            if (clabora == user && estado == "En Proceso")
            {
                MessageBox.Show("No se puede asignar el pedido a " + user + " por que el pedido ya está lo tiene asignado y está en proceso", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ;
            }
            else
            {
                if (clabora == "No asignado")
                {
                    clabora = "";
                }
                if (!Interface.PedidosEnProcesoPorUsuario(user, estado))
                {
                    Interface.CambiarLaboratorista(dtvDatos, valor, clabora, id);
                    ActualizarData();
                }
            }
        }
Esempio n. 16
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (!Validar.ValidarUnaPantalla(new PantallaModificarPedido(null).GetType()))
     {
         RegistroPedido Pedido = null;
         Interface = new InterfaceUsuario(this);
         bool Cancelado = false;
         if (dtvDatos.CurrentCell != null)
         {
             Pedido = Interface.ObtenerUnPedido(dtvDatos[0, dtvDatos.CurrentCell.RowIndex]?.Value?.ToString() ?? "-20");
         }
         else
         {
             PantallaPedirInformación t = new PantallaPedirInformación();
             Pedido = t.PedirPedido(out Cancelado);
         }
         if (!Cancelado)
         {
             if (Pedido != null)
             {
                 Interface.DesplegarPantallaModificarPedido(Pedido);
             }
             else
             {
                 Validar.MensajeErrorOK("Pedido no válido");
             }
         }
     }
 }
Esempio n. 17
0
 private void btnAgregarDentista_Click(object sender, System.EventArgs e)
 {
     if (!Validar.ValidarUnaPantalla(new PantallaAgregarDentista().GetType()))
     {
         Interface = new InterfaceUsuario(this);
         Interface.DesplegarPantallaAgregarDentista();
     }
 }
Esempio n. 18
0
 protected virtual void InitializeComponent3()
 {
     Interface  = new InterfaceUsuario(this);
     Productos  = Interface.ObtenerProductos();
     Materiales = Interface.ObtenerMateriales();
     LlenarProductos(dgvProductos[0, 0] as DataGridViewComboBoxCell);
     tbTelefono.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;
 }
Esempio n. 19
0
 private void btnAgregarProducto_Click(object sender, EventArgs e)
 {
     Interface = new InterfaceUsuario(this);
     if (!Validar.ValidarUnaPantalla(new PantallaAgregarProducto().GetType()))
     {
         Interface.DesplegarPantallaAgregarProducto(LlenarData);
     }
 }
 private void btnAgregarMaterial_Click(object sender, EventArgs e)
 {
     if (!Validar.ValidarUnaPantalla(new PantallaAgregarMaterial().GetType()))
     {
         Interface = new InterfaceUsuario(this);
         Interface.DesplegarPantallaAgregarMaterial(null);
     }
 }
Esempio n. 21
0
 private void btnAgregarPedido_Click(object sender, System.EventArgs e)
 {
     if (!Validar.ValidarUnaPantalla(new PantallaRegistrarPedido("").GetType()))
     {
         Interface = new InterfaceUsuario(this);
         Interface.DesplegarPantallaRegistrarPedido(Usuario);
     }
 }
Esempio n. 22
0
 public PantallaEstadoPedido(string User)
 {
     InitializeComponent();
     ActualizarData();
     Usuario     = User;
     Interface   = new InterfaceUsuario(this);
     tipoUsuario = Interface.ObtenerTipoUser(Usuario);
 }
 private void button1_Click(object sender, EventArgs e)
 {
     if (!Validar.ValidarUnaPantalla(new PantallaRegistrarPedido(null).GetType()))
     {
         Interface = new InterfaceUsuario(this);
         Interface.DesplegarPantallaRegistrarPedido(Usuario);
     }
 }
 private void btnModificarMaterial_Click(object sender, EventArgs e)
 {
     if (!Validar.ValidarUnaPantalla(new PantallaAdministrarMateriales().GetType()))
     {
         Interface = new InterfaceUsuario(this);
         Interface.DesplegarPantallaAdministrarMateriales();
     }
 }
Esempio n. 25
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (!Validar.ValidarUnaPantalla(new PantallaAdministrarProducto().GetType()))
     {
         Interface = new InterfaceUsuario(this);
         Interface.DesplegarPantallaAdministrarProductos();
     }
 }
 private void btnCambiarTiempos_Click(object sender, EventArgs e)
 {
     if (!Validar.ValidarUnaPantalla(new PantallaCambiarTiempos().GetType()))
     {
         Interface = new InterfaceUsuario(this);
         Interface.DesplegarPantallaCambiarTiempos();
     }
 }
 private void btnModificarMaterial_Click(object sender, EventArgs e)
 {
     if (!Validar.ValidarUnaPantalla(new PantallaModificarMaterial(null).GetType()))
     {
         Interface = new InterfaceUsuario(this);
         RegistroMaterial Producto = Interface.ObtenerUnMaterial(Convert.ToInt32(dgvMateriales[0, dgvMateriales.CurrentRow.Index].Value));
         Interface.DesplegarPantallaModificarMaterial(Producto, LlenarData);
     }
 }
Esempio n. 28
0
 private void btnModificarProducto_Click(object sender, EventArgs e)
 {
     if (!Validar.ValidarUnaPantalla(new PantallaModificarProducto(null).GetType()))
     {
         Interface = new InterfaceUsuario(this);
         RegistroProducto Producto = Interface.ObtenerUnProducto(dgvProductos[1, dgvProductos.SelectedCells[0].RowIndex].Value.ToString());
         Interface.DesplegarPantallaModificarProducto(Producto, LlenarData);
     }
 }
 private void btnModificarUsuario_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(ObtenerUsuario))
     {
         Interface = new InterfaceUsuario(this);
         Interface.DesplegarPantallaModificarUsuario(ObtenerUsuario, true);
         RefrescarData();
     }
 }
Esempio n. 30
0
        private void ActualizarPantalla()
        {
            Interface      = new InterfaceUsuario(this);
            lblSesión.Text = "Usuario: " + Usuario;
            RegistroUsuario temp;

            Interface.RecuperarUsuario(Usuario, out temp);
            PantallaLogin.Sesión = temp;
            bool Tarjeta = Interface.ValidarDatosTarjeta(Usuario);

            if (Tarjeta)
            {
                btnAgregarTarjeta.Visible  = lblAgregarTarjeta.Visible = false;
                btnEliminarTarjeta.Visible = btnModificarTarjeta.Visible = lblEliminarTarjeta.Visible = lblModificarTarjeta.Visible = true;
            }
            else
            {
                btnAgregarTarjeta.Visible  = lblAgregarTarjeta.Visible = true;
                btnEliminarTarjeta.Visible = btnModificarTarjeta.Visible = lblEliminarTarjeta.Visible = lblModificarTarjeta.Visible = false;
            }
            if (Interface.EsAdministrador(Usuario))
            {
                lblAdmi.Visible              = btnRegistrarEmpleado.Visible = lblAgregarEmpleado.Visible = btnEliminarUsuario.Visible = lblEliminarUsuario.Visible = true;
                lblUsuario.Location          = new Point(207, 147);
                btnModificarUsuario.Location = new Point(192, 195);
                lblModificarUsuario.Location = new Point(205, 310);
                lblTarjeta.Location          = new Point(649, 147);
                btnAgregarTarjeta.Location   = new Point(634, 195);
                lblAgregarTarjeta.Location   = new Point(652, 310);
                btnModificarTarjeta.Location = new Point(560, 195);
                lblModificarTarjeta.Location = new Point(575, 310);
                btnEliminarTarjeta.Location  = new Point(716, 195);
                lblEliminarTarjeta.Location  = new Point(731, 310);

                Size = new Size(873, 470);
            }
            else
            {
                lblAdmi.Visible = btnRegistrarEmpleado.Visible = lblAgregarEmpleado.Visible = btnEliminarUsuario.Visible = lblEliminarUsuario.Visible = false;

                lblUsuario.Location          = new Point(65, 147);
                btnModificarUsuario.Location = new Point(54, 195);
                lblModificarUsuario.Location = new Point(62, 310);
                lblTarjeta.Location          = !Tarjeta ? new Point(414, 147) : new Point(350, 147);
                btnAgregarTarjeta.Location   = !Tarjeta ? new Point(395, 195) : new Point(331, 195);
                lblAgregarTarjeta.Location   = !Tarjeta ? new Point(410, 310) : new Point(346, 310);
                btnModificarTarjeta.Location = new Point(270, 195);
                lblModificarTarjeta.Location = new Point(285, 310);
                btnEliminarTarjeta.Location  = new Point(395, 195);
                lblEliminarTarjeta.Location  = new Point(410, 310);

                Size = new Size(573, 470);
            }
            this.CenterToScreen();
        }