Пример #1
0
        private void BtnDeleteEmployee_Click(object sender, EventArgs e)
        {
            int i = dgvSupplier.CurrentCell.RowIndex;

            if (i >= 0)
            {
                supplier sup_aux = new supplier();
                sup_aux       = suppliers[i];
                sup_aux.state = 0;
                serviceDA.updateSupplier(sup_aux);
                updateDataGridView();
                MessageBox.Show("Se ha eliminado el proveedor seleccionado");
            }
            else
            {
                MessageBox.Show("Seleccione un proveedor");
            }
        }
Пример #2
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            supplier s    = new supplier();
            String   name = comboBox1.Text;
            entities ent  = new entities();

            s = (from wa in ent.suppliers
                 where wa.supplier_name == name
                 select wa).First();



            textBox1.Text = s.fax;
            textBox2.Text = s.telephone;
            textBox3.Text = s.mobile;
            textBox4.Text = s.email;
            textBox5.Text = s.website;
        }
Пример #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     try {
         entities ent = new entities();
         supplier s   = new supplier();
         s.supplier_name = comboBox1.Text;
         s.fax           = textBox1.Text;
         s.telephone     = textBox2.Text;
         s.mobile        = textBox3.Text;
         s.email         = textBox4.Text;
         s.website       = textBox5.Text;
         ent.suppliers.Add(s);
         ent.SaveChanges();
         MessageBox.Show("suppllier added");
         comboBox1.Text = textBox1.Text = textBox2.Text = textBox3.Text = textBox4.Text = textBox5.Text = string.Empty;
     }
     catch
     {
         MessageBox.Show("failed");
     }
 }
Пример #4
0
        private void BtnModifyEmployee_Click(object sender, EventArgs e)
        {
            int i = dgvSupplier.CurrentCell.RowIndex;

            if (i >= 0)
            {
                ModifySupplierForm modifySup = new ModifySupplierForm();
                modifySup.currentSupplier = new supplier();
                supplier e1 = new supplier();
                serviceDAA = new DBControllerWSClient();
                e1         = serviceDAA.querySupplierByCode(dgvSupplier.Rows[i].Cells[0].Value.ToString());
                modifySup.currentSupplier = e1;
                modifySup.ShowDialog();
                updateDataGridView();
            }
            else
            {
                MessageBox.Show("Seleccione un proveedor");
            }

            /*
             * ModifySupplierForm modifySupForm = new ModifySupplierForm();
             * modifySupForm.ShowDialog();*/
        }
        private bool filledValues()
        {
            if (txtRuc.Text.Length != 11)
            {
                MessageBox.Show("Ingrese un RUC válido");
                return(false);
            }
            if (txtRuc.Text.Length == 11)
            {
                int result = 0;
                if (!Regex.Match(txtRuc.Text, @"([0-9]{3,})").Success)
                {
                    MessageBox.Show("Ha ingresado caracteres no numericos en el campo RUC, ingrese 11 caracteres numericos");
                    return(false);
                }
            }
            if (txtNombre.Text == "" || txtNombre.Text.Length < 2)
            {
                MessageBox.Show("Ingrese un nombre válido");
                return(false);
            }
            if (txtDireccion.Text == "" || txtDireccion.Text.Length < 10)
            {
                MessageBox.Show("Ingrese una dirección válida");
                return(false);
            }
            if (txtCuenta.Text == "" || txtCuenta.Text.Length != 16)
            {
                MessageBox.Show("Ingrese un número de cuenta válido de 16 caracteres");
                return(false);
            }
            if (txtTelefono.Text == "" || txtTelefono.Text.Length < 6)
            {
                MessageBox.Show("Ingrese un numero de telefono válido mayor a 6 caracteres");
                return(false);
            }
            if (txtTelefono.Text.Length >= 6)
            {
                int result = 0;
                if (!Regex.Match(txtRuc.Text, @"([0-9]{3,})").Success)
                {
                    MessageBox.Show("Ingrese un numero de telefono con solo caracteres númericos");
                    return(false);
                }
            }
            if (txtEmail.Text == "" || !txtEmail.Text.Contains("@") || !txtEmail.Text.Contains("."))
            {
                MessageBox.Show("Ingrese un email válido");
                return(false);
            }
            if (txtPersonaContacto.Text == "")
            {
                MessageBox.Show("Complete la persona contacto del proveedor");
                return(false);
            }
            if (txtCodProv.Text == "")
            {
                MessageBox.Show("Complete el código del proveedor");
                return(false);
            }
            if (txtTerminoVenta.Text == "")
            {
                MessageBox.Show("Complete el término de venta del proveedor");
                return(false);
            }

            Cursor.Current = Cursors.WaitCursor;
            serviceDA      = new DBControllerWSClient();
            supplier c = serviceDA.querySupplierByCode(txtRuc.Text);

            Cursor.Current = Cursors.Arrow;
            if (c.address != null)
            {
                MessageBox.Show("Ya existe un proveedor con ese RUC");
                return(false);
            }

            return(true);
        }