public override BaseEntity BuildObject(Dictionary <string, object> row)
        {
            var hotel = new CommissionHotel
            {
                Id            = GetIntValue(row, DB_COL_ID),
                Name          = GetStringValue(row, DB_COL_NAME),
                Description   = GetStringValue(row, DB_COL_DESCRIPTION),
                LegalNumber   = GetStringValue(row, DB_COL_LEGAL_NUMBER),
                BusinessName  = GetStringValue(row, DB_COL_BUSINESS_NAME),
                BusinessChain = GetStringValue(row, DB_COL_BUSINES_CHAIN),
                HotelEmail    = GetStringValue(row, DB_COL_EMAIL),
                PhoneNumber   = GetStringValue(row, DB_COL_PHONE_NUMBER),
                Stars         = GetStringValue(row, DB_COL_STARS),
                State         = GetStringValue(row, DB_COL_HOTEL_STATE),
                //UBICACION
                Latitude  = GetStringValue(row, DB_COL_LATITUDE),
                Longitude = GetStringValue(row, DB_COL_LONGITUDE),
                Province  = GetStringValue(row, DB_COL_PROVINCE),
                Canton    = GetStringValue(row, DB_COL_CANTON),
                District  = GetStringValue(row, DB_COL_DISTRICT),
                //SOLICITUD
                Date         = GetDateValue(row, DB_COL_DATE),
                DailySales   = GetDecimalValue(row, DB_COL_DAILY_SALES),
                MonthlySales = GetDecimalValue(row, DB_COL_MONTHLY_SALES),
                Email        = GetStringValue(row, DB_COL_EMAIL_USER),
                RequestState = GetStringValue(row, DB_COL_REQUEST_STATE),
                //IMAGEN
                Value      = GetStringValue(row, DB_COL_VALUE),
                Type       = GetStringValue(row, DB_COL_TYPE),
                Commission = GetDecimalValue(row, DB_COL_COMMISSION)
            };

            return(hotel);
        }
Exemple #2
0
        public async Task <IHttpActionResult> Post(ArrayProductosWithCorreo datos)
        {
            try
            {
                var productoCarritoManager       = new ProductoCarritoManagement();
                var userManager                  = new UserManagement();
                var hotelManagement              = new HotelManagement();
                List <ProductoCarrito> productos = datos.productsArray;
                User tmpUser = new User {
                    Correo = datos.correo
                };
                User            user  = userManager.RetrieveByCorreo(tmpUser);
                CommissionHotel hotel = hotelManagement.getCommision(datos.hotel);

                await productoCarritoManager.SendEmailCart(productos, user, hotel);

                apiResponse = new ApiResponse();

                return(Ok(apiResponse));
            }
            catch (BussinessException bex)
            {
                return(InternalServerError(new Exception(bex.AppMessage.Message)));
            }
        }
Exemple #3
0
        public async System.Threading.Tasks.Task <IHttpActionResult> Post4Async(Hotel hotel)
        {
            var hotelManager = new HotelManagement();
            var userManager  = new UserManagement();

            apiResponse = new ApiResponse();
            decimal         totalPrice      = hotel.DailySales;
            CommissionHotel commissionHotel = hotelManager.getCommision(hotel.Id);
            User            tmpUser         = new User()
            {
                Correo = hotel.Email
            };
            User user = userManager.RetrieveByCorreo(tmpUser);
            await hotelManager.SendMembershipEmail(commissionHotel, user, totalPrice);

            return(Ok(apiResponse));
        }
        public async Task SendMembershipEmail(CommissionHotel commissionHotel, User user, decimal totalPrice)
        {
            var correo = user.Correo;

            var client           = new SendGridClient("sendgrid_key");
            var from             = new EmailAddress("*****@*****.**", "Stay n'Chill");
            var subject          = "Factura de Compra";
            var to               = new EmailAddress(correo);
            var plainTextContent = "";

            var htmlContent = string.Format(@"<div style='max-width: 800px; margin: auto; padding: 30px; border: 1px solid #eee; box-shadow: 0 0 10px rgba(0, 0, 0, .15); font-size: 16px; line-height: 24px; font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; color: #555; border-radius: 7px;'>
        <table cellpadding='0' cellspacing='0' style='width: 100%; line-height: inherit; text-align: left;'>
            <tr style='font-size: 45px;
            line-height: 45px;
            color: #333;padding-bottom: 40px;'>
                <td colspan='2' style='padding: 5px; vertical-align: top;'>
                    <table style='width: 100%; line-height: inherit; text-align: left;'>
                        <tr>
                            <td  style='font-size: 45px;
                            line-height: 45px;
                            color: #333;padding: 5px; vertical-align: top;'>
                                <img src='https://res.cloudinary.com/qubitscenfo/image/upload/v1565417512/ckxg43ppvqlizl1mzzie.png' style='width:100%; max-width:300px;'>
                            </td>
                            
                            
                        </tr>
                    </table>
                </td>
            </tr>
            
            <tr class='information'>
                <td colspan='2' style='padding: 5px; vertical-align: top;'>
                    <table>
                        
                    </table>
                </td>
            </tr>
            
            <tr class='heading'>
                <td style='padding: 5px; vertical-align: top;'>
                    Método de Pago
                </td>
                
                <td style='padding: 5px; vertical-align: top;'>
                    PayPal
                </td>
            </tr>
            
            
            
            <tr class='heading'>
                <td style='padding: 5px; vertical-align: top;'>
                    Item
                </td>
                
                <td style='padding: 5px; vertical-align: top;'>
                    Precio
                </td>
            </tr>
            
            <tr class='item'>
                <td style='padding: 5px; vertical-align: top;'>
                    Membresía de Hotel
                </td>
                
                <td style='padding: 5px; vertical-align: top;'>
                    $" + $@"{totalPrice}" + @"
                </td>
            </tr>
            
            <tr class='total'>
                <td></td>
                
                <td>
                   Total: $" + $@"{totalPrice}" + @"
                </td>
            </tr>
        </table>
    </div>");

            var msg      = MailHelper.CreateSingleEmail(from, to, subject, plainTextContent, htmlContent);
            var response = await client.SendEmailAsync(msg);
        }
 public async Task SendMembershipEmail(CommissionHotel commissionHotel, User user, decimal totalPrice) => await crudHotel.SendMembershipEmail(commissionHotel, user, totalPrice);
 public async Task SendEmailCart(List <ProductoCarrito> productos, User user, CommissionHotel hotel) => await crudProductoCarrito.SendEmailCart(productos, user, hotel);