예제 #1
0
        private void btn_agregar_proveedor_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ProveedorDAO prove = new ProveedorDAO();

                if (txt_fono_proveedor.Text != "" && txt_nombre_proveedor.Text != "" && txt_numero_proveedor.Text != "" && txt_rubro_proveedor.Text != "")
                {
                    Proveedor provee = new Proveedor();
                    provee.Nombproveedor  = txt_nombre_proveedor.Text;
                    provee.Id_proveedor   = Convert.ToInt32(txt_numero_proveedor.Text);
                    provee.Fonoproveedor  = Convert.ToInt32(txt_fono_proveedor.Text);
                    provee.Rubroproveedor = txt_rubro_proveedor.Text;



                    if (prove.ExisteProveedor(provee.Id_proveedor) == true)
                    {
                        notifier.ShowInformation("El proveedor ya existe", options);
                    }
                    else
                    {
                        prove.insertar_proveedor(provee);
                        notifier.ShowSuccess("Se a guardado el proveedor", options);

                        this.Close();
                    }
                }
                else
                {
                    notifier.ShowWarning("Debe ingresar todos los campos, son obligatorios", options);
                }
            }
            catch (Exception)
            {
                notifier.ShowWarning("Debes Ingresar los datos como corresponden, numero de proveedor y fono son de tipo numericos, el nombre y rubro pueden contener letras y numeros ", options);
            }
        }