public static void Save(SortedList list, string path) { mapH = new MAPStaticInfoHeader(list); MAPStaticInfo.Save(path); list = new SortedList(); }
public static void UpdateWithValidation(tfi_TDCompTesoreriaDataset.tfi_TDCompTesoreriaRow row) { ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber); if (IsValid(row)) { SqlConnection cnx = dbhelper.Connection.GetConnection();; cnx.Open(); SqlTransaction trx = cnx.BeginTransaction(IsolationLevel.Serializable); try { string IdTDCompTesoreria = string.Empty; Update(row, trx); IdTDCompTesoreria = Convert.ToString(row.IdTDCompTesoreria); // se actualizan la variables terminadas en ',', apra que se agregue el ID recientemente insertado if (_state.ToUpper().Equals("NEW")) { foreach (sy_VariablesDataset.sy_VariablesRow rowV in _dataVariables.sy_Variables.Rows) { string str = Convert.ToString(rowV["ValorDefault"]); int x = str.LastIndexOf(','); if (str.Length != 0 && (x + 1 == str.Length)) { rowV["ValorDefault"] = str + Convert.ToString(row["IdTDCompTesoreria"]); } } } if (_dataCompEntidades != null) { foreach (tfi_TDCompTesoreria_EntidadesDataset.tfi_TDCompTesoreria_EntidadesRow rowE in _dataCompEntidades.tfi_TDCompTesoreria_Entidades.Rows) { //actualizo el id del comp tesoreria rowE["TDCompTesoreria"] = row["idTDCompTesoreria"]; } } if (_dataTDCompTesoreria_CondicionesDeVentas != null) { foreach (tfi_TDCompTesoreria_CondicionesDeVentaDataset.tfi_TDCompTesoreria_CondicionesDeVentaRow row_TDCT_CV in _dataTDCompTesoreria_CondicionesDeVentas.tfi_TDCompTesoreria_CondicionesDeVenta.Rows) { row_TDCT_CV.idTDCompTesoreria = IdTDCompTesoreria; } } if (_dataTDCompTesoreria_Monedas_Recargos != null) { foreach (tfi_TDCompTesoreriasMonedasRecargosDataset.tfi_TDCompTesoreriasMonedasRecargosRow row_TDCT_M_R in _dataTDCompTesoreria_Monedas_Recargos.tfi_TDCompTesoreriasMonedasRecargos.Rows) { row_TDCT_M_R.IdTDCompTesoreria = IdTDCompTesoreria; } } if (_dataCuentas_CondicionesDeVentas_TDCompTesoreria != null) { foreach (tsa_CuentasCondicionesDeVenta_TDCompTesoreriaDataset.tsa_CuentasCondicionesDeVenta_TDCompTesoreriaRow row_C_CV_TDCT in _dataCuentas_CondicionesDeVentas_TDCompTesoreria.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.Rows) { row_C_CV_TDCT.idTDCompTesoreria = IdTDCompTesoreria; } } if (_dataTiposDeComprobantes_CondicionesDeVentas_TDCompTesoreria != null) { foreach (Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreriaDataset.Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreriaRow row_TC_CV_TDCT in _dataTiposDeComprobantes_CondicionesDeVentas_TDCompTesoreria.Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreria.Rows) { row_TC_CV_TDCT.IdTDCompTesoreria = IdTDCompTesoreria; } } if (_dataConfiguracionFDP != null) { if (_dataConfiguracionFDP.tui_ConfiguracionFormasDePago.Rows.Count > 0) { _dataConfiguracionFDP.tui_ConfiguracionFormasDePago.Rows[0]["IdTDCompTesoreria"] = Convert.ToString(row["IdTDCompTesoreria"]); } } if (_dataAgrupamientoTDCompTesoreria != null) { if (_dataAgrupamientoTDCompTesoreria.tfi_AgrupTDCompTesoreria.Rows.Count > 0) { _dataAgrupamientoTDCompTesoreria.tfi_AgrupTDCompTesoreria.Rows[0]["IdTDCompTesoreria"] = Convert.ToString(row["IdTDCompTesoreria"]); } } mz.erp.dataaccess.sy_Variables.Update(_dataVariables.sy_Variables, trx); mz.erp.dataaccess.sy_VariablesPerfiles.Update(_dataVariablesPerfiles.sy_VariablesPerfiles, trx); //mz.erp.dataaccess.sy_Variables.Update(_dataVariablesABorrar.sy_Variables, trx); //mz.erp.dataaccess.sy_VariablesPerfiles.Update(_dataVariablesPerfilesABorrar.sy_VariablesPerfiles , trx); mz.erp.dataaccess.tfi_TDCompTesoreria_Entidades.Update(_dataCompEntidades.tfi_TDCompTesoreria_Entidades, trx); mz.erp.dataaccess.tui_ConfiguracionFormasDePago.Update(_dataConfiguracionFDP.tui_ConfiguracionFormasDePago, trx); if (_dataAgrupamientoTDCompTesoreria != null) { if (_state.Equals("NEW")) { mz.erp.dataaccess.tfi_AgrupTDCompTesoreria.Update(_dataAgrupamientoTDCompTesoreria.tfi_AgrupTDCompTesoreria, trx); } } if (_dataTDCompTesoreria_CondicionesDeVentas != null) { mz.erp.dataaccess.tfi_TDCompTesoreria_CondicionesDeVenta.Update(_dataTDCompTesoreria_CondicionesDeVentas.tfi_TDCompTesoreria_CondicionesDeVenta, trx); } mz.erp.dataaccess.tfi_TDCompTesoreriasMonedasRecargos.Update(_dataTDCompTesoreria_Monedas_Recargos.tfi_TDCompTesoreriasMonedasRecargos, trx); if (_dataCuentas_CondicionesDeVentas_TDCompTesoreria != null) { mz.erp.dataaccess.tsa_CuentasCondicionesDeVenta_TDCompTesoreria.Update(_dataCuentas_CondicionesDeVentas_TDCompTesoreria.tsa_CuentasCondicionesDeVenta_TDCompTesoreria, trx); } if (_dataTiposDeComprobantes_CondicionesDeVentas_TDCompTesoreria != null) { mz.erp.dataaccess.Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreria.Update(_dataTiposDeComprobantes_CondicionesDeVentas_TDCompTesoreria.Tsy_TiposDeComprobantes_CondicionesDeVenta_TDCompTesoreria, trx); } Variables.Reset(); //reinicia las variables; MAPStaticInfo.Reset(); trx.Commit(); } catch (Exception e) { Console.WriteLine(e.Message.ToString()); trx.Rollback(); } finally { cnx.Close(); } } }
/** * Devuelve un string indicando el motivo por el cual no se puede cerrar la caja o el string vacio si * se puede cerrar la misma. **/ public string PuedeCerrarCaja(string IdInstanciaCaja) { string mje = string.Empty; bool ok = true; //Obtengo la ultima auditoria para esa caja tfi_AuditoriaControlCajasDataset.tfi_AuditoriaControlCajasRow rowA = tfi_AuditoriaControlCajas.GetUltimoControl(IdInstanciaCaja); ok = rowA != null; if (ok) //Si hubo un control { long IdAuditoria = rowA.IdAuditoria; DateTime fechaUltimoControl = rowA.Fecha; //Obtengo los movimientos posteriores a la fecha del ultimo control DataSet movPost = reportes.ReportsFactory.GetMovimientosDeCajaPosterioresA(fechaUltimoControl, IdInstanciaCaja); ok = movPost.Tables[0].Rows.Count == 0; if (ok) //Si no existen movimientos posteriores { tfi_AuditoriaControlCajasDetDataset.tfi_AuditoriaControlCajasDetDataTable tableDet = tfi_AuditoriaControlCajasDet.GetByIdAuditoria(IdAuditoria).tfi_AuditoriaControlCajasDet; //Me fijo si el ultimo control fue exitoso int i = 0; while (ok && i < tableDet.Rows.Count) { tfi_AuditoriaControlCajasDetDataset.tfi_AuditoriaControlCajasDetRow rowD = (tfi_AuditoriaControlCajasDetDataset.tfi_AuditoriaControlCajasDetRow)tableDet.Rows[i]; //Si son cupones y el monto total coincide se puede cerrar solo si la cantidad informada es menor o igual a la que figura en el sistema if (MAPStaticInfo.PerteneceAControlDeCajasFamiliasTarjeta(rowD.IdControlDeCajasFamiliasComprobanteTesoreria)) { ok = !rowD.CodigoCalidadMonto && rowD.CantidadInformada <= rowD.CantidadSistema; } //Si son cheques debe concidir tanto el monto total como la cantidad //Entra al caso default /*else if(MAPStaticInfo.PerteneceACheque(rowD.IdTDCompTesoreria))//Cheques * { * ok = !rowD.CodigoCalidadMonto && !rowD.CodigoCalidadCantidad; * }*/ //Si es efectivo debe concidir el monto sin importar la cantidad else if (MAPStaticInfo.PerteneceAControlDeCajasFamiliasEfectivo(rowD.IdControlDeCajasFamiliasComprobanteTesoreria)) //Efectivo { ok = !rowD.CodigoCalidadMonto; } else //Por defecto debe concidir tanto el monto total como la cantidad { ok = !rowD.CodigoCalidadMonto && !rowD.CodigoCalidadCantidad; } i++; } if (!ok) //el ultimo control no fue exitoso { mje = "el último control no fue exitoso"; } } else // existen movimientos posteriores { mje = "se han realizado movimientos posteriores al último control"; } } else //No hubo ningun control { mje = "no se realizó ningún control"; } return(mje); }