コード例 #1
0
        public TestOrderController()
        {
            orderService      = new OrderServices(this.TContext);
            orderServiceLight = new OrderServiceLight();
            searchOrders      = new SearchOrders();

            accountService = new AccountServices();
            user           = accountService.GetUserSessionModel("*****@*****.**").Model as UserSessionModel;
            quoteService   = new QuoteServices();

            orderVMLight                             = new OrderViewModelLight();
            orderVMLight.BusinessId                  = 206680765352640513;
            orderVMLight.ShipToAddressId             = 479102086194151432;
            orderVMLight.PricingTypeId               = 1;
            orderVMLight.PONumber                    = "AAPO0613201601";
            orderVMLight.TotalDiscountPercent        = 0;
            orderVMLight.EstimatedReleaseDate        = Convert.ToDateTime("2016-06-06 00:00:00.000");
            orderVMLight.DeliveryAppointmentRequired = false;
            orderVMLight.DeliveryContactName         = "";
            orderVMLight.DeliveryContactPhone        = "";
            orderVMLight.OrderReleaseDate            = DateTime.Now.AddDays(2);
            orderVMLight.SubmittedByUserId           = 392643416367824896;
            orderVMLight.SubmitDate                  = DateTime.Now;
            orderVMLight.CreatedByUserId             = 392643416367824896;
            orderVMLight.UpdatedByUserId             = 392643416367824896;
            orderVMLight.DiscountRequestId           = 0;
            orderVMLight.CommissionRequestId         = 0;
            orderVMLight.ERPOrderNumber              = "";
            orderVMLight.ERPPOKey                    = 0;
            orderVMLight.ERPStatus                   = "Submitted";
            orderVMLight.Comments                    = "PLEASE CALL BEFORE SHIPPING";
            orderVMLight.ERPComments                 = "";
            orderVMLight.ERPOrderDate                = null;
            orderVMLight.ERPInvoiceDate              = null;
            orderVMLight.ERPShipDate                 = null;
            orderVMLight.ERPInvoiceNumber            = null;
            orderVMLight.QuoteId                     = 479102111284477952;
            orderVMLight.ProjectId                   = 479102086194151424;
            orderVMLight.CurrentUser                 = user;
            var fileUpload = new FileUploadTest();

            orderVMLight.POAttachment         = fileUpload;
            orderVMLight.POAttachmentFileName = fileUpload.FileUploadName;
            orderVMLight.ERPAccountId         = "1234";

            orderControllerApi          = new OrderController();
            orderController             = new DPO.Web.Controllers.ProjectDashboardController();
            orderController.CurrentUser = user;

            projects = this.db.Projects.Where(p => p.OwnerId == user.UserId).ToList();
        }
コード例 #2
0
        public void TestOrderService_RuleOnAdd_CannotSubmitOrderIfQuoteHasNoItem()
        {
            this.response.Messages.HasErrors = false;
            this.response.Messages.Items.Clear();

            var   fileUpload = new FileUploadTest();
            Order entity     = new Order();

            entity = orderService.ModelToEntity(user, orderVMLight);
            entity.Quote.AwaitingCommissionRequest = false;
            entity.Quote.AwaitingDiscountRequest   = false;
            List <OrderItem> orderItems = new List <OrderItem>();

            entity.OrderItems = orderItems;

            orderService.RulesOnAdd(user, entity, out response);

            Assert.That(this.response.Messages.Items.Any(m => m.Text == Resources.ResourceModelProject.MP135), Is.EqualTo(true));
        }
コード例 #3
0
        public TestOrderAPI()
        {
            orderService      = new OrderServices(this.TContext);
            orderServiceLight = new OrderServiceLight();
            searchOrders      = new SearchOrders();

            accountService = new AccountServices();
            user           = accountService.GetUserSessionModel("*****@*****.**").Model as UserSessionModel;
            quoteService   = new QuoteServices();

            orderVMLight                             = new OrderViewModelLight();
            orderVMLight.BusinessId                  = 206680765352640513;
            orderVMLight.ShipToAddressId             = 479102086194151432;
            orderVMLight.PricingTypeId               = 1;
            orderVMLight.PONumber                    = "AAPO0613201601";
            orderVMLight.TotalDiscountPercent        = 0;
            orderVMLight.EstimatedReleaseDate        = Convert.ToDateTime("2016-06-06 00:00:00.000");
            orderVMLight.DeliveryAppointmentRequired = false;
            orderVMLight.DeliveryContactName         = "";
            orderVMLight.DeliveryContactPhone        = "";
            orderVMLight.OrderReleaseDate            = DateTime.Now.AddDays(2);
            orderVMLight.SubmittedByUserId           = 392643416367824896;
            orderVMLight.SubmitDate                  = DateTime.Now;
            orderVMLight.CreatedByUserId             = 392643416367824896;
            orderVMLight.UpdatedByUserId             = 392643416367824896;
            orderVMLight.DiscountRequestId           = 0;
            orderVMLight.CommissionRequestId         = 0;
            orderVMLight.ERPOrderNumber              = "";
            orderVMLight.ERPPOKey                    = 0;
            orderVMLight.ERPStatus                   = "Submitted";
            orderVMLight.Comments                    = "PLEASE CALL BEFORE SHIPPING";
            orderVMLight.ERPComments                 = "";
            orderVMLight.ERPOrderDate                = null;
            orderVMLight.ERPInvoiceDate              = null;
            orderVMLight.ERPShipDate                 = null;
            orderVMLight.ERPInvoiceNumber            = null;
            orderVMLight.QuoteId                     = 479102111284477952;
            orderVMLight.ProjectId                   = 479102086194151424;
            orderVMLight.CurrentUser                 = user;
            var fileUpload = new FileUploadTest();

            orderVMLight.POAttachment         = fileUpload;
            orderVMLight.POAttachmentFileName = fileUpload.FileUploadName;
            orderVMLight.ERPAccountId         = "1234";

            orderController = new OrderController();

            projects = this.db.Projects.Where(p => p.OwnerId == user.UserId).ToList();

            foreach (var project in projects)
            {
                var result = this.db.Context.Quotes.Where(q => q.AwaitingOrder == null && q.ProjectId == project.ProjectId).OrderByDescending(q => q.QuoteId).Select(q => new { q.QuoteId, q.ProjectId }).FirstOrDefault();
                if (result != null)
                {
                    quoteModel = quoteService.GetQuoteModel(user, result.ProjectId, result.QuoteId).Model as QuoteModel;
                    if (quoteModel != null)
                    {
                        quotesModelWithoutOrder.Add(quoteModel);
                    }
                }
            }

            foreach (var project in projects)
            {
                var result = this.db.Context.Quotes.Where(q => q.AwaitingOrder == true && q.ProjectId == project.ProjectId).OrderByDescending(q => q.QuoteId).Select(q => new { q.QuoteId, q.ProjectId }).FirstOrDefault();
                if (result != null)
                {
                    quoteModel = quoteService.GetQuoteModel(user, result.ProjectId, result.QuoteId).Model as QuoteModel;
                    if (quoteModel != null)
                    {
                        quotesModelWithOrder.Add(quoteModel);
                    }
                }
            }
        }