Exemple #1
0
        public void agregarConciliacion(List <Decimal> ids_cupones, TB_Conciliacion objConciliacion)
        {
            using (var context = new dbSG2000Entities())
            {
                using (TransactionScope transaction = new TransactionScope())
                {
                    objConciliacion.dsUsuario      = this._usuarioActivo;
                    objConciliacion.nrCajaAdm      = Decimal.Parse(this._cajactiva);
                    objConciliacion.flestado       = "A";
                    objConciliacion.dtModificacion = DateTime.Now;


                    var listadeViajesaConciliar1 = (from c in context.TB_Cupones
                                                    where ids_cupones.Contains(c.nrCupon)
                                                    select c
                                                    );

                    Console.WriteLine(listadeViajesaConciliar1.ToString());
                    Trace.TraceInformation(listadeViajesaConciliar1.ToString());
                    TB_ConciliacionDetalle detalleConciliacion = new TB_ConciliacionDetalle();

                    double TotalConciliacion = 0.0;

                    foreach (var item in listadeViajesaConciliar1.ToList())
                    {
                        item.flCobradoalCliente = true;
                        item.dtCobradoalCliente = DateTime.Today;
                        context.TB_ConciliacionDetalle.Add(new TB_ConciliacionDetalle {
                            TB_Conciliacion = objConciliacion, nrCupon = item.nrCupon
                        });
                        TotalConciliacion = TotalConciliacion + item.vlMontoCupon.Value;
                    }
                    context.TB_Conciliacion.Add(objConciliacion);

                    context.SaveChanges();

                    GrabarAsientoContable(TotalConciliacion, Decimal.Parse(this._cajactiva), this._usuarioActivo, objConciliacion, context, Conciliacion_de_Viajes, Viajes_con_Tarjeta_a_Bancos);


                    context.SaveChanges();
                    transaction.Complete();
                    return;
                    //return listadeViajesaConciliar.ToList();
                }
            }
        }
        public void agregarConciliacion(List<Decimal> ids_cupones, TB_Conciliacion objConciliacion)
        {
            using (var context = new dbSG2000Entities())
            {

                using (TransactionScope transaction = new TransactionScope())
                {

                objConciliacion.dsUsuario = this._usuarioActivo;
                objConciliacion.nrCajaAdm = Decimal.Parse ( this._cajactiva);
                objConciliacion.flestado = "A";
                objConciliacion.dtModificacion = DateTime.Now;

                var listadeViajesaConciliar1 = (from c in context.TB_Cupones
                                                where ids_cupones.Contains(c.nrCupon)
                                                select c
                                                );

                Console.WriteLine(listadeViajesaConciliar1.ToString());
                Trace.TraceInformation(listadeViajesaConciliar1.ToString());
                TB_ConciliacionDetalle detalleConciliacion = new TB_ConciliacionDetalle();

                double TotalConciliacion=0.0;

                foreach (var item in listadeViajesaConciliar1.ToList())
                {
                    item.flCobradoalCliente = true;
                    item.dtCobradoalCliente = DateTime.Today;
                    context.TB_ConciliacionDetalle.Add(new TB_ConciliacionDetalle { TB_Conciliacion = objConciliacion  , nrCupon = item.nrCupon });
                    TotalConciliacion = TotalConciliacion + item.vlMontoCupon.Value ;
                }
                context.TB_Conciliacion.Add(objConciliacion);

                context.SaveChanges();

               GrabarAsientoContable(TotalConciliacion, Decimal.Parse(this._cajactiva), this._usuarioActivo, objConciliacion, context, Conciliacion_de_Viajes, Viajes_con_Tarjeta_a_Bancos);

                context.SaveChanges();
                transaction.Complete();
                return;
                //return listadeViajesaConciliar.ToList();

                }
            }
        }