示例#1
0
        public ActionResult Detail(Guid rfqId)
        {
            var rfq = _rfqRepository.GetRfq(rfqId);

            RfqViewModel model = new RfqConverter().ConvertToView(rfq);

            return(View(model));
        }
示例#2
0
        public JsonResult SendRfqEmail(Guid rfqId, EmailModel model)
        {
            var operationResult = new OperationResult();

            var _emailManager = new MailManager();

            var ms = ReportingManager.CreateRfqReport(rfqId);

            var currentRfq = _rfqRepository.GetRfq(rfqId);

            var fromUser = UserManager.FindById(User.Identity.GetUserId());

            model.MS        = ms;
            model.FromEmail = fromUser.Email;
            model.Number    = currentRfq.Number;

            operationResult = _emailManager.SendEmail(model);

            return(Json(operationResult, JsonRequestBehavior.AllowGet));
        }
示例#3
0
        public JsonResult Create(PriceSheetViewModel priceSheet)
        {
            var operationResult = new OperationResult();

            var rfq = _rfqRepository.GetRfq(priceSheet.RfqId);

            var newPriceSheet = new PriceSheetConverter().ConvertToDomain(priceSheet);

            operationResult = _priceSheetRepository.SavePriceSheet(newPriceSheet);

            if (operationResult.Success && priceSheet.IsQuote)
            {
                rfq.IsOpen      = false;
                operationResult = _rfqRepository.UpdateRfq(rfq);
            }

            var insertedPriceSheet = _priceSheetRepository.GetPriceSheet(priceSheet.Number);

            if (operationResult.Success)
            {
                if (priceSheet.CostDetailList != null && priceSheet.CostDetailList.Count > 0)
                {
                    foreach (var costDetail in priceSheet.CostDetailList)
                    {
                        var priceDetail = priceSheet.PriceDetailList.FirstOrDefault(x => x.ProjectPartId == costDetail.ProjectPartId);

                        var tempPart = _projectPartRepository.GetProjectPart(costDetail.ProjectPartId);
                        {
                            tempPart.Weight       = costDetail.Weight;
                            tempPart.AnnualUsage  = (int)costDetail.AnnualUsage;
                            tempPart.Cost         = costDetail.Cost;
                            tempPart.PatternCost  = costDetail.PatternCost;
                            tempPart.FixtureCost  = costDetail.FixtureCost;
                            tempPart.PriceSheetId = insertedPriceSheet.PriceSheetId;
                            tempPart.Price        = priceDetail.Price;
                            tempPart.PatternPrice = priceDetail.PatternPrice;
                            tempPart.FixturePrice = priceDetail.FixturePrice;
                        }
                        operationResult = _projectPartRepository.UpdateProjectPart(tempPart);
                    }
                }

                if (operationResult.Success && priceSheet.IsQuote)
                {
                    operationResult = _rfqRepository.UpdatePriceSheet(rfq.RfqId, priceSheet.Number);
                }
                else if (priceSheet.IsProduction && operationResult.Success)
                {
                    if (priceSheet.QuoteId != Guid.Empty)
                    {
                        var quote = _quoteRepository.GetQuote(priceSheet.QuoteId);
                        quote.IsOpen    = false;
                        operationResult = _quoteRepository.UpdateQuote(quote);
                    }

                    ConvertProjectPartsToParts(insertedPriceSheet.PriceSheetId);
                }
            }

            operationResult.ReferenceId = insertedPriceSheet.PriceSheetId;

            return(Json(operationResult, JsonRequestBehavior.AllowGet));;
        }
示例#4
0
        public ActionResult Convert(Guid rfqId)
        {
            var currentRfq = _rfqRepository.GetRfq(rfqId);

            QuoteViewModel model = new QuoteConverter().ConvertToView(currentRfq);

            model.QuoteNumber = QuoteNumber();

            _quoteRepository.RemoveQuoteNumber(model.QuoteNumber);

            model.SelectableCustomerAddresses = _customerAddressDynamicsRepository.GetSelectableCustomerAddresses(model.CustomerId);

            model.SelectableShipmentTerms = _shipmentTermRepository.GetSelectableShipmentTerms();

            var defaultShipmentTerm = new SelectListItem()
            {
                Text  = "--Select Shipment Term--",
                Value = null
            };

            model.SelectableShipmentTerms.Insert(0, defaultShipmentTerm);

            model.SelectablePaymentTerms = _paymentTermRepository.GetSelectablePaymentTerms();

            var defaultPaymentTerm = new SelectListItem()
            {
                Text  = "--Select Payment Term--",
                Value = null
            };

            model.SelectablePaymentTerms.Insert(0, defaultPaymentTerm);

            model.SelectableMaterial = _materialRepository.GetSelectableMaterials();

            var defaultMaterial = new SelectListItem()
            {
                Text  = "--Select Material--",
                Value = null
            };

            model.SelectableMaterial.Insert(0, defaultMaterial);

            model.SelectableCoatingTypes = _coatingTypeRepository.GetSelectableCoatingTypes();

            var defaultCoatingType = new SelectListItem()
            {
                Text  = "--Select Coating Type--",
                Value = null
            };

            model.SelectableCoatingTypes.Insert(0, defaultCoatingType);

            model.SelectableHtsNumbers = _htsNumberRepository.GetSelectableHtsNumbers();

            var defaultHtsNumber = new SelectListItem()
            {
                Text  = "--Select HtsNumber--",
                Value = null
            };

            model.SelectableHtsNumbers.Insert(0, defaultHtsNumber);

            return(View(model));
        }