public ListaDocVentas GetDocVentas(DAConnectionSQL ObjDaConnexion, ProductoXCB ObjProducto, Int32 Cod_Cli, int TipoFecha) { ListaDocVentas ObjListaDocVentas = new ListaDocVentas(); string StrinSQL = ""; //var ConClass = new DAConnectionSQL(); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.Text; cmd.Connection = ObjDaConnexion.Con; StrinSQL = "exec[SP_GET_DocumentoData]"; StrinSQL = StrinSQL + " '" + ObjProducto.Referencia + "', '" + ObjProducto.Color + "',"; StrinSQL = StrinSQL + " '" + ObjProducto.Talla + "', '" + Cod_Cli + "', " + TipoFecha + ""; cmd.CommandText = StrinSQL; if (ObjDaConnexion.Con.State == ConnectionState.Closed) { ObjDaConnexion.Open(); } SqlDataReader dr = cmd.ExecuteReader(); try { while (dr.Read()) { DocVentas ObjDocVentas = new DocVentas(); var withBlock = ObjDocVentas; withBlock.FechaDoc = dr.GetDateTime(0).ToString(); withBlock.Serie = dr.GetString(1); withBlock.Numero = dr.GetInt32(2); withBlock.TotalDocumento = dr.GetDouble(3); withBlock.DiasFac = dr.GetInt32(4); ObjListaDocVentas.Add(ObjDocVentas); } dr.Close(); } catch (Exception) { dr.Close(); } return(ObjListaDocVentas); }
public ProductoXCB GetProductoxCodigo(DAConnectionSQL ObjDaConnexion, string CodigoBarra) { ProductoXCB ObjProductoCXB = new ProductoXCB(); //var ConClass = new DAConnectionSQL(); SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.Text; cmd.Connection = ObjDaConnexion.Con; cmd.CommandText = "SP_Get_ArticuloXCodigoBarra '" + CodigoBarra + "' "; if (ObjDaConnexion.Con.State == ConnectionState.Closed) { ObjDaConnexion.Open(); } SqlDataReader dr = cmd.ExecuteReader(); try { while (dr.Read()) { //MotivosDevolucion ObjMotivoDev = new MotivosDevolucion(); var withBlock = ObjProductoCXB; withBlock.CodigoArticulo = (dr.GetInt32(0).ToString()); withBlock.BarCoder = (dr.GetString(1).ToString()); withBlock.NombreArticulo = dr.GetString(4); withBlock.Referencia = dr.GetString(5); withBlock.Talla = dr.GetString(6); withBlock.Color = dr.GetString(7).ToString(); //ObjListaMotivosDev.Add(ObjMotivoDev); } dr.Close(); } catch (Exception ex) { dr.Close(); System.Windows.Forms.MessageBox.Show("Error" + ex.Message); } return(ObjProductoCXB); }
private void txt_Codart_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (Char)13) { if (txt_Codart.Text == "") { TxtDescripcion.Text = ""; TxtCodArticulo.Text = ""; txtReferencia.Text = ""; TxtColor.Text = ""; txtTalla.Text = ""; } else { ProductoXCB ObjProductoCB = new ProductoXCB(); ObjProductoxCB = ObjProcDB.GetProductoxCodigo(ObjDaConnexion, txt_Codart.Text); if (ObjProductoxCB.CodigoArticulo != null) { TxtDescripcion.Text = ObjProductoxCB.NombreArticulo; TxtCodArticulo.Text = ObjProductoxCB.CodigoArticulo; Cod_Art = ObjProductoxCB.Referencia; txtReferencia.Text = ObjProductoxCB.Referencia; TxtColor.Text = ObjProductoxCB.Color.ToString(); txtTalla.Text = ObjProductoxCB.Talla.ToString(); txt_Codart.SelectAll(); } else { MessageBox.Show("No Existe el ArtÃculo", "Información", MessageBoxButtons.OK, MessageBoxIcon.Warning); txt_Codart.SelectAll(); } } } }