public ServiceResponse GetNewOrder(UserSessionModel user, long quoteId)
        {
            var queryERPAccountId = (from business in this.Context.Businesses
                                     select business).Where(b => b.BusinessId == user.BusinessId);

            var ERPAccountId = queryERPAccountId.FirstOrDefault().ERPAccountId;

            var query = from quote in this.Context.Quotes
                        join project in this.Context.Projects on quote.ProjectId equals project.ProjectId
                        where quote.QuoteId == quoteId
                        select new OrderViewModelLight
            {
                OrderStatusTypeId = OrderStatusTypeEnum.NewRecord,
                ProjectId         = project.ProjectId,
                ProjectName       = project.Name,
                QuoteId           = quote.QuoteId,
                DiscountRequestId = quote.DiscountRequestId,
                QuoteTitle        = quote.Title,
                BusinessId        = project.Owner.BusinessId,
                BusinessName      = project.Owner.Business.BusinessName,
                AccountID         = project.Owner.Business.AccountId,
                ShipToAddressId   = project.ShipToAddressId,
                ShipToName        = project.ShipToName,
                PricingTypeId     = quote.IsCommission ? (byte)2 : (byte)1,
                TotalNetPrice     = quote.TotalNet,
                //TotalDiscountPercent = quote.DiscountPercentage,
                TotalDiscountPercent  = quote.ApprovedDiscountPercentage,
                ERPAccountId          = ERPAccountId,
                EstimatedDeliveryDate = project.EstimatedDelivery,
                SubmitDate            = DateTime.Now,
                SubmittedByUserId     = user.UserId,
                SubmittedByUserName   = user.LastName + ", " + user.FirstName,
                CreatedByUserId       = user.UserId,
                UpdatedByUserId       = user.UserId,
                Timestamp             = quote.Timestamp
            };

            var model = query.FirstOrDefault();

            model.EstimatedReleaseDate = model.EstimatedDeliveryDate.AddDays(-10);

            model.Project            = projectService.GetProjectModel(user, model.ProjectId).Model as ProjectModel;
            model.HasConfiguredModel = quoteService.HasConfiguredModel(model.QuoteId);

            this.Response.Model = model;

            return(this.Response);
        }
示例#2
0
        public ServiceResponse GetSubmittalOrder()
        {
            using (var quoteService = new QuoteServices())
            {
                if (quoteService.HasConfiguredModel(683220433364942848))
                {
                    var temp = 0;
                    //return orderService.BuildSubmittalOrder(683222334861049856);
                }

                var xmlResponse = "<Order_Response><CustomerNumber>20033700</CustomerNumber><Config_Order>9</Config_Order><Order_Type>Customer</Order_Type><MapicsModel><Site>002</Site><Model_Number>DTC060XXX3DXXD</Model_Number><Revision>AA</Revision><BomCreation><Status>Successful</Status></BomCreation></MapicsModel></Order_Response>";
                // string xmlResponse = "<Order_Response><Exception>Duplicate Order# received.</Exception></Order_Response>";
                var serviceResponse = _erpSvcProvider.ProcessMapicsOrderSeriveResponse(xmlResponse);
                return(null);
            }
        }