public frmFormulasV2(int IdFormula) { InitializeComponent(); this.IdFormula = IdFormula; ribbonPageGroup2.Visible = (IdFormula > 0); btnBaja.Visibility = (IdFormula > 0) ? BarItemVisibility.Always : BarItemVisibility.Never; string connectionString = ConfigurationManager.ConnectionStrings["sdprolizaEntitiessp"].ConnectionString; cnDetallesFormulas = new CNDetallesFormulas(connectionString); cnFormulas = new CNFormulas(connectionString); reporteador = new Reporteador(connectionString); cnProductos = new CNProductos(connectionString); cnTipoDeCambio = new CNTipoDeCambio(connectionString); cnFamiliaFormulas = new CNFamiliaFormulas(connectionString); cnInsumos = new CNInsumos(connectionString, -1, null, false, 0); llenarComboFamilia(); llenarComboUnidadMedida(); llenarComboInsumos(); if (IdFormula > 0) { DataTable Formula = cnFormulas.ConsultaPorId(IdFormula); txtFormula.Text = Formula.Rows[0]["NombreFormula"].ToString(); txtFormula.Properties.ReadOnly = (Convert.ToInt32(Formula.Rows[0]["IdFamilia"]) == 1); cmbFamilia.EditValue = Convert.ToInt32(Formula.Rows[0]["IdFamilia"]); txtCantidad.Text = Formula.Rows[0]["Cantidad"].ToString(); cmbUnidadMedida.EditValue = Formula.Rows[0]["Capacidad"].ToString(); foreach (DataRow item in cnDetallesFormulas.ConsultaPorFormula(IdFormula).Rows) { AgregarNuevoRegistro(Convert.ToInt32(item["IdDetalle"]), Convert.ToInt32(item["IdInsumo"]), item["CantidadInsumo"].ToString(), item["UnidadMedidaInsumo"].ToString()); } } }
public frmFamilias() { InitializeComponent(); string connectionString = ConfigurationManager.ConnectionStrings["sdprolizaEntitiessp"].ConnectionString; cnFamiliaFormulas = new CNFamiliaFormulas(connectionString); cnProveedores = new CNProveedores(connectionString); cnFamiliaInsumos = new CNFamiliaInsumos(connectionString); cnTipoDeCambio = new CNTipoDeCambio(connectionString); cnUsuarios = new CNUsuarios(connectionString); }