Esempio n. 1
0
        /// <summary>
        /// Get Order History of Custoemr
        /// </summary>
        /// <param name="id"></param>
        /// <returns> Returns a Database with the history of cutsomers</returns>
        BusinessModels.Customer IRepository.GetOrderHistoryOfCustomer(int id)
        {
            var dbOrderHitory = _context.CustomerOrders.Include(c => c.Customer);

            BusinessModels.Customer customer = new BusinessModels.Customer(id);
            int i = 0;

            foreach (var order in dbOrderHitory)
            {
                if (order.CustomerId == id)
                {
                    if (i == 0)
                    {
                        customer.FirstName  = order.Customer.FirstName;
                        customer.LastName   = order.Customer.LastName;
                        customer.Phone      = order.Customer.Phone;
                        customer.CustomerId = order.Customer.CustomerId;
                        customer.Email      = order.Customer.Email;
                    }
                    var time = order.TransactionTime.ToString();
                    customer.CustomerOrders.Add(new Order(order.TransactionNumber, order.StoreId, order.CustomerId, order.Customer.FirstName, order.Customer.LastName, time));
                    i++;
                }
            }

            return(customer);
        }
Esempio n. 2
0
 public BusinessModels.Customer Insert(BusinessModels.Customer customer)
 {
     BusinessModels.Customer bscustomer = _dataLayer.Insert(customer);
     //BusinessModels.ProductEnquiry prodEnq = new BusinessModels.ProductEnquiry();
     //prodEnq.StatusID = 1;
     //prodEnq.LocationId = customer.LocationID;
     //prodEnq.CustomerID = bscustomer.Identity;
     //prodEnq.CreatedDate = DateTime.Now;
     //prodEnq.EnquiryLevelID = bscustomer.EnquiryLevelID;
     //prodEnq.AssignedTo = customer.AssignedTo;
     //prodEnq.OriginatorID = customer.AssignedTo;
     //prodEnq.CreatedBy = customer.CreatedBy;
     //_prodenqdataLayer.Insert(prodEnq);
     return(bscustomer);
 }
Esempio n. 3
0
        public BusinessModels.ProductEnquiry Update(BusinessModels.Customer customer)
        {
            BusinessModels.ProductEnquiry prodEnq = new BusinessModels.ProductEnquiry();
            prodEnq.StatusID       = 1;
            prodEnq.LocationId     = customer.LocationID;
            prodEnq.CustomerID     = customer.Identity;
            prodEnq.CreatedDate    = DateTime.Now;
            prodEnq.EnquiryLevelID = customer.EnquiryLevelID;
            prodEnq.AssignedTo     = customer.AssignedTo;
            prodEnq.OriginatorID   = customer.AssignedTo;
            prodEnq.CreatedBy      = customer.ModifiedBy;
            prodEnq.IsActive       = true;
            _dataLayer.Update(customer);

            return(_prodenqdataLayer.Insert(prodEnq));
        }
Esempio n. 4
0
        async Task IRepository.AddCustomer(BusinessModels.Customer customer)
        {
            // pass in all the values of customer and place them in.
            EfModels.Customer newCustomer = new EfModels.Customer()
            {
                FirstName = customer.FirstName,
                LastName  = customer.LastName,
                Email     = customer.Email,
                Phone     = customer.Phone
            };

            // add customer to context
            await _context.AddAsync(newCustomer);

            await _context.SaveChangesAsync();
        }
Esempio n. 5
0
 public Boolean Update(BusinessModels.Customer customer)
 {
     return(_dataLayer.Update(customer));
 }
Esempio n. 6
0
 public JsonResult Update(BusinessModels.Customer customer)
 {
     return(Json(new { Success = false, Status = "Success" }));
 }