Esempio n. 1
0
        public static MemoryStream GetCustomerInfoStream(int id, DealershipViewModel dealerSessionInfo)
        {
            TradeInVehicleModel vehicle    = GetTradeinVehicle(id);
            MemoryStream        workStream = PDFHelper.WritePDF(EmailHelper.CreateBannerBodyForPdf(vehicle, dealerSessionInfo));

            return(workStream);
        }
        public async Task <string> AddTradeInVehicleProxyService([FromBody] TradeInVehicleModel model)
        {
            if (ModelState.IsValid)
            {
                var headers        = new Dictionary <string, string>();
                var tokenGenerated = HttpContext.Session.GetHmacToken();
                headers.Add("X-Hmac", tokenGenerated);
                headers.Add("X-PublicKey", HttpContext.Session.GetUserPublicKey());
                string queryStr = _queryCreater.GetQueryStringFromObject(model);
                var    response = await HttpClientRequestFactory.Get("http://proxy.mansis.co.za:18443/SlimProxyBoot.php?" + queryStr, headers);

                var data = response.Content.ReadAsStringAsync().Result;
                return(data.ToString());
            }
            else
            {
                throw new Exception("Model state is not valid");
            }
        }
Esempio n. 3
0
        public static TradeInVehicleModel GetTradeinVehicle(int id)
        {
            var     context  = new whitmanenterprisewarehouseEntities();
            var     customer = context.vincontrolbannercustomers.Where(e => e.TradeInCustomerId == id).FirstOrDefault();
            decimal result;

            TradeInVehicleModel vehicle = new TradeInVehicleModel()
            {
                Condition          = customer.Condition,
                CustomerEmail      = customer.Email,
                CustomerFirstName  = customer.FirstName,
                CustomerLastName   = customer.LastName,
                CustomerPhone      = customer.Phone,
                SelectedMake       = customer.Make,
                SelectedModel      = customer.Model,
                SelectedTrim       = customer.Trim,
                SelectedYear       = customer.Year.HasValue ? customer.Year.Value.ToString() : String.Empty,
                Mileage            = customer.Mileage.HasValue ? customer.Mileage.Value.ToString() : String.Empty,
                SelectedOptionList = customer.SelectedOptions,
                TradeInFairPrice   = decimal.TryParse(customer.TradeInFairValue, out result) ? result.ToString("c0") : customer.TradeInFairValue
            };

            return(vehicle);
        }