public void Actualizar(Entidades.Vendedor Entidad) { try { SqlCommand sqlCommand = new SqlCommand("proc_PRODUCTOSUpdate", Conexion.SqlConnection); sqlCommand.CommandTimeout = 20; sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.AddWithValue("@IdVendedor", Entidad.IdVendedor); sqlCommand.Parameters.AddWithValue("@NombVendedor", Entidad.NombreVendedor); sqlCommand.Parameters.AddWithValue("@IdJefe", Entidad.IdJefe); sqlCommand.Parameters.AddWithValue("@Oficina", Entidad.Oficina); sqlCommand.Parameters.AddWithValue("@Comision", Entidad.Comision); if (Conexion.SqlConnection.State == System.Data.ConnectionState.Closed) { Conexion.SqlConnection.Open(); } sqlCommand.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show("No se pudo Escribir " + ex.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } finally { if (Conexion.SqlConnection.State == System.Data.ConnectionState.Open) { Conexion.SqlConnection.Close(); } } }
public frmAltaVendedor(int Id) { InitializeComponent(); Vendedor = LogicaVendedor.TraerVendedor(Id); txtApellido.Text = Vendedor.Apellido; txtNombre.Text = Vendedor.Nombre; Modificar = true; btnAgregar.Text = "Modificar"; }
private void IconButton_Vendedor_Click(object sender, EventArgs e) { if (Vendedor == null) { Vendedor = new Entidades.Vendedor(); } Config.Forms.FormVendedorBuscar form = new Config.Forms.FormVendedorBuscar(TextBox_Vendedor.Text); form.StartPosition = FormStartPosition.CenterScreen; form.ShowInTaskbar = false; form.ShowDialog(); if (idVendedor == 0) { TextBox_Vendedor.Text = string.Empty; } else { TextBox_Vendedor.Text = idVendedor.ToString(); } }
public object CreateReport() { var list = new Datos.Vendedor(); var result = list.Mostrar(); _ = result.Tables[0].Columns.Count; ListObj = new List <Entidades.Vendedor>(); foreach (System.Data.DataRow rows in result.Tables[0].Rows) { var ObjModel = new Entidades.Vendedor() { IdVendedor = Convert.ToInt32(rows[0]), NombreVendedor = Convert.ToString(rows[1]), Oficina = Convert.ToString(rows[3]), Comision = Convert.ToSingle(rows[4]) }; ListObj.Add(ObjModel); } return(ListObj); }
private void Agregar() { if (objEntidad == null) { objEntidad = new Entidades.Vendedor(); } objEntidad.NombreVendedor = TB_Nombre.Text; objEntidad.Oficina = TB_Oficina.Text; objEntidad.Comision = float.Parse(TB_Comision.Text); if (objNegocio == null) { objNegocio = new Negocios.Vendedor(); } objNegocio.Registrar(objEntidad); MessageBox.Show("Registro agregado con exito.", "Agregado", MessageBoxButtons.OK, MessageBoxIcon.Information); Clear(); }
public void Actualizar(Entidades.Vendedor entidad) { obj = new Datos.Vendedor(); obj.Actualizar(entidad); }
public void Registrar(Entidades.Vendedor entidad) { obj = new Datos.Vendedor(); obj.Registrar(entidad); }