/// <summary> /// Envia los cambios del tpu_ComprobantesDataset a la base de datos. /// </summary> public static void Update(tpu_ComprobantesDataset dataSet) { ApplicationAssert.Check(dataSet != null, "El argumento dataSet no debe ser nulo.", ApplicationAssert.LineNumber); ApplicationAssert.Check(dataSet.tpu_Comprobantes.Rows.Count > 0, "La tabla dataSet.tpu_ComprobantesDataTable debe poseer alguna fila.", ApplicationAssert.LineNumber); mz.erp.dataaccess.tpu_Comprobantes.Update(dataSet); }
private static string UpdateNumero(tpu_ComprobantesDataset data, string IdTransaction) { foreach (System.Data.DataRow row1 in data.tpu_Comprobantes.Rows) { if (true) { string numeracion = Variables.GetValueStringWithoutCache("Comprobantes.Numeracion." + (string)row1["IdTipoDeComprobante"], IdTransaction); string Numero = Util.StcZero(numeracion, 8); row1["Numero"] = Numero; sy_VariablesDataset.sy_VariablesRow row = mz.erp.businessrules.sy_Variables.GetByPk("Comprobantes.Numeracion." + row1["IdTipoDeComprobante"], IdTransaction); return(row.IdVariable); } } return(null); }
public static tpu_ComprobantesDataset GetList( ) { tpu_ComprobantesDataset data = new tpu_ComprobantesDataset(); SqlDataAdapter adapter = new SqlDataAdapter(); adapter.TableMappings.Add("Table", "tpu_Comprobantes"); SqlCommand cmd = new SqlCommand("Pr_tpu_Comprobantes_Search", dbhelper.Connection.GetConnection()); cmd.CommandType = CommandType.StoredProcedure; adapter.SelectCommand = cmd; adapter.Fill(data); return(data); }
public static tpu_ComprobantesDataset.tpu_ComprobantesRow GetByPk(string IdComprobante) { tpu_ComprobantesDataset data = new tpu_ComprobantesDataset(); SqlCommand cmd = new SqlCommand("Pr_tpu_Comprobantes_GetByPk", dbhelper.Connection.GetConnection()); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@IdComprobante", SqlDbType.VarChar)); cmd.Parameters["@IdComprobante"].Value = IdComprobante; SqlDataAdapter adapter = new SqlDataAdapter(cmd); adapter.TableMappings.Add("Table", "tpu_Comprobantes"); adapter.Fill(data); if (data.tpu_Comprobantes.Rows.Count == 1) { return((tpu_ComprobantesDataset.tpu_ComprobantesRow)data.tpu_Comprobantes.Rows[0]); } return(null); }
public void Commit() { _dataComprobante = new tpu_ComprobantesDataset(); _dataComprobanteDeCompra = new tpu_ComprobantesDeCompraDataset(); _dataComprobanteDetalleDeuda = new tpu_ComprobanteDetalleDeudaDataset(); _dataComprobantesDet = new tpu_ComprobantesDetDataset(); _dataComprobantesDetalleDePagos = new tpu_ComprobanteDetalleDePagosDataset(); foreach (string _idComprobanteAAnular in _idComprobantesAAnular) { if (_idComprobanteAAnular != null && _idComprobanteAAnular != string.Empty) { tpu_ComprobantesDataset.tpu_ComprobantesRow rowAux = businessrules.tpu_Comprobantes.GetByPk(_idComprobanteAAnular); if (rowAux != null) { string IdTipoDeComprobante = rowAux.IdTipoDeComprobante; if (_tableComprobantesAnulacion.ContainsKey(IdTipoDeComprobante)) { string IdTipoDeComprobanteAnula = Convert.ToString(_tableComprobantesAnulacion[IdTipoDeComprobante]); /*tpu_Comprobantes*/ tpu_ComprobantesDataset.tpu_ComprobantesRow rowC = mz.erp.businessrules.tpu_Comprobantes.GetByPk(_idComprobanteAAnular); rowC.IdTipoDeComprobante = IdTipoDeComprobanteAnula; _dataComprobante.tpu_Comprobantes.ImportRow((DataRow)rowC); /*tpu_ComprobantesDeCompra*/ tpu_ComprobantesDeCompraDataset.tpu_ComprobantesDeCompraRow rowCC = mz.erp.businessrules.tpu_ComprobantesDeCompra.GetByPk(_idComprobanteAAnular); if (rowCC != null) { rowCC["IdTipoDeComprobante"] = IdTipoDeComprobanteAnula; _dataComprobanteDeCompra.tpu_ComprobantesDeCompra.ImportRow(rowCC); } /*tpu_ComprobantesDet*/ // tpu_ComprobantesDetDataset dataCD = mz.erp.businessrules.tpu_ComprobantesDet.GetByPk(_idComprobanteAAnular); // foreach (DataRow row in dataCD.tpu_ComprobantesDet.Rows) // { // if (row != null) // { // row["IdTipoDeComprobante"] = IdTipoDeComprobanteAnula; // _dataComprobantesDet.tpu_ComprobantesDet.ImportRow(row); // } // } /*tpu_ComprobanteDetalleDePagos*/ tpu_ComprobanteDetalleDePagosDataset dataCDP = mz.erp.businessrules.tpu_ComprobanteDetalleDePagos.GetList(null, null, _idComprobanteAAnular, null, decimal.MinValue); foreach (DataRow row in dataCDP.tpu_ComprobanteDetalleDePagos.Rows) { if (row != null) { row["IdTipoDeComprobante"] = IdTipoDeComprobanteAnula; _dataComprobantesDetalleDePagos.tpu_ComprobanteDetalleDePagos.ImportRow(row); } } /*tpu_ComprobanteDetalleDeuda*/ //tpu_ComprobanteDetalleDeudaDataset dataCDD = mz.erp.businessrules.tpu_ComprobanteDetalleDeuda.GetList(_idComprobanteAAnular, null, null); DataSet dataCDD = mz.erp.businessrules.tpu_ComprobanteDetalleDeuda.GetList(_idComprobanteAAnular, null, null); foreach (DataRow row in dataCDD.Tables[0].Rows) //foreach(DataRow row in dataCDD.tpu_ComprobanteDetalleDeuda.Rows) { if (row != null) { row["IdTipoDeComprobante"] = IdTipoDeComprobanteAnula; _dataComprobanteDetalleDeuda.tpu_ComprobanteDetalleDeuda.ImportRow(row); } } } } } } }
public static void Update(tpu_ComprobantesDataset dataSet) { Update(dataSet.tpu_Comprobantes); }