public ActionResult QuoteRequest(int id, QuoteInfoDto quote)
 {
     if (ModelState.IsValid)
     {
         return(View("QuoteComplete", quote));
     }
     return(View(quote));
 }
 public static void SendQuoteCreation(QuoteInfoDto quote)
 {
     if (WebContext.Current.EmailSender != null)
     {
         NotificationFactory factory = new NotificationFactory(WebContext.Current.EmailSender);
         QuoteCreationNotificationBuilder builder = new QuoteCreationNotificationBuilder(quote, WebContext.Current.QuoteCreationTemplate);
         factory.Send(builder);
     }
 }
 public ActionResult QuoteRequest(int id)
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         QuoteFacade  facade = new QuoteFacade(uow);
         QuoteInfoDto quote  = facade.CreateQuote(id);
         return(View(quote));
     }
 }
Esempio n. 4
0
 private void CollectQuoteInfo(QuoteInfoDto quote)
 {
     quote.ProductId     = ProductId;
     quote.TimeCreated   = DateTime.Now;
     quote.ContactPerson = txtContact.Text.Trim();
     quote.Email         = txtEmail.Text.Trim();
     quote.Phone         = txtPhone.Text.Trim();
     quote.Address       = txtAddress.Text.Trim();
     quote.ZipCode       = txtZipCode.Text.Trim();
     quote.Notes         = txtNotes.Text.Trim();
 }
Esempio n. 5
0
        public QuoteInfoDto CreateQuote(QuoteInfoDto dto)
        {
            ProductSystem   productSystem = new ProductSystem(UnitOfWork);
            ProductInfoData productData   = productSystem.RetrieveProductInfo(dto.ProductId);

            // TODO: fill some fields
            dto.ProductName = productData.Name;
            dto.Amount      = productData.UnitPrice * 1;

            return(dto);
        }
Esempio n. 6
0
        private void CreateQuote()
        {
            QuoteInfoDto quote = new QuoteInfoDto();

            CollectQuoteInfo(quote);

            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                QuoteFacade facade = new QuoteFacade(uow);
                CurrentInstance = facade.CreateQuote(quote);
            }
        }
Esempio n. 7
0
        public QuoteInfoDto CreateQuote(object productId)
        {
            ArgumentValidator.IsNotNull("productId", productId);

            QuoteInfoDto    dto           = new QuoteInfoDto();
            ProductSystem   productSystem = new ProductSystem(UnitOfWork);
            ProductInfoData productData   = productSystem.RetrieveProductInfo(productId);

            dto.ProductId   = productId;
            dto.ProductName = productData.Name;
            dto.Amount      = productData.UnitPrice * 1;

            return(dto);
        }
Esempio n. 8
0
 private void TransferQuoteData(QuoteInfoDto dto, Quote instance)
 {
     instance.ProductId     = dto.ProductId;
     instance.Email         = dto.Email;
     instance.ContactPerson = dto.ContactPerson;
     instance.Phone         = dto.Phone;
     instance.Address       = dto.Address;
     instance.ZipCode       = dto.ZipCode;
     instance.City          = dto.City;
     instance.Country       = dto.Country;
     instance.TimeCreated   = dto.TimeCreated;
     instance.ContactId     = dto.ContactId;
     instance.Amount        = dto.Amount;
     instance.CurrencyId    = dto.CurrencyId;
     instance.Notes         = dto.Notes;
 }
Esempio n. 9
0
        public FacadeUpdateResult <QuoteData> SaveNewQuote(QuoteInfoDto dto)
        {
            UnitOfWork.BeginTransaction();
            FacadeUpdateResult <QuoteData> result = QuoteSystem.SaveNewQuote(dto);

            if (result.IsSuccessful)
            {
                UnitOfWork.CommitTransaction();
            }
            else
            {
                UnitOfWork.RollbackTransaction();
            }

            return(result);
        }
Esempio n. 10
0
        internal FacadeUpdateResult <QuoteData> SaveNewQuote(QuoteInfoDto dto)
        {
            ArgumentValidator.IsNotNull("dto", dto);

            FacadeUpdateResult <QuoteData> result = new FacadeUpdateResult <QuoteData>();
            IQuoteService service  = UnitOfWork.GetService <IQuoteService>();
            Quote         instance = service.CreateNew <Quote>();

            if (result.IsSuccessful)
            {
                TransferQuoteData(dto, instance);

                var saveQuery = service.Save(instance);

                result.AttachResult(instance.RetrieveData <QuoteData>());
                result.Merge(saveQuery);
            }

            return(result);
        }
 public ActionResult QuoteConfirm(QuoteInfoDto quote)
 {
     return(PartialView(quote));
 }
Esempio n. 12
0
 public QuoteCreationNotificationBuilder(QuoteInfoDto quote, NotificationTemplateData template)
 {
     Quote    = quote;
     Template = template;
 }
Esempio n. 13
0
 public void LoadData(QuoteInfoDto quote)
 {
     Quote = quote;
     LoadData();
 }