Example #1
0
        private void buttonNuevo_Click(object sender, EventArgs e)
        {
            try
            {
                validarDatosPago();

                pago.idCliente  = cliente.id;
                pago.total      = Total;
                pago.fechaCobro = FechaCobro;
                pago.idSucursal = Usuario.sucursalSeleccionada.id;
                MedioDePago item = (MedioDePago)comboBoxMedioPago.SelectedItem;
                pago.idMedioPago = item.id;
                pago.detallePago = tablaFacturas;
                pago.registrarPago();

                MessageBox.Show("El pago ha sido procesado exitosamente", "Pago", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                reiniciarPago();
            }
            catch (SqlException) { }
            catch (Exception exception)
            {
                if (exception is EmptyFieldException ||
                    exception is CampoVacioException)
                {
                    Error.show(exception.Message);
                }
                else
                {
                    throw;
                }
            }
        }
Example #2
0
 private void Limpiar()
 {
     txtDescripcion.Text      = "";
     ckPredeterminado.Checked = false;
     objMedioDePago           = new MedioDePago();
     CargoGrilla();
 }
        public static void Update(MedioDePago medio)
        {
            var param = new DynamicParameters();

            param.Add("@codigoGeneracion", dbType: DbType.String, value: medio.codigoGeneracion);
            param.Add("@codigoImportacion", dbType: DbType.String, value: medio.codigoImportacion);
            param.Add("@Estado", dbType: DbType.Int32, value: medio.Estado);
            param.Add("@cuota_id", dbType: DbType.Int64, value: medio.cuota_id);
            param.Add("@activida_id", dbType: DbType.Int64, value: medio.activida_id);
            param.Add("@fechaGenerado", dbType: DbType.DateTime, value: medio.fechaGenerado);
            param.Add("@fechaImportadoPago", dbType: DbType.DateTime, value: medio.fechaImportadoPago);
            param.Add("@Importe", dbType: DbType.Decimal, value: medio.Importe);
            param.Add("@TipoMedioPago", dbType: DbType.Int32, value: medio.TipoMedioPago);
            param.Add("@Id", dbType: DbType.Int64, value: medio.Id);

            const string SQL_QUERY = @"
                UPDATE MedioDePago
                SET tipoMedioPago = @tipoMedioPago
                  ,estado = @estado
                  ,fechaGenerado = @fechaGenerado
                  ,fechaImportadoPago = @fechaImportadoPago
                  ,cuota_id = @cuota_id
                  ,activida_id = @activida_id
                  ,codigoGeneracion = @codigoGeneracion
                  ,codigoImportacion = @codigoImportacion
                  ,importe = @importe
                WHERE
	                 Id = @Id
            ";

            using (var db = new SqlConnection(conexion))
            {
                db.Execute(SQL_QUERY, param);
            }
        }
Example #4
0
        private void grilla_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (grilla.RowCount > 0)
            {
                ManejaMedioDePagos objManejaMediosDePago = new ManejaMedioDePagos();

                int intCodigo = Convert.ToInt32(grilla.CurrentRow.Cells[0].Value.ToString());

                objMedioDePago = objManejaMediosDePago.BuscarMedioDePago(intCodigo);
                AsignoObjetoACampos(objMedioDePago);
            }
        }
Example #5
0
        public MedioDePago add(MedioDePago medioDePago)
        {
            MedioDePago added;

            using (MyDBContext context = new MyDBContext())
            {
                added = context.MediosDePago.Add(medioDePago);
                context.SaveChanges();
            }

            return(added);
        }
Example #6
0
        public List <MedioDePago> GetTodosLosMediosDePago()
        {
            List <MedioDePago> medios = new List <MedioDePago>();
            ConexionDB         cn     = new ConexionDB("dbo.VIA_GetMediosDePago");
            SqlDataReader      dr     = cn.EjecutarConsulta();
            MedioDePago        medio;

            while (dr.Read())
            {
                medio = new MedioDePago(dr.GetInt16(0), dr.GetString(1));
                medios.Add(medio);
            }
            return(medios);
        }
        public static long Insert(MedioDePago medio)
        {
            var param = new DynamicParameters();

            param.Add("@codigoGeneracion", dbType: DbType.String, value: medio.codigoGeneracion);
            param.Add("@codigoImportacion", dbType: DbType.String, value: medio.codigoImportacion);
            param.Add("@Estado", dbType: DbType.Int32, value: medio.Estado);
            param.Add("@cuota_id", dbType: DbType.Int64, value: medio.cuota_id);
            param.Add("@activida_id", dbType: DbType.Int64, value: medio.activida_id);
            param.Add("@fechaGenerado", dbType: DbType.DateTime, value: medio.fechaGenerado);
            param.Add("@fechaImportadoPago", dbType: DbType.DateTime, value: medio.fechaImportadoPago);
            param.Add("@Importe", dbType: DbType.Decimal, value: medio.Importe);
            param.Add("@TipoMedioPago", dbType: DbType.Int32, value: medio.TipoMedioPago);

            param.Add("@Id", dbType: DbType.Int64, direction: ParameterDirection.Output);
            const string SQL_QUERY = @"
                INSERT INTO MedioDePago
                (
                   tipoMedioPago,
                   estado,
                   fechaGenerado,
                   fechaImportadoPago,
                   cuota_id,
                    activida_id, 
                   codigoGeneracion, 
                   codigoImportacion,
                   importe
                )
                VALUES
               (
                    @tipoMedioPago
                   ,@estado
                   ,@fechaGenerado
                   ,@fechaImportadoPago
                   ,@cuota_id
                    ,@activida_id
                   ,@codigoGeneracion
                   ,@codigoImportacion
                   ,@importe
               );
                SET @ID = SCOPE_IDENTITY() AS BIGINT
            ";

            using (var db = new SqlConnection(conexion))
            {
                db.Execute(SQL_QUERY, param);
                return(param.Get <long>("@ID"));
            }
        }
        public static MedioDePago LeerUno(long id)
        {
            var param = new DynamicParameters();

            param.Add("@Id", dbType: DbType.Int64, value: id);
            string query = QUERY.Replace(Constantes.WHERE, @"
                WHERE
                    C.Id = @Id 
            ");

            using (var db = new SqlConnection(conexion))
            {
                MedioDePago medio = db.Query <MedioDePago>(query, param).FirstOrDefault();
                return(medio);
            }
        }
Example #9
0
        public MedioDePago BuscarMedioDePago(int intCodigo)
        {
            MedioDePago objMedioPago = new MedioDePago();

            string strSql;

            strSql  = "select mediopago, descripcion, predeterminado ";
            strSql += " from Medio_Pago where fechabaja is null and  mediopago =" + intCodigo;
            LlenaCombos objLlenaCombos = new LlenaCombos();
            DataTable   dt             = objLlenaCombos.GetSqlDataAdapterbySql(strSql);

            objMedioPago.IntCodigo         = intCodigo;
            objMedioPago.StrDescripcion    = dt.Rows[0]["descripcion"].ToString();
            objMedioPago.IntPredeterminado = Convert.ToInt32(dt.Rows[0]["predeterminado"].ToString());

            return(objMedioPago);
        }
Example #10
0
        public void ModificaMedioDePago(MedioDePago objMedioDePago)
        {
            ManejaConexiones oManejaConexiones = new ManejaConexiones();

            SqlParameter[] spParam = new SqlParameter[3];

            spParam[0]       = new SqlParameter("@codigo", SqlDbType.BigInt);
            spParam[0].Value = objMedioDePago.IntCodigo;

            spParam[1]       = new SqlParameter("@descripcion", SqlDbType.NVarChar);
            spParam[1].Value = objMedioDePago.StrDescripcion;

            spParam[2]       = new SqlParameter("@predeterminado", SqlDbType.Int);
            spParam[2].Value = objMedioDePago.IntPredeterminado;

            oManejaConexiones.NombreStoredProcedure = "Upd_Medio_Pago";
            oManejaConexiones.Parametros            = spParam;
            oManejaConexiones.executeNonQuery();
        }
Example #11
0
        public int GrabarMedioDePago(MedioDePago objMedioDePago)
        {
            ManejaConexiones oManejaConexiones = new ManejaConexiones();

            SqlParameter[] spParam = new SqlParameter[3];

            spParam[0]       = new SqlParameter("@descripcion", SqlDbType.NVarChar);
            spParam[0].Value = objMedioDePago.StrDescripcion;

            spParam[1]       = new SqlParameter("@predeterminado", SqlDbType.Int);
            spParam[1].Value = objMedioDePago.IntPredeterminado;

            spParam[2] = new SqlParameter("@codigo", SqlDbType.BigInt);
            //spParam2[18].Value = c.StrVinculo.ToString();
            spParam[2].Direction = ParameterDirection.Output;


            oManejaConexiones.NombreStoredProcedure = "Add_Medio_Pago";
            oManejaConexiones.Parametros            = spParam;
            oManejaConexiones.executeNonQuery();

            return(Convert.ToInt32(spParam[2].Value));
        }
        public ActionResult AddMedioDePago(MedioDePago MDP)
        {
            try
            { if (MDP.idTipo != null & MDP.numero != null)
              {
                  MDP.idEntidad = ((Usuario)Session["usuario"]).idEntidad;
                  //MDP.tipo = TipoMedioDePagoDAO.getInstancia().getMedioDePago(MDP.tipo.id);
                  MedioDePagoDAO.getInstancia().add(MDP);
                  return(RedirectToAction("Index", "Home"));
              }
              else
              {
                  throw new Exception("Debe completar todos los campos para continuar");
              } }
            catch (Exception e)
            {
                ViewBag.mediosDePago = TipoMedioDePagoDAO.getInstancia().getMediosDePago();
                MyLogger.log(e.Message);
                Response.StatusCode = (int)HttpStatusCode.BadRequest;

                return(Json(e.Message));
            }
        }
Example #13
0
 private void AsignoObjetoACampos(MedioDePago objMedioDePago)
 {
     txtDescripcion.Text      = objMedioDePago.StrDescripcion;
     ckPredeterminado.Checked = Convert.ToBoolean(objMedioDePago.IntPredeterminado);
 }
Example #14
0
        public void TestMethod1()
        {
            MySql context = new MySql();

            EntidadJuridica entidad_juridica = new EntidadJuridica();

            entidad_juridica.razon_social          = "ManuMati";
            entidad_juridica.nombreFicticio        = "ManuMati";
            entidad_juridica.actividad             = "Servicios";
            entidad_juridica.comisionista          = 'N';
            entidad_juridica.promedioVentasAnuales = 50000000;
            entidad_juridica.cantidadPersonal      = 30;
            entidad_juridica.tipo = "Empresa";

            entidad_juridica.AsignarTipoOrganizacion();
            context.entidades_juridicas.Add(entidad_juridica);
            context.SaveChanges();


            EntidadBase entidad_base = new EntidadBase();

            entidad_base.nombreFicticio        = "Seguridad";
            entidad_base.actividad             = "Servicios";
            entidad_base.comisionista          = 'N';
            entidad_base.promedioVentasAnuales = 100000;
            entidad_base.cantidadPersonal      = 3;
            entidad_base.tipo = "Empresa";
            //entidad_base.AsignarTipoOrganizacion();
            //context.entidades_base.Add(entidad_base);
            //context.SaveChanges();

            entidad_juridica.entidades_base.Add(entidad_base);
            //context.SaveChanges();

            //var hola = context.presupuestos.Single(p => p.id_presupuesto == 1);
            //Console.WriteLine($"{hola.documentoComercial.id_documento}");

            var presupuesto = context.presupuestos.Single(p => p.id_presupuesto == 1);

            foreach (Item i in presupuesto.itemsDePresupuesto)
            {
                Console.WriteLine($"{i.descripcion}");
            }

            Organizacion organizacion = new Organizacion();

            Ingreso ingreso = new Ingreso();

            ingreso.descripcion = "pepe";
            ingreso.total       = 5000;
            //context.ingresos.Add(ingreso);
            //context.SaveChanges();

            Proveedor proveedor1 = new Proveedor();

            proveedor1.CUIT         = "203050065";
            proveedor1.razon_social = "proveedor";
            //context.proveedores.Add(proveedor1);
            //context.SaveChanges();

            Item item1 = new Item();

            item1.descripcion = "Galaxy 8";
            //context.items.Add(item1);
            //context.SaveChanges();

            Item item2 = new Item();

            item2.descripcion = "Galaxy 9";
            //context.items.Add(item2);
            //context.SaveChanges();

            Criterio crit = new Criterio();

            crit.descripcion = "soy un criterio";
            //context.criterios.Add(crit);
            //context.SaveChanges();

            Categoria categoria1 = new Categoria();

            categoria1.descripcion = "Precio cuidado";
            categoria1.criterio    = crit;
            //context.categorias.Add(categoria1);
            //context.SaveChanges();


            Categoria categoria2 = new Categoria();

            categoria2.descripcion = "Precio no cuidado";
            categoria2.criterio    = crit;
            //context.categorias.Add(categoria2);
            //context.SaveChanges();


            CriterioPorItem ci = new CriterioPorItem();

            ci.criterio       = crit;
            ci.categoria_item = categoria1;
            item1.criteriosDeItem.Add(ci);
            //context.criterios_por_item.Add(ci);
            //context.SaveChanges();


            DocumentoComercial doc = new DocumentoComercial();

            doc.tipo   = "ticket";
            doc.numero = 1;
            //context.documentos.Add(doc);
            //context.SaveChanges();

            Egreso egreso = new Egreso();

            egreso.fecha            = DateTime.Today;
            egreso.cantPresupuestos = 2;
            //egreso.documentoComercial = doc;
            egreso.proveedorElegido = proveedor1;
            //context.egresos.Add(egreso);
            //context.SaveChanges();

            Presupuesto presupuesto1 = new Presupuesto();

            presupuesto1.egreso             = egreso;
            presupuesto1.proveedor          = proveedor1;
            presupuesto1.documentoComercial = doc;
            //context.presupuestos.Add(presupuesto1);
            //context.SaveChanges();

            ItemPorPresupuesto itemPresupuesto1 = new ItemPorPresupuesto();

            itemPresupuesto1.item  = item1;
            itemPresupuesto1.valor = 1000;
            //context.items_por_presupuesto.Add(itemPresupuesto1);

            ItemPorPresupuesto itemPresupuesto2 = new ItemPorPresupuesto();

            itemPresupuesto2.item  = item2;
            itemPresupuesto2.valor = 2000;
            //context.items_por_presupuesto.Add(itemPresupuesto1);

            presupuesto1.agregar_item(itemPresupuesto1);
            presupuesto1.agregar_item(itemPresupuesto2);
            //context.SaveChanges();

            egreso.presupuestos.Add(presupuesto1);
            //context.SaveChanges();


            //ingreso = context.ingresos.Single(i => i.id_ingreso == 1);

            ingreso.egresos.Add(egreso);
            //context.SaveChanges();

            MedioDePago medio_de_pago = new MedioDePago();

            medio_de_pago.nombre     = "tarjeta";
            medio_de_pago.tipoDePago = "debito";

            egreso.medioDePago = medio_de_pago;
            //egreso.bandejaDeMensajes = new BandejaDeMensajes("Grupo 5");
            var revisor = new Usuario("Grupo 5", "pepe", false);

            //registrarBandejaDeMensajes(database, revisor, egreso);
            //egreso.criterioDeSeleccion = new MenorValor();

            proveedor1.razon_social = "razon1";
            Proveedor proveedor2 = new Proveedor();

            //proveedor2.CUIT = 20305006502;
            proveedor2.razon_social = "razon2";

            Item item3 = new Item();

            item3.descripcion = "Galaxy 10";
            //context.items.Add(item3);
            Item item4 = new Item();

            item4.descripcion = "Galaxy 10 Plus";
            //context.items.Add(item4);
            //context.SaveChanges();

            presupuesto1.proveedor = proveedor1;

            Presupuesto presupuesto2 = new Presupuesto();

            //presupuesto2.documentoComercial =doc;
            presupuesto2.proveedor = proveedor2;
            //context.presupuestos.Add(presupuesto2);
            //context.SaveChanges();

            ItemPorPresupuesto itemPorPresupuesto3 = new ItemPorPresupuesto();

            itemPorPresupuesto3.item  = item3;
            itemPorPresupuesto3.valor = 3000;
            ItemPorPresupuesto itemPorPresupuesto4 = new ItemPorPresupuesto();

            itemPorPresupuesto4.item  = item4;
            itemPorPresupuesto4.valor = 4000;
            //context.items_por_presupuesto.Add(itemPorPresupuesto3);
            //context.items_por_presupuesto.Add(itemPorPresupuesto4);
            //context.SaveChanges();

            presupuesto2.agregar_item(itemPorPresupuesto3);
            presupuesto2.agregar_item(itemPorPresupuesto4);
            //context.SaveChanges();

            egreso.presupuestos.Add(presupuesto2);
            egreso.elegirPresupuesto(presupuesto1);
        }
Example #15
0
        private void btnFinalizar_Click(object sender, EventArgs e)
        {
            if (!this.cargoPago)
            {
                MessageBox.Show("Debe elegir un medio de pago");
                return;
            }
            if (this.esEncomienda == 1)
            {
                if (this.txtKGs.Text.Trim() == "")
                {
                    MessageBox.Show("Debe ingresar la cantidad a enviar");
                    return;
                }
            }
            try
            {
                string        query;
                SqlDataReader reader;
                if (this.txtDNI.Text == "" || txtNombrePasajero.Text == "" || txtApellidoPasajero.Text == "" ||
                    this.txtMailPasajero.Text == "" || this.txtDireccionPasajero.Text == "" || this.txtTelefonoPasajero.Text == "")
                {
                    MessageBox.Show("Debe completar todos los campos");
                }
                else
                {
                    float KGsAEnviar;
                    if (txtKGs.Text.Trim() == "")
                    {
                        KGsAEnviar = 0;
                    }
                    else
                    {
                        try
                        {
                            KGsAEnviar = float.Parse(txtKGs.Text);
                        }
                        catch (Exception)
                        {
                            MessageBox.Show("La cantidad de KGs a enviar no es valida");
                            return;
                        }
                    }
                    try
                    {
                        int.Parse(this.txtDNI.Text);
                        int.Parse(this.txtTelefonoPasajero.Text);
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("El DNI y el telefono deben ser numericos");
                        return;
                    }
                    if (this.soyCliente)
                    {
                        query = "EXEC JUST_DO_IT.actualizarUsuario " + this.usuario_id + ", '" + this.txtMailPasajero.Text + "', '"
                                + this.txtDireccionPasajero.Text + "', " + this.txtTelefonoPasajero.Text;
                        Server.getInstance().realizarQuery(query);
                    }
                    else
                    {
                        query = "EXEC JUST_DO_IT.almacenarCliente " + this.txtDNI.Text + ", '" + this.txtNombrePasajero.Text + "', '" +
                                this.txtApellidoPasajero.Text + "', '" + this.txtMailPasajero.Text + "', '" + this.txtDireccionPasajero.Text + "', " +
                                this.txtTelefonoPasajero.Text + ", '" + dtpFechaNacimientoPasajero.Value.ToString("yyyy-MM-dd") + "'";
                        Server.getInstance().realizarQuery(query);
                        query = "SELECT JUST_DO_IT.obtenerIDUsuario (" + txtDNI.Text + ", '" +
                                txtApellidoPasajero.Text + "', '" + txtNombrePasajero.Text + "') AS id";
                        reader = Server.getInstance().query(query);
                        reader.Read();
                        this.usuario_id = int.Parse(reader["id"].ToString());
                        reader.Close();
                    }
                    int idMedioDePago;
                    if (this.efectivo)
                    {
                        idMedioDePago = MedioDePago.obtenerID("Efectivo");
                    }
                    else
                    {
                        idMedioDePago = MedioDePago.obtenerID(this.tipo);
                    }

                    query = "EXEC JUST_DO_IT.almacenarPasaje " + this.vuelo_id + ", " + this.costo_viaje + ", " +
                            this.usuario_id + ", " + this.numero + ", " + this.codigo + ", " + this.vencimiento + ", " +
                            this.cuotas + ", " + idMedioDePago + ", " + KGsAEnviar + ", " + this.esEncomienda;

                    Server.getInstance().realizarQuery(query);

                    query  = "SELECT TOP 1 codigo, monto FROM JUST_DO_IT.Compras ORDER BY codigo DESC";
                    reader = Server.getInstance().query(query);
                    reader.Read();
                    string codigo = reader["codigo"].ToString();
                    string monto  = reader["monto"].ToString();
                    reader.Close();

                    new InformeDeCompra(monto, codigo).Show();
                    this.Hide();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 public void setMedioPago(MedioDePago medioDePago)
 {
     this.medioDePago = medioDePago;
 }
Example #17
0
        public long GenerarActividad(long?Dni                      = null
                                     , string ApeYNom              = ""
                                     , string origen               = ""
                                     , int?CodCon                  = null
                                     , decimal?Importe             = null
                                     , int?control                 = null
                                     , bool?generaPagoFacil        = null
                                     , bool?generaBanelco          = null
                                     , string codigoClienteBanelco = "")
        {
            var value = new Actividad();

            if (!String.IsNullOrEmpty(origen))
            {
                value.Origen = origen;
            }
            if (!String.IsNullOrEmpty(ApeYNom))
            {
                value.ApeYNom = ApeYNom;
            }
            if (Dni.HasValue)
            {
                value.Dni = Dni.Value;
            }
            if (Importe.HasValue)
            {
                value.Importe = Importe.Value;
            }
            if (CodCon.HasValue)
            {
                value.CodCon = CodCon.Value;
            }
            if (control.HasValue)
            {
                value.Control = control.Value;
            }

            long id = ActividadData.Insert(value);

            if (generaPagoFacil.HasValue)
            {
                var medio = new MedioDePago();
                medio.activida_id   = id;
                medio.Estado        = (int)EstadosPago.Creado;
                medio.fechaCreado   = DateTime.Now;
                medio.TipoMedioPago = (int)TiposMedioPago.PagoFacil;
                MedioDePagoData.Insert(medio);
            }
            if (generaBanelco.HasValue)
            {
                var medio = new MedioDePago();
                medio.activida_id   = id;
                medio.Estado        = (int)EstadosPago.Creado;
                medio.fechaCreado   = DateTime.Now;
                medio.TipoMedioPago = (int)TiposMedioPago.Banelco;
                if (!string.IsNullOrEmpty(medio.codigoGeneracion))
                {
                    medio.codigoGeneracion = "111111";
                }
                else
                {
                    medio.codigoGeneracion = codigoClienteBanelco;
                }
                MedioDePagoData.Insert(medio);
            }

            return(id);
        }
Example #18
0
        void cargarMediosDePago()
        {
            MedioDePago.getMedioPagos().ForEach(r => comboBoxMedioPago.Items.Add(r));    // obtengo y agrego los nuevos

            comboBoxMedioPago.DisplayMember = "descripcion";
        }
 public void setMedioPago(MedioDePago.MedioDePago medioDePago)
 {
     this.medioDePago = medioDePago;
 }
Example #20
0
        public ActionResult FormRegistroCompra(
            string _IdOrg,
            string _fechaCompra,
            string _cantPresReq,
            string[] _UsuariosRevisores,
            string _tipoPago,
            string _numero,
            string _IdPais,
            string _Proveedor,
            string[] _IdDocumentoComercial,
            string[] _TipoDeDocumento,
            string[] _ItemsNombres,
            string[] _ItemsDescripciones,
            string[] _ItemsCategoriasCriterios,
            string[] _ItemsValoresTotales
            )
        {
            List <Item> n_items = new List <Item>()
            {
            };

            for (int i = 0; i < _ItemsNombres.Length; i++)
            {
                // Parseo el texto de Categoria, Criterio.
                var categorias_criterios = new Dictionary <String, List <String> > {
                };
                string categoria, criterio;

                foreach (String dupla in _ItemsCategoriasCriterios[i].Replace(" ", string.Empty).Split('.'))
                {
                    if (dupla.Count() > 0)
                    {
                        categoria = dupla.Split(',')[0];
                        criterio  = dupla.Split(',')[1];

                        if (!categorias_criterios.ContainsKey(categoria))
                        {
                            categorias_criterios.Add(categoria, new List <string> {
                            });
                        }

                        if (!categorias_criterios[categoria].Contains(criterio))
                        {
                            categorias_criterios[categoria].Add(criterio);
                        }
                    }
                }

                var categorias = new List <Categoria> {
                };

                foreach (var kvp in categorias_criterios)
                {
                    foreach (var value in kvp.Value)
                    {
                        categorias.Add(
                            new Categoria(kvp.Key,
                                          new Criterio(value, null)));
                    }
                }

                n_items.Add(
                    new Item(
                        _ItemsNombres[i],
                        _ItemsDescripciones[i],
                        float.Parse(_ItemsValoresTotales[i]),
                        categorias
                        )
                    );
            }


            //OperaciĆ³n de egreso
            MedioDePago n_medioDePago = new MedioDePago(_IdPais, _numero, _tipoPago);

            var n_documentosComerciales = new List <DocumentoComercial>()
            {
            };

            for (int i = 0; i < _IdDocumentoComercial.Length; i++)
            {
                n_documentosComerciales.Add(
                    new DocumentoComercial(int.Parse(_IdDocumentoComercial[i]), _TipoDeDocumento[i])
                    );
            }

            var n_usuarios = new List <Usuario> {
            };

            foreach (string IdUsuario in _UsuariosRevisores)
            {
                n_usuarios.Add(UsuarioDAO.obtenerUsuario(int.Parse(IdUsuario)));
            }

            PersonaProveedora         n_personaProveedora         = null;
            EntidadJuridicaProveedora n_entidadJuridicaProveedora = null;

            string id_proveedor   = _Proveedor.Split(' ')[0];
            string tipo_proveedor = _Proveedor.Split(' ')[1];

            if (tipo_proveedor == "pp")
            {
                n_personaProveedora = PersonaProveedoraDAO.obtenerPersonaProveedora(int.Parse(id_proveedor));
            }
            if (tipo_proveedor == "ejp")
            {
                n_entidadJuridicaProveedora = EntidadJuridicaProveedoraDAO.obtenerEntidadJuridicaProveedora(int.Parse(id_proveedor));
            }

            CriterioCompra n_criterio = new MenorValor();

            if (_cantPresReq == "")
            {
                _cantPresReq = "0";
            }

            Compra n_compra = new Compra(
                int.Parse(_cantPresReq),
                n_criterio,
                n_items,
                n_usuarios,
                n_personaProveedora,
                n_entidadJuridicaProveedora
                );

            OperacionDeEgreso n_oe = new OperacionDeEgreso(
                n_compra,
                n_medioDePago,
                n_documentosComerciales,
                DateTime.Parse(_fechaCompra)
                );

            n_oe.ID_Organizacion = int.Parse(_IdOrg);


            if (_cantPresReq == null || int.Parse(_cantPresReq) == 0)
            {
                OperacionDeEgresoDAO.guardar(n_oe);
                return(RedirectToAction("Egresos", "Home"));
            }
            else
            {
                Session["NuevoEgreso"]    = n_oe;
                Session["CantPresReq"]    = int.Parse(_cantPresReq);
                Session["CantPresReqMax"] = int.Parse(_cantPresReq);
                return(RedirectToAction("NuevoPresupuesto", "Home"));
            }
        }
Example #21
0
        //string strPermisos;

        public frmMedioPago()
        {
            InitializeComponent();
            objMedioDePago = new MedioDePago();
            CargoGrilla();
        }