Ejemplo n.º 1
0
        /// <summary>
        /// Agrega al rarrito
        /// </summary>
        /// <returns><c>true</c>, Agregó la información, <c>false</c> Existió algún error.</returns>
        /// <param name="datos">Datos.</param>
        /// <param name="tipo">Tipo.</param>
        /// <param name="usuario_id">Usuario identifier.</param>
        public bool AddCarrito(Dictionary <string, CarritoModel> datos, TiposServicios tipo, string usuario_id)
        {
            Dictionary <string, CarritoModel> carrito = GetCarrito(usuario_id, tipo);

            foreach (KeyValuePair <string, CarritoModel> element in datos)
            {
                if (!carrito.ContainsKey(element.Key) || (carrito[element.Key].Membresia_Cantidad != element.Value.Membresia_Cantidad || carrito[element.Key].Producto_Cantidad != element.Value.Producto_Cantidad))
                {
                    if (element.Value.Producto_Cantidad > 0)
                    {
                        if (element.Value.Sucursal_Id == 0)
                        {
                            return(false);
                        }
                        AddCarritoCompras(usuario_id, tipo, element.Key, element.Value.Producto_Cantidad, element.Value.Sucursal_Id, element.Value.Membresia_Cantidad, DateTime.SpecifyKind(DateTime.Parse(element.Value.Membresia_Fecha_Inicio), DateTimeKind.Utc));
                    }
                    else if (element.Value.Membresia_Cantidad > 0)
                    {
                        if (element.Value.Sucursal_Id == 0)
                        {
                            return(false);
                        }
                        AddCarritoCompras(usuario_id, tipo, element.Key, element.Value.Membresia_Cantidad, element.Value.Sucursal_Id, element.Value.Membresia_Cantidad, DateTime.SpecifyKind(DateTime.Parse(element.Value.Membresia_Fecha_Inicio), DateTimeKind.Utc));
                    }
                }
                else
                {
                    Console.WriteLine("Existe el producto");
                }
            }
            return(true);
        }
Ejemplo n.º 2
0
        public IHttpActionResult PutTiposServicios(int id, TiposServicios tiposServicios)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tiposServicios.Id_TipoServicio)
            {
                return(BadRequest());
            }

            db.Entry(tiposServicios).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TiposServiciosExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            Server server = Server.getInstance();
            try
            {
                if (!this.validarCampos())
                {
                    MessageBox.Show("Debe completar todos los campos");
                    return;
                }
                string matricula = tbNumeroMatricula.Text;
                string modelo = tbModelo.Text;
                string fabricante = this.buscarSegunPosicion(cbFabricante.SelectedIndex, "Aeronaves", "fabricante");
                int tipoDeServicio = TiposServicios.obtenerID(cbTipoServicio.Text);
                float espacioParaEncomiendas = float.Parse(tbEspacioTotalParaEncomiendas.Text);
                int cantidadButacas = int.Parse(tbCantButacas.Text);

                string modificarAeronave = "EXEC JUST_DO_IT.modificarAeronave " + aeronaveId + ", '" + matricula + "', '" + modelo + "', '" + fabricante + "', " + tipoDeServicio + ", " + espacioParaEncomiendas + ", " + cantidadButacas;
                try
                {
                    Server.getInstance().realizarQuery(modificarAeronave);
                    MessageBox.Show("La aeronave se modifico satisfactoriamente");
                    this.Close();
                    new Vistas_Inicio.Inicio_Admin().Show();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            catch {
                MessageBox.Show("Los datos modificados no son validos");
            }
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            TiposServicios tiposServicios = await db.TiposServicios.FindAsync(id);

            db.TiposServicios.Remove(tiposServicios);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 5
0
        public ILeer GetREST(TiposServicios pTipoServicios)
        {
            IDictionary <TiposServicios, ILeer> dict = new Dictionary <TiposServicios, ILeer>();

            dict.Add(TiposServicios.REST, new RESTApiFacebook());
            dict.Add(TiposServicios.SOAP, new RESTApiGoogle());
            ILeer result;

            dict.TryGetValue(pTipoServicios, out result);
            return(result);
        }
Ejemplo n.º 6
0
        public IHttpActionResult GetTiposServicios(int id)
        {
            TiposServicios tiposServicios = db.TiposServicios.Find(id);

            if (tiposServicios == null)
            {
                return(NotFound());
            }

            return(Ok(tiposServicios));
        }
Ejemplo n.º 7
0
        public async Task <IHttpActionResult> GetTiposServicios(int id)
        {
            TiposServicios tiposServicios = await db.TiposServicios.FindAsync(id);

            if (tiposServicios == null)
            {
                return(NotFound());
            }

            return(Ok(tiposServicios));
        }
        public async Task <ActionResult> Edit([Bind(Include = "TipoServ_ID,TipoServ_Nombre,TipoServ_Descripcion")] TiposServicios tiposServicios)
        {
            if (ModelState.IsValid)
            {
                db.Entry(tiposServicios).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(tiposServicios));
        }
Ejemplo n.º 9
0
        public IHttpActionResult PostTiposServicios(TiposServicios tiposServicios)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.TiposServicios.Add(tiposServicios);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = tiposServicios.Id_TipoServicio }, tiposServicios));
        }
        public async Task <ActionResult> Create([Bind(Include = "TipoServ_ID,TipoServ_Nombre,TipoServ_Descripcion")] TiposServicios tiposServicios)
        {
            if (ModelState.IsValid)
            {
                db.TiposServicios.Add(tiposServicios);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(tiposServicios));
        }
        public async Task <IHttpActionResult> PostTiposServicios(TiposServicios tiposServicios)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.TiposServicios.Add(tiposServicios);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = tiposServicios.TipoServ_ID }, tiposServicios));
        }
Ejemplo n.º 12
0
 private void tiposDeCombustiblesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (Application.OpenForms["TiposCombustibles"] != null)
     {
         Application.OpenForms["TiposCombustibles"].Activate();
     }
     else
     {
         TiposServicios frm = new TiposServicios();
         frm.MdiParent = this;
         frm.Show();
     }
 }
        // GET: TiposServicios/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TiposServicios tiposServicios = await db.TiposServicios.FindAsync(id);

            if (tiposServicios == null)
            {
                return(HttpNotFound());
            }
            return(View(tiposServicios));
        }
Ejemplo n.º 14
0
        public IHttpActionResult DeleteTiposServicios(int id)
        {
            TiposServicios tiposServicios = db.TiposServicios.Find(id);

            if (tiposServicios == null)
            {
                return(NotFound());
            }

            db.TiposServicios.Remove(tiposServicios);
            db.SaveChanges();

            return(Ok(tiposServicios));
        }
Ejemplo n.º 15
0
        public async Task <IHttpActionResult> DeleteTiposServicios(int id)
        {
            TiposServicios tiposServicios = await db.TiposServicios.FindAsync(id);

            if (tiposServicios == null)
            {
                return(NotFound());
            }

            db.TiposServicios.Remove(tiposServicios);
            await db.SaveChangesAsync();

            return(Ok(tiposServicios));
        }
Ejemplo n.º 16
0
        private void button1_Click(object sender, EventArgs e)
        {
            try{
                if (this.aeronaveValida() && this.validarCampos())
                {
                    string altaAeronave;
                    string generarButacas;
                    string matricula              = tbNumeroMatricula.Text;
                    string modelo                 = tbModelo.Text;
                    string fabricante             = this.buscarSegunPosicion(cbFabricante.SelectedIndex, "Aeronaves", "fabricante");
                    int    tipoDeServicio         = TiposServicios.obtenerID(cbTipoServicio.Text);
                    float  espacioParaEncomiendas = float.Parse(tbEspacioTotalParaEncomiendas.Text);
                    int    cantidadButacas        = int.Parse(tbCantButacas.Text);

                    altaAeronave   = "EXEC JUST_DO_IT.almacenarAeronave '" + matricula + "', '" + modelo + "', '" + fabricante + "', " + tipoDeServicio + ", " + espacioParaEncomiendas + ", " + cantidadButacas;
                    generarButacas = "EXEC JUST_DO_IT.generar_butacas '" + matricula + "', " + cantidadButacas;
                    try
                    {
                        Server.getInstance().realizarQuery(altaAeronave);
                        Server.getInstance().realizarQuery(generarButacas);
                        MessageBox.Show("La aeronave se agrego satisfactoriamente");
                        if (this.matriculaAReemplazar != null)
                        {
                            owner.aeronaveCreada(matricula);
                            this.Close();
                            new Vistas_Inicio.Inicio_Admin().Show();
                        }
                        else
                        {
                            this.Close();
                            new Vistas_Inicio.Inicio_Admin().Show();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
                else
                {
                    MessageBox.Show("Debe crear una aeronave con el mismo fabricante, tipo de servicio, cantidad de butacas y kilogramos disponibles");
                }
            }
            catch
            {
                MessageBox.Show("Debe ingresar datos validos");
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Agrega al carrito de compras
        /// </summary>
        /// <returns><c>true</c>, si se agregó la información, <c>false</c> existió algún error.</returns>
        /// <param name="miembro_id">Identificador del Miembro.</param>
        /// <param name="tipo">Tipo de servicio.</param>
        /// <param name="id">identificador del servicio.</param>
        /// <param name="cantidad">Cantidad.</param>
        /// <param name="sucursal">Sucursal.</param>
        /// <param name="membresia_meses_cantidad">cantidad de meses de la membresia Membresia.</param>
        /// <param name="membresia_fecha_inicio">Fecha de inicio de la Membresia.</param>
        public bool AddCarritoCompras(string miembro_id, TiposServicios tipo, string id, int cantidad, int sucursal, int membresia_meses_cantidad, DateTime membresia_fecha_inicio)
        {
            try
            {
                conn.Open();
                transaction         = conn.BeginTransaction();
                command             = CreateCommand();
                command.Connection  = conn;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "sp_pro_Carrito_Compras";

                command.Parameters.AddWithValue("@Transaccion", "ALTA");
                command.Parameters.AddWithValue("@miembro_Id", miembro_id);
                if (tipo == TiposServicios.Producto)
                {
                    command.Parameters.AddWithValue("@producto_Id", id);
                    command.Parameters.AddWithValue("@producto_cantidad", cantidad);
                }
                else if (tipo == TiposServicios.Membresia)
                {
                    command.Parameters.AddWithValue("@membresia_id", id);
                    command.Parameters.AddWithValue("@membresia_cantidad", cantidad);
                    command.Parameters.AddWithValue("@membresia_meses_cantidad", membresia_meses_cantidad);
                    command.Parameters.AddWithValue("@membresia_fecha_inicio", membresia_fecha_inicio);
                }
                command.Parameters.AddWithValue("@Pedido_Estatus", 1);
                command.Parameters.AddWithValue("@sucursal_id", sucursal);

                command.Transaction = transaction;
                command.ExecuteNonQuery();
                transaction.Commit();
            }
            catch (Exception e)
            {
                SlackLogs.SendMessage(e.Message, GetType().Name, "AddCarritoCompras");
                transaction.Rollback();
                return(false);
            }
            finally { conn.Close(); }
            return(true);
        }
Ejemplo n.º 18
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (txtCodigo.Text.Trim() != "" && txtPrecioBasePorKg.Text.Trim() != "" && txtPrecioBasePorPasaje.Text.Trim() != "" &&
                cmbDestino.Text.Trim() != "" && cmbOrigen.Text.Trim() != "" && cmbTipoServicio.Text.Trim() != "")
            {
                string query;
                try
                {
                    int   codigo   = int.Parse(txtCodigo.Text);
                    float kgs      = float.Parse(txtPrecioBasePorKg.Text);
                    float pasaje   = float.Parse(txtPrecioBasePorPasaje.Text);
                    int   destino  = Ciudades.obtenerID(cmbDestino.Text);
                    int   origen   = Ciudades.obtenerID(cmbOrigen.Text);
                    int   servicio = TiposServicios.obtenerID(cmbTipoServicio.Text);
                    query = "EXEC JUST_DO_IT.almacenarRuta " + codigo + ", " + kgs + ", " + pasaje + ", " + origen + ", " +
                            destino + ", " + servicio;
                }
                catch (Exception)
                {
                    MessageBox.Show("Debe ingresar datos validos");
                    return;
                }

                try
                {
                    Server.getInstance().realizarQuery(query);
                    MessageBox.Show("La ruta se agrego satisfactoriamente");
                    new Vistas_Inicio.Inicio_Admin().Show();
                    this.Hide();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                MessageBox.Show("Debe completar todos los campos");
            }
        }
Ejemplo n.º 19
0
        private void cargarDatos()
        {
            if (!(cmbDestino.Text == "" || cmbOrigen.Text == ""))
            {
                cmbRutas.Items.Clear();
                int           origen    = Ciudades.obtenerID(cmbOrigen.Text);
                int           destino   = Ciudades.obtenerID(cmbDestino.Text);
                List <string> codigos   = new List <string>();
                List <int>    servicios = new List <int>();
                List <double> ids       = new List <double>();
                string        query     = "SELECT id, codigo, tipo_servicio, eliminada FROM JUST_DO_IT.Rutas WHERE ciu_id_origen=" + origen + " AND ciu_id_destino=" + destino;
                SqlDataReader reader    = Server.getInstance().query(query);
                while (reader.Read())
                {
                    string al = reader["eliminada"].ToString();

                    if (reader["eliminada"].ToString() == "False")
                    {
                        codigos.Add(reader["codigo"].ToString());
                        servicios.Add(int.Parse(reader["tipo_servicio"].ToString()));
                        ids.Add(double.Parse(reader["id"].ToString()));
                    }
                }
                reader.Close();
                int          i;
                ComboBoxItem item = new ComboBoxItem(cmbRutas);
                for (i = 0; i < codigos.Count; i++)
                {
                    string servicio = TiposServicios.obtenerNombre(servicios.ElementAt(i));
                    item       = new ComboBoxItem();
                    item.Value = ids.ElementAt(i);
                    item.Text  = codigos.ElementAt(i) + " - " + servicio;
                    cmbRutas.Items.Add(item);
                }
            }
        }
Ejemplo n.º 20
0
 public ILeer GetREST(TiposServicios pTipoServicios)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 21
0
        /// <summary>
        /// Agrega los detalles de la orden de venta
        /// </summary>
        /// <returns>Identificador del detalle de la orden de venta.</returns>
        /// <param name="encabezado_id">Identificador del encabezado.</param>
        /// <param name="Membresia_Id">Identificador de la membresía.</param>
        /// <param name="Inscripcion_Membresia_Id">Identificador de la inscripción membresía.</param>
        /// <param name="Lista_Precio_Membresia_Id">Identificador del precio de la membresía.</param>
        /// <param name="Producto_Id">Identificador del producto.</param>
        /// <param name="Lista_Precio_Producto_Id">Identificador del precio del producto.</param>
        /// <param name="Orden_Venta_Detalle_Descripcion">Descripción del detalle del producto/membresía.</param>
        /// <param name="Orden_Venta_Detalle_Cantidad">Cantidad del detalle del producto/membresía.</param>
        /// <param name="Orden_Venta_Detalle_Importe_Precio">Importe del detalle del producto/membresía.</param>
        /// <param name="Orden_Venta_Detalle_Importe_Prorrateo">Importe por prorrateo del detalle del producto/membresía.</param>
        /// <param name="Orden_Venta_Detalle_Importe_Suma">Suma del importe del detalle del producto/membresía.</param>
        /// <param name="Orden_Venta_Detalle_Importe_Descuento">Importe del descuento del detalle del producto/membresía.</param>
        /// <param name="Orden_Venta_Detalle_Importe_Subtotal">Subtotal del detalle del producto/membresía.</param>
        /// <param name="Orden_Venta_Detalle_Importe_Impuesto">Impuesto del detalle del producto/membresía.</param>
        /// <param name="Orden_Venta_Detalle_Importe_Total">Importe total del detalle del producto/membresía.</param>
        /// <param name="tipo">Tipo de detalle de compra (Membresía o Producto).</param>
        public int AddOrdenVentaDetalle(int encabezado_id, string Membresia_Id, string Inscripcion_Membresia_Id, string Lista_Precio_Membresia_Id, string Producto_Id, string Lista_Precio_Producto_Id,
                                        string Orden_Venta_Detalle_Descripcion, int Orden_Venta_Detalle_Cantidad, decimal Orden_Venta_Detalle_Importe_Precio, decimal Orden_Venta_Detalle_Importe_Prorrateo,
                                        decimal Orden_Venta_Detalle_Importe_Suma, decimal Orden_Venta_Detalle_Importe_Descuento, decimal Orden_Venta_Detalle_Importe_Subtotal, decimal Orden_Venta_Detalle_Importe_Impuesto,
                                        decimal Orden_Venta_Detalle_Importe_Total, TiposServicios tipo)
        {
            try
            {
                conn.Open();
                command             = CreateCommand();
                command.Connection  = conn;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "sp_pro_Orden_Venta_Detalle";

                command.Parameters.AddWithValue("@Trasaccion", "ALTA");
                command.Parameters.AddWithValue("@Orden_Venta_Detalle_Id", DBNull.Value);
                command.Parameters.AddWithValue("@Orden_Venta_Encabezado_Id", encabezado_id);
                if (tipo == TiposServicios.Membresia)
                {
                    if (!string.IsNullOrEmpty(Membresia_Id))
                    {
                        command.Parameters.AddWithValue("@Membresia_Id", Membresia_Id);
                    }
                    if (!string.IsNullOrEmpty(Membresia_Id))
                    {
                        command.Parameters.AddWithValue("@Inscripcion_Membresia_Id", Inscripcion_Membresia_Id);
                    }
                    command.Parameters.AddWithValue("@Lista_Precio_Membresia_Id", Lista_Precio_Membresia_Id);
                }
                else if (tipo == TiposServicios.Producto)
                {
                    command.Parameters.AddWithValue("@Producto_Id", Producto_Id);
                    command.Parameters.AddWithValue("@Lista_Precio_Producto_Id", Lista_Precio_Producto_Id);
                }

                command.Parameters.AddWithValue("@Orden_Venta_Detalle_Descripcion", Orden_Venta_Detalle_Descripcion);
                command.Parameters.AddWithValue("@Orden_Venta_Detalle_Cantidad", Orden_Venta_Detalle_Cantidad);
                command.Parameters.AddWithValue("@Orden_Venta_Detalle_Importe_Precio", Orden_Venta_Detalle_Importe_Precio);
                command.Parameters.AddWithValue("@Orden_Venta_Detalle_Importe_Prorrateo", Orden_Venta_Detalle_Importe_Prorrateo);
                command.Parameters.AddWithValue("@Orden_Venta_Detalle_Importe_Suma", Orden_Venta_Detalle_Importe_Suma);
                command.Parameters.AddWithValue("@Orden_Venta_Detalle_Importe_Descuento", Orden_Venta_Detalle_Importe_Descuento);
                command.Parameters.AddWithValue("@Orden_Venta_Detalle_Importe_Subtotal", Orden_Venta_Detalle_Importe_Subtotal);
                command.Parameters.AddWithValue("@Orden_Venta_Detalle_Importe_Impuesto", Orden_Venta_Detalle_Importe_Impuesto);
                command.Parameters.AddWithValue("@Orden_Venta_Detalle_Importe_Total", Orden_Venta_Detalle_Importe_Total);
                command.Parameters.AddWithValue("@Orden_Venta_Detalle_Estatus", 1);
                command.Parameters.Add("@Orden_Venta_Detalle_Id_Salida", SqlDbType.Int).Direction = ParameterDirection.Output;

                transaction = conn.BeginTransaction();

                command.Transaction = transaction;
                command.ExecuteNonQuery();
                transaction.Commit();
                return(Convert.ToInt32(command.Parameters["@Orden_Venta_Detalle_Id_Salida"].Value));
            }
            catch (Exception e)
            {
                transaction.Rollback();
                SlackLogs.SendMessage(e.Message, GetType().Name, "AddOrdenVentaDetalle");
                return(-1);
            }
            finally { conn.Close(); }
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Obtiene la información de carrito
        /// </summary>
        /// <returns>Información del carrito.</returns>
        /// <param name="miembro_id">Identificador del Miembro.</param>
        /// <param name="tipo">Tipo de servicio.</param>
        public Dictionary <string, CarritoModel> GetCarrito(string miembro_id, TiposServicios tipo)
        {
            Dictionary <string, CarritoModel> carrito = new Dictionary <string, CarritoModel>();
            string query = "SELECT * FROM vw_pro_Carrito_Compras WHERE Miembro_Id = @miembro_id AND Pedido_Estatus = 1 ";

            switch (tipo)
            {
            case TiposServicios.Producto: query += " AND Producto_Id IS NOT NULL"; break;

            case TiposServicios.Membresia: query += " AND Membresia_Id IS NOT NULL"; break;
            }
            try
            {
                conn.Open();
                command = CreateCommand(query);
                command.Parameters.AddWithValue("@miembro_id", miembro_id);
                reader = command.ExecuteReader();
                while (reader.Read())
                {
                    if (tipo == TiposServicios.Producto)
                    {
                        carrito.Add(reader["Producto_Id"].ToString(), new CarritoModel()
                        {
                            Pedido_Id            = reader["Pedido_Id"].ToString(),
                            Miembro_Id           = reader["Miembro_Id"].ToString(),
                            Producto_Id          = reader["Producto_Id"].ToString(),
                            Producto_Cantidad    = int.Parse(reader["Producto_Cantidad"].ToString()),
                            Pedido_Estatus       = reader["Pedido_Estatus"].ToString(),
                            Precio_Base          = reader["Lista_Precio_Producto_Precio_Prorrateo_Neto"].ToString(),
                            Dias_Prorrateo       = (DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month) - DateTime.Now.Day).ToString(),//reader["Lista_Precio_Producto_Dias_Prorrateo"].ToString(),
                            Pedido_Total         = reader["Lista_Precio_Producto_Precio_Prorrateo_Neto"].ToString(),
                            Sucursal_Id          = Convert.ToInt32(reader["Sucursal_Id"].ToString()),
                            Sucursal_Descripcion = reader["Sucursal_Descripcion"].ToString()
                        });
                    }
                    else if (!string.IsNullOrEmpty(reader["Membresia_Id"].ToString()))
                    {
                        carrito.Add(reader["Membresia_Id"].ToString(), new CarritoModel()
                        {
                            Pedido_Id              = reader["Pedido_Id"].ToString(),
                            Miembro_Id             = reader["Miembro_Id"].ToString(),
                            Membresia_Id           = reader["Membresia_Id"].ToString(),
                            Membresia_Cantidad     = int.Parse(reader["Membresia_Cantidad"].ToString()),
                            Pedido_Estatus         = reader["Pedido_Estatus"].ToString(),
                            Precio_Base            = reader["Lista_Precio_Membresia_Precio_Prorrateo_Neto"].ToString(),
                            Dias_Prorrateo         = (DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month) - DateTime.Now.Day).ToString(),
                            Pedido_Total           = reader["Lista_Precio_Membresia_Precio_Prorrateo_Neto"].ToString(),
                            Sucursal_Id            = Convert.ToInt32(reader["Sucursal_Id"].ToString()),
                            Sucursal_Descripcion   = reader["Sucursal_Descripcion"].ToString(),
                            Membresia_Fecha_Inicio = reader["Membresia_Fecha_Inicio"].ToString()
                        });
                    }
                }
            }
            catch (Exception e)
            {
                SlackLogs.SendMessage(e.Message, GetType().Name, "GetCarrito");
            }
            finally { conn.Close(); }
            return(carrito);
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Crea un carrito de compra detallado
        /// </summary>
        /// <returns>Carrito de compras detallado.</returns>
        /// <param name="referencia_tipo">Tipo de referencia.</param>
        /// <param name="referencia_id">Identificador de producto/membresías.</param>
        /// <param name="referencia_cantidad">Cantidad de producto/membresías.</param>
        /// <param name="referencia_meses">Meses de producto/membresías.</param>
        /// <param name="referencia_fecha_inicio">Fecha inicio producto/membresías.</param>
        /// <param name="precio_id">Identificador del precio.</param>
        /// <param name="moneda_id">Identificador de la moneda.</param>
        /// <param name="impuesto_id">Identificador del impuesto.</param>
        /// <param name="descuento_id">Identificador del descuento.</param>
        public List <CarritoComprasDetalle> GetProductosMembresias(TiposServicios referencia_tipo, int referencia_id, int referencia_cantidad, int referencia_meses,
                                                                   string referencia_fecha_inicio, int precio_id, int moneda_id, int impuesto_id, int descuento_id)
        {
            List <CarritoComprasDetalle> carrito = new List <CarritoComprasDetalle>();

            try
            {
                conn.Open();
                command             = CreateCommand();
                command.Connection  = conn;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "sp_vw_pro_Carrito_Compras";
                command.Parameters.AddWithValue("@Referencia_Tipo", referencia_tipo.ToString());
                command.Parameters.AddWithValue("@Referencia_Id", referencia_id);
                command.Parameters.AddWithValue("@Referencia_Cantidad", referencia_cantidad);
                command.Parameters.AddWithValue("@Referencia_Meses", referencia_meses);
                command.Parameters.AddWithValue("@Referencia_Vigencia_Fecha_Inicio", referencia_fecha_inicio);
                command.Parameters.AddWithValue("@Referencia_Lista_Precio_Id", precio_id);
                command.Parameters.AddWithValue("@Referencia_Moneda_Id", moneda_id);
                command.Parameters.AddWithValue("@Referencia_Impuesto_Id", impuesto_id);
                if (descuento_id != 0)
                {
                    command.Parameters.AddWithValue("@Referencia_Descuento_Id", descuento_id);
                }
                reader = command.ExecuteReader();
                while (reader.Read())
                {
                    carrito.Add(new CarritoComprasDetalle
                    {
                        Membresia_Id              = reader["Membresia_Id"].ToString(),
                        Inscripcion_Membresia_Id  = reader["Inscripcion_Membresia_Id"].ToString(),
                        Lista_Precio_Membresia_Id = reader["Lista_Precio_Membresia_Id"].ToString(),
                        Producto_Id = reader["Producto_Id"].ToString(),
                        Lista_Precio_Producto_Id = reader["Lista_Precio_Producto_Id"].ToString(),
                        Servicio_Id = reader["Servicio_Id"].ToString(),
                        Lista_Precio_Servicio_Id                        = reader["Lista_Precio_Servicio_Id"].ToString(),
                        Carrito_Compras_Detalle_Descripcion             = reader["Carrito_Compras_Detalle_Descripcion"].ToString(),
                        Carrito_Compras_Detalle_Cantidad                = reader["Carrito_Compras_Detalle_Cantidad"].ToString(),
                        Carrito_Compras_Detalle_Importe_Precio          = reader["Carrito_Compras_Detalle_Importe_Precio"].ToString(),
                        Carrito_Compras_Detalle_Importe_Prorrateo       = reader["Carrito_Compras_Detalle_Importe_Prorrateo"].ToString(),
                        Carrito_Compras_Detalle_Importe_Suma            = reader["Carrito_Compras_Detalle_Importe_Suma"].ToString(),
                        Carrito_Compras_Detalle_Importe_Descuento       = reader["Carrito_Compras_Detalle_Importe_Descuento"].ToString(),
                        Carrito_Compras_Detalle_Importe_Subtotal        = reader["Carrito_Compras_Detalle_Importe_Subtotal"].ToString(),
                        Carrito_Compras_Detalle_Importe_Impuesto        = reader["Carrito_Compras_Detalle_Importe_Impuesto"].ToString(),
                        Carrito_Compras_Detalle_Importe_Total           = reader["Carrito_Compras_Detalle_Importe_Total"].ToString(),
                        Carrito_Compras_Detalle_Estatus                 = reader["Carrito_Compras_Detalle_Estatus"].ToString(),
                        Carrito_Compras_Detalle_Vigencia_Fecha_Inicio   = reader["Carrito_Compras_Detalle_Vigencia_Fecha_Inicio"].ToString(),
                        Carrito_Compras_Detalle_Vigencia_Fecha_Fin      = reader["Carrito_Compras_Detalle_Vigencia_Fecha_Fin"].ToString(),
                        Carrito_Compras_Detalle_Vigencia_Fecha          = reader["Carrito_Compras_Detalle_Vigencia_Fecha"].ToString(),
                        Carrito_Compras_Detalle_Importe_Suma_Texto      = reader["Carrito_Compras_Detalle_Importe_Suma_Texto"].ToString(),
                        Carrito_Compras_Detalle_Importe_Descuento_Texto = reader["Carrito_Compras_Detalle_Importe_Descuento_Texto"].ToString(),
                        Carrito_Compras_Detalle_Importe_Subtotal_Texto  = reader["Carrito_Compras_Detalle_Importe_Subtotal_Texto"].ToString(),
                        Carrito_Compras_Detalle_Importe_Impuesto_Texto  = reader["Carrito_Compras_Detalle_Importe_Impuesto_Texto"].ToString(),
                        Carrito_Compras_Detalle_Importe_Total_Texto     = reader["Carrito_Compras_Detalle_Importe_Total_Texto"].ToString()
                    });
                }
            }
            catch (Exception e)
            {
                SlackLogs.SendMessage(e.Message, GetType().Name, "GetProductosMembresias");
            }
            finally { conn.Close(); }
            return(carrito);
        }