コード例 #1
0
 private void FrmUsuariosEd_Load(object sender, EventArgs e)
 {
     // TODO: esta línea de código carga datos en la tabla 'gestionCafeteriaDataSet1.Tipo_Usuario' Puede moverla o quitarla según sea necesario.
     this.tipo_UsuarioTableAdapter.Fill(this.gestionCafeteriaDataSet1.Tipo_Usuario);
     if (usuario != null)
     {
         TxtIdUsuario.Text            = usuario.IdUsuario.ToString();
         TxtNombre.Text               = usuario.Nombre;
         txtClave.Text                = usuario.Clave;
         txtClave.PasswordChar        = '*';
         txtClave.Enabled             = false;
         TxtCedula.Text               = usuario.Cedula;
         CbxTipoUsuario.SelectedIndex = CbxTipoUsuario.FindStringExact(usuario.TipoUsuario);
         TxtLimiteCredito.Text        = usuario.LimiteCredito.ToString();
         DtpFechaRegistro.Value       = usuario.FechaRegistro;
         CbxEstado.SelectedIndex      = CbxEstado.FindStringExact(usuario.Estado);
     }
 }
コード例 #2
0
 private void CbxTalla_Validated(object sender, EventArgs e)
 {
     try
     {
         estado = CbxTalla.SelectedItem.ToString();
         if (estado == "")
         {
             MessageBox.Show("No se ha seleccionado ningun dato", "¡Atencion!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             CbxEstado.Focus();
         }
         else
         {
             CbxTalla.Focus();
         }
     }
     catch
     {
         MessageBox.Show("Valores mal ingresados, seleccione los valores en la flecha", "¡Atención!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         CbxTalla.Text = "";
     }
 }
コード例 #3
0
 private void date_ValueChanged(object sender, EventArgs e)
 {
     fecha = date.Text;
     CbxEstado.Focus();
 }
コード例 #4
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            cont = 0;
            if (txtbNombre.Text == "")
            {
                MessageBox.Show("El campo de Nombre del Uniformes esta vacio", "AVISO", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                txtbNombre.Focus();
                cont++;
            }

            if (txtbPrecioUnitario.Text == "")
            {
                MessageBox.Show("El campo de Precio Unitario esta vacio", "AVISO", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                txtbPrecioUnitario.Focus();
                cont++;
            }

            if (txtbCantidad.Text == "")
            {
                MessageBox.Show("El campo de Cantidad esta vacio", "AVISO", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                txtbPrecioUnitario.Focus();
                cont++;
            }

            if (CbxEstado.Text == "")
            {
                MessageBox.Show("El campo de Estado esta vacio", "AVISO", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                CbxEstado.Focus();
                cont++;
            }

            if (CbxTalla.Text == "")
            {
                MessageBox.Show("El campo de Talla esta vacio", "AVISO", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                CbxTalla.Focus();
                cont++;
            }


            if (cont == 0)
            {
                matSeg1.ReadXml(Application.StartupPath + "\\ArchUniformes.xml");
                object[] vector = new object[10];

                vector[0] = txtbNombre.Text;
                vector[2] = txtbPrecioUnitario.Text;
                vector[3] = txtbCantidad.Text;
                vector[4] = CbxTalla.Text;
                vector[5] = CbxEstado.Text;
                vector[7] = date.Text;
                vector[9] = (cant * precio).ToString();

                LblCod.Text = matSeg1.TblUniformes.Rows.Count.ToString();
                agregar     = int.Parse(LblCod.Text);
                agregar++;
                LblCod.Text = agregar.ToString();
                UniformeCodigo mostrarCodigo = new UniformeCodigo();
                mostrarCodigo.LblCodigo.Text = agregar.ToString();
                matSeg1.TblUniformes.Rows.Add(vector);
                matSeg1.WriteXml(Application.StartupPath + "\\ArchUniformes.xml");
                this.Hide();
                mostrarCodigo.ShowDialog();
                if (mostrarCodigo.DialogResult == DialogResult.OK)
                {
                    MessageBox.Show("Se ha guardado exitosamente", "AVISO", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                }

                /* if (Datos.Length > 0)
                 * {
                 *   MessageBox.Show("El material de seguridad ya esta registrado");
                 *   this.Close();
                 *
                 * }
                 * else
                 * {
                 *   matSeg1.TblUniformes.Rows.Add(vector);
                 *   matSeg1.WriteXml(Application.StartupPath + "\\ArchUniformes.xml");
                 *   MessageBox.Show("Se ha guardado exitosamente", "AVISO", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                 *   this.DialogResult = System.Windows.Forms.DialogResult.OK;
                 *   this.Close();
                 * }*/
            }
        }