コード例 #1
0
ファイル: Proveedor.cs プロジェクト: njguibert/Facturacion
 private void txtcodigo_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F1)
     {
         MessageBox.Show("Buscar por nombre");
     }
     if (e.KeyCode == Keys.Enter)
     {
         p = c.FindbyCodigo(Convert.ToInt32(txtcodigo.Text));
         if (p != null)
         {
             //Si existe cargo la informacion
             txtnombre.Text = p.nombre;
             txtrazon.Text = p.razonsocial;
             txtciudad.Text = p.ciudad;
             txtdireccion.Text = p.direccion;
             txtobs.Text = p.observacion;
             txttel.Text = p.telefono.ToString();
             txtcel.Text = p.celular.ToString();
             txtrut.Text = p.rut.ToString();
         }
         else
         {
             DialogResult dialogo = MessageBox.Show("Proveedor no encontrado, es nuevo?", "Nuevo Proveedor?", MessageBoxButtons.YesNo);
             if (dialogo == DialogResult.Yes)
             {
                 txtnombre.Focus();
             }
         }
     }
 }
コード例 #2
0
 public bool crearProveedor(Proveedor p)
 {
     ModeloDominioContainer modelo = new ModeloDominioContainer();
        Proveedor pr =(Proveedor)modelo.Empresas.FirstOrDefault(c => c.id == p.id);
        if (pr != null)
        {
        modelo.Empresas.Attach(modelo.Empresas.Single(c => c.id == p.id));
        modelo.Empresas.ApplyCurrentValues(p);
        }
     modelo.SaveChanges();
     return true;
 }
コード例 #3
0
ファイル: Proveedor.cs プロジェクト: njguibert/Facturacion
 private void button1_Click(object sender, EventArgs e)
 {
     if (p==null) p= new Facturacion.CapaDatos.Proveedor();
     p.nombre = txtnombre.Text;
     p.observacion = txtobs.Text;
     p.razonsocial = txtrazon.Text;
     p.rut = Convert.ToInt64(txtrut.Text.ToString());
     p.telefono = Convert.ToInt32(txttel.Text.ToString());
     p.celular = Convert.ToInt32(txtcel.Text.ToString());
     p.ciudad = txtciudad.Text;
     p.direccion = txtdireccion.Text;
     if (c.crearProveedor(p))
     {
         MessageBox.Show("Proveedor Agregado Correctamente", "Mensaje del Sistema", 0, MessageBoxIcon.Information);
         Utilitarios.ResetearControlesDeFormularios(this);
         txtcodigo.Focus();
     }
     else
     {
         MessageBox.Show("ERROR al agregar Proveedor!", "Mensaje del Sistema", 0, MessageBoxIcon.Error);
     }
     p = null;
 }
コード例 #4
0
 /// <summary>
 /// Crear un nuevo objeto Proveedor.
 /// </summary>
 /// <param name="id">Valor inicial de la propiedad id.</param>
 /// <param name="ciudad">Valor inicial de la propiedad ciudad.</param>
 /// <param name="nombre">Valor inicial de la propiedad nombre.</param>
 public static Proveedor CreateProveedor(global::System.Int32 id, global::System.String ciudad, global::System.String nombre)
 {
     Proveedor proveedor = new Proveedor();
     proveedor.id = id;
     proveedor.ciudad = ciudad;
     proveedor.nombre = nombre;
     return proveedor;
 }