public DataTable AgregarPantalon(Pantalon p) { try { if (dt != null) { DataRow filaPantalon = this.dt.NewRow(); DataColumnCollection dataColumn = this.dt.Columns; filaPantalon[dataColumn["producto"]] = "Pantalon"; filaPantalon[dataColumn["talle"]] = p.Talle; filaPantalon[dataColumn["codigo"]] = p.CodigoDeBarra; // filaPantalon[dataColumn["color"]] = DBNull.Value; filaPantalon[dataColumn["tipo"]] = p.Tipo; this.dt.Rows.Add(filaPantalon); } else { throw new IniciarTablaException(); } } catch (Exception) { } return(this.dt); }
public static bool ImprimirFactura(Pantalon p) { bool retorno = false; try { StreamWriter sw = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\pantalones.log", true); sw.WriteLine(DateTime.Now); sw.WriteLine(p.ToString()); sw.Close(); retorno = true; } catch (Exception) { } return(retorno); }