Exemplo n.º 1
0
        public void Processor(Cart cart,  Customer user, Address address, string shipMethod)
        {
            ISalesOrderDetail iSalesOrderDetail = new EFSalesOrderDetails();
            ISalesOrderHeader iSalesOrderHeader = new EFSalesOrderHeader();
            var salesOrderHeader=new SalesOrderHeader
            {
                ModifiedDate = DateTime.Now,
                rowguid = Guid.NewGuid(),
                CustomerID = user.CustomerID,
                RevisionNumber = 0,
                OrderDate = DateTime.Now,
                DueDate = DateTime.Now,
                ShipMethod = shipMethod,
                TotalDue = 0,
                SubTotal = cart.ComputeTotalValue(),
                ShipToAddressID = address.AddressID,
                BillToAddressID = address.AddressID
            };
            iSalesOrderHeader.AddSalesOrderHeader(salesOrderHeader);
            foreach (var prod in cart.Lines)
            {
                iSalesOrderDetail.AddSalesOrderDetails(new SalesOrderDetail { UnitPrice = prod.Product.StandardCost, ModifiedDate = DateTime.Now, OrderQty = (short)prod.Quantity, ProductID = prod.Product.ProductID, UnitPriceDiscount = 0, rowguid = Guid.NewGuid(), SalesOrderDetailID = 0, SalesOrderID = salesOrderHeader.SalesOrderID });

                }
        }
Exemplo n.º 2
0
 public Order()
 {
     Customer = new Customer();
     GoodsList = new List<GoodsRow>();
     Status = new OrderStatus("Открыт");
     Comments = new List<Comment>();
 }
Exemplo n.º 3
0
 public Order()
 {
     Customer = new Customer();
     goodsList = new List<GoodsRow>();
     Status = new OrderStatus();
     comments = new List<Comment>();
 }
 private CustomerDto CustomerToDto(Customer customer)
 {
     return new CustomerDto
     {
         CustomerId = customer.Id,
         FirstName = customer.FirstName,
         LastName = customer.LastName,
         Telephone = customer.Telephone
     };
 }
 public CustomerDetailsPresenter(CustomerDetailsViev view, int id)
 {
     this.view = view;
     if (id < 0)
     {
         customer = new Customer();
     }
     else
     {
         customer = model.GetById(id);
     }
 }
Exemplo n.º 6
0
        public static Customer Create(IRepositoryLocator locator, CustomerDto operation)
        {
            var instance = new Customer
            {
                FirstName = operation.FirstName,
                LastName = operation.LastName,
                Telephone = operation.Telephone
            };

            locator.Save(instance);
            return instance;
        }
Exemplo n.º 7
0
        public Order(Customer customer, List<GoodsRow> goods, Comment comment)
        {
            Customer = customer;
            goodsList = new List<GoodsRow>();
            comments = new List<Comment>();

            foreach (GoodsRow row in goods)
            {
                 goodsList.Add(row);
                 TotalCost += row.Price;
            }

            comments.Add(comment);
        }
Exemplo n.º 8
0
 private bool AddUser(RegisterViewModel user)
 {
     Customer newuser = new Customer();
     newuser.FirstName = user.FirstName;
     newuser.LastName = user.LastName;
     newuser.EmailAddress = user.UserName;
     var pass = StringUtils.getSaltHash(user.Password);
     newuser.PasswordHash = pass.SingleOrDefault(x => x.Key == "hash").Value;
     newuser.PasswordSalt = pass.SingleOrDefault(x => x.Key == "salt").Value;
     newuser.NameStyle = false;
     try
     {
         repository.Save(newuser);
         return true;
     }
     catch (Exception ex)
     {
         return false;
     }
 }
 public void SaveAndNew()
 {
     this.Save();
     customer = new Customer();
     NotifyPropertyChanged("New Customer");
 }
Exemplo n.º 10
0
        public async Task <ActionResult <CustomerDto> > PostCustomer(CustomerInputDto input)
        {
            try
            {
                DateTime?dateime  = null;
                var      customer = new Domain.Entities.Customer()
                {
                    FullName      = input.FullName,
                    Address       = input.Address,
                    City          = input.City,
                    Country       = input.Country,
                    BirthDate     = DateTimeString.TryParsingDate(input.BirthDate, false),
                    Email         = input.Email,
                    Gender        = input.Gender,
                    Phone         = input.Phone,
                    PostalCode    = input.PostalCode,
                    CreatedDate   = DateTime.Now,
                    CreatedUserId = input.UserId,
                    Note          = input.Note
                };
                _context.Customers.Add(customer);
                await _context.SaveChangesAsync();

                //var course = new Course()
                //{
                //    ExamDate = dateime,
                //    InChargeId = input.InChargeId,
                //    CustomerId = customer.Id,
                //    LessonPeriod = Domain.Enums.LessonPeriod.TwoHours,
                //    Note = input.Note,
                //    StartCourse = DateTimeString.TryParsingDate(input.StartCourse, false),
                //    TotalAmount = 0,
                //    CurrencyId = null,
                //    PeroidBeforeSendEmailId = null,
                //    TypeOfExamId = null,
                //    TypeOfPacketId = null,
                //    CreatedDate = DateTime.Now,
                //    CreatedUserId = input.UserId
                //};
                //course.RemainingMoney = course.TotalAmount;
                //course.Status = Domain.Enums.CourseStatus.NotStarted;
                //_context.Courses.Add(course);
                var user = await _context.Users.FirstOrDefaultAsync(x => x.Id == input.UserId);

                var log = new Log()
                {
                    DateTime     = DateTime.Now,
                    TypeFullName = typeof(Domain.Entities.Customer).FullName,
                    Content      = "@userName@addAction@objTitle",
                    TypeId       = customer.Id,
                    UserId       = user.Id
                };
                _context.Logs.Add(log);
                await _context.SaveChangesAsync();

                var result = new CustomerDto()
                {
                    Id         = customer.Id,
                    FullName   = customer.FullName,
                    BirthDate  = customer.BirthDate,
                    Address    = customer.Address,
                    City       = customer.City,
                    Country    = customer.Country,
                    Email      = customer.Email,
                    Gender     = customer.Gender,
                    Phone      = customer.Phone,
                    PostalCode = customer.PostalCode
                };
                return(result);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }