Beispiel #1
0
        public JsonResult insertItem(string itemID, string quoteID, int quantity)
        {
            _itemservice.UserVM = UserVM;
            bool itemidstatus = true;
            bool itemExist    = false;
            ItemContainerService _itemContainerSrv = new ItemContainerService();

            if (_iItemListViewService.CheckItemInMas(itemID))
            {
                itemExist = true;
                List <string> lstPreviewableItemIds = _itemContainerSrv.GetPreviewableItemIDs();

                QuoteViewService _QuoteViewService = new QuoteViewService();
                int quotetypeID = _QuoteViewService.getQuoteTypeId(Convert.ToInt32(quoteID));

                if (quotetypeID == (int)QuoteTypeEnum.Preview)
                {
                    itemidstatus = lstPreviewableItemIds.Contains(itemID);
                }

                if (itemidstatus)
                {
                    _itemservice.selectedOptions(itemID, quoteID, WebSecurity.CurrentUserId, "", quantity);
                    this.AssignUserVM(_itemservice.UserVM);
                }
            }
            ActiveQuoteService aqs = new ActiveQuoteService();
            RapidEntryModel    rem = aqs.getRapidEntry(Convert.ToInt32(quoteID));

            rem.ItemStatus = itemidstatus;
            rem.ItemExist  = itemExist;
            return(Json(rem));
        }
Beispiel #2
0
        private void GenerateFlatFiles()
        {
            try
            {
                EmailService           mailService          = new EmailService();
                ActiveQuoteService     _activeQuote         = new ActiveQuoteService();
                List <CalTagViewModel> lstCalTagViewModel   = _activeQuote.GetQuoteByCTStatus();
                FileCreationService    _fileCreation        = new FileCreationService();
                List <string>          lstFilePathWithNames = new List <string>();

                if (lstCalTagViewModel.Count > 0)
                {
                    string filePath = _fileCreation.GenerateCTFlatFiles(lstCalTagViewModel);
                    if (!string.IsNullOrEmpty(filePath))
                    {
                        lstFilePathWithNames.Add(filePath);
                    }
                }
                if (lstFilePathWithNames.Count > 0)
                {
                    _activeQuote.ChangeCTStatus();
                    mailService.SendMail("CallTagInfo", "Please find the attached CallTag files", false, true, lstFilePathWithNames, null, ConfigurationManager.AppSettings["fromAddress"], ConfigurationManager.AppSettings["WareHouseEmail"]);
                }
            }
            catch (Exception ex)
            {
                Elmah.SqlErrorLog ErrorLog = new Elmah.SqlErrorLog(conn);
                ErrorLog.Log(new Elmah.Error(new Exception(ex.ToString())));
            }
        }
Beispiel #3
0
        public JsonResult rapidEntryItemByISBN(string ISBN, string QuoteID, int quantity)
        {
            string lstItemIds   = _itemservice.GetItemIDsListByIsbn(ISBN, QuoteID);
            bool   itemidstatus = false;

            _itemservice.UserVM = UserVM;
            if (lstItemIds != null && lstItemIds != string.Empty)
            {
                itemidstatus = true;
                _itemservice.selectedOptions(lstItemIds, QuoteID, WebSecurity.CurrentUserId, "", quantity);
            }
            ActiveQuoteService aqs = new ActiveQuoteService();
            RapidEntryModel    rem = aqs.getRapidEntry(Convert.ToInt32(QuoteID));

            rem.ItemStatus = itemidstatus;
            return(Json(rem));
        }
Beispiel #4
0
        public ActionResult ViewListOfItems()
        {
            int  quoteID    = Convert.ToInt32(Request.QueryString["quoteDWID"]);
            bool isPdf      = Convert.ToBoolean(Request.QueryString["isPdf"]);
            bool invoicePdf = Convert.ToBoolean(Request.QueryString["invoicePdf"]);
            bool isExcel    = Convert.ToBoolean(Request.QueryString["isExcel"]);

            if (isPdf || isExcel)
            {
                ActiveQuoteService _activeQuoteSrv = new ActiveQuoteService();
                _activeQuoteSrv.UserVM = UserVM != null ? UserVM : null;
                OrderViewModel orderVM = _activeQuoteSrv.GeneratePDF(quoteID);
                orderVM.InvoiceModel.FederalID = ConfigurationManager.AppSettings["FederalID"];
                var pdf = new RazorPDF.PdfResult(orderVM, "../TCPViews/GeneratePDF");
                if (isExcel)
                {
                    StringBuilder sb         = new StringBuilder();
                    string        headerText = string.Format(Resources.TCPResources.QuoteEmailExcelHeaderTable, ConfigurationManager.AppSettings["imgLogoPath"], string.Format("{0:d}", DateTime.Today), orderVM.QuoteID, orderVM.CustNumber, orderVM.RepoAddress.RepName, orderVM.CustomerName, orderVM.RepoAddress.RepEmail, orderVM.RepoAddress.CustFirstName + ' ' + orderVM.RepoAddress.CustLastName);
                    sb.Append(headerText);
                    sb.Append(ConvertToString(orderVM.CartListView));
                    double totalPrice = orderVM.CartListView.Sum(e => e.Price);
                    double taxPrice   = 0;
                    if (orderVM.SalesTax > 0)
                    {
                        taxPrice = (totalPrice * (double)orderVM.SalesTax);
                    }
                    string footerText = string.Format(Resources.TCPResources.QuoteEmailExcelFooterTable, String.Format("{0:C}", taxPrice + totalPrice), String.Format("{0:C}", orderVM.ShippingCharge), String.Format("{0:C}", taxPrice + totalPrice));
                    sb.Append(footerText);
                    byte[] buffer = System.Text.Encoding.UTF8.GetBytes(sb.ToString());
                    Response.AddHeader("Content-Disposition", "attachment; filename=" + orderVM.CustNumber + "_" + orderVM.QuoteID + ".xls");
                    Response.ContentType = "application//vnd.ms-excel";
                    Response.Buffer      = true;
                    Response.Cache.SetCacheability(HttpCacheability.NoCache);
                    Response.BinaryWrite(buffer);
                    Response.End();
                    Response.Close();
                }
                else if (isPdf)
                {
                    orderVM.Type = "Export";

                    //added by faraaz
                    if (invoicePdf)
                    {
                        orderVM.Type = "invoicePdf";
                    }

                    Response.ContentType = "application/pdf";
                    if (invoicePdf)
                    {
                        Response.AddHeader("Content-Disposition", "inline;" + orderVM.CustNumber + "_" + orderVM.QuoteID + ".pdf");
                    }
                    else
                    {
                        Response.AddHeader("Content-Disposition", "attachment;" + orderVM.CustNumber + "_" + orderVM.QuoteID + ".pdf");
                    }
                }
                pdf.ViewBag.Title = "Report Title";
                return(pdf);
            }
            else
            {
                _iItemListViewService.UserVM = UserVM;
                ItemListViewModel itemVM = _iItemListViewService.GetListOfItems(Convert.ToInt32(Request.QueryString["quoteDWID"]), "", "30", 1, "");
                this.AssignUserVM(_iItemListViewService.UserVM);
                ViewData["QuoteType"]  = itemVM.QuoteType;
                ViewData["QuoteTitle"] = itemVM.QuoteTitle;
                return(View("../TCPViews/ItemListView", itemVM));
            }
        }
 public ActiveQuoteController(ActiveQuoteService activeQuoteSrv)
 {
     _activeQuoteSrv        = activeQuoteSrv;
     _activeQuoteSrv.UserVM = UserVM;
 }
Beispiel #6
0
        private void ScheduleDWEmailReminder(object state)
        {
            try
            {
                SetDWEmailReminderTimer();

                ActiveQuoteService            _activeQuote = new ActiveQuoteService();
                List <EmailTemplateViewModel> lstEmailTEmailTemplateModel = _activeQuote.GetDwTemplateEmail();

                EmailBodyGeneratorService emailService = new EmailBodyGeneratorService();


                foreach (EmailTemplateViewModel item in lstEmailTEmailTemplateModel)
                {
                    int[]      dwRemianderDays    = ConfigurationManager.AppSettings["DwRemainderDays"].Split(',').Select(e => Convert.ToInt32(e)).ToArray(); // Dw Remainder Days
                    List <int> lstDwRemianderDays = ConfigurationManager.AppSettings["DwRemainderDays"].Split(',').Select(e => Convert.ToInt32(e)).ToList();
                    //int days = item.EmailDWTemplateList != null && item.EmailDWTemplateList.Where(e => e.NoOfDays == 0 || e.NoOfDays == 4 || e.NoOfDays == 10 || e.NoOfDays == 19 || e.NoOfDays == 45 || e.NoOfDays == 60).FirstOrDefault() != null ?
                    //       item.EmailDWTemplateList.Where(e => e.NoOfDays == 0 || e.NoOfDays == 4 || e.NoOfDays == 10 || e.NoOfDays == 19 || e.NoOfDays == 45 || e.NoOfDays == 60).OrderBy(e => e.NoOfDays).FirstOrDefault().NoOfDays < 0 ? 0 :
                    //       item.EmailDWTemplateList.Where(e => e.NoOfDays == 0 || e.NoOfDays == 4 || e.NoOfDays == 10 || e.NoOfDays == 19 || e.NoOfDays == 45 || e.NoOfDays == 60).OrderBy(e => e.NoOfDays).FirstOrDefault().NoOfDays :
                    //       item.EmailDWTemplateList.FirstOrDefault().NoOfDays;

                    int days = item.EmailDWTemplateList != null && item.EmailDWTemplateList.Where(e => lstDwRemianderDays.Contains(e.NoOfDays)).FirstOrDefault() != null?
                               item.EmailDWTemplateList.Where(e => lstDwRemianderDays.Contains(e.NoOfDays)).OrderBy(e => e.NoOfDays).FirstOrDefault().NoOfDays < 0 ? 0 :
                               item.EmailDWTemplateList.Where(e => lstDwRemianderDays.Contains(e.NoOfDays)).OrderBy(e => e.NoOfDays).FirstOrDefault().NoOfDays:
                               item.EmailDWTemplateList.FirstOrDefault().NoOfDays;



                    string templateType = item.EmailDWTemplateList.FirstOrDefault().IsActive == true ? "Active" : "Idle";
                    string subject      = ConfigurationManager.AppSettings["EmailSubjectLine"];//"DW reminder-";

                    try
                    {
                        #region DwRemainder
                        bool remainderDayExits = Array.IndexOf(dwRemianderDays, days) > -1 ? true : false;

                        if (remainderDayExits)
                        {
                            string dwEmailType = ConfigurationManager.AppSettings["DwRemainderText"] + " " + days + " WEB";
                            emailService.InitialiseHTMLParser(item, templateType, subject, dwEmailType);
                        }

                        #endregion

                        //switch (days)
                        //{
                        //    //case 0:
                        //    //    emailService.InitialiseHTMLParser(item, "initial", subject + "initial");
                        //    //    break;
                        //    //case 4:
                        //    //    emailService.InitialiseHTMLParser(item, templateType, subject, Resources.DWEmailType.Reminder4);
                        //    //    break;
                        //    //case 10:
                        //    //    emailService.InitialiseHTMLParser(item, templateType, subject, Resources.DWEmailType.Reminder10);
                        //    //    break;
                        //    //case 19:
                        //    //    emailService.InitialiseHTMLParser(item, templateType, subject, Resources.DWEmailType.Reminder19);
                        //    //    break;
                        //    //case 45:
                        //    //    emailService.InitialiseHTMLParser(item, "outstanding", subject, Resources.DWEmailType.Reminder45);
                        //    //    break;
                        //    //case 60:
                        //    //    emailService.InitialiseHTMLParser(item, "outstanding", subject, Resources.DWEmailType.Reminder60);
                        //    //    break;
                        //    default:
                        //        break;
                        //}
                    }
                    catch (Exception ex)
                    {
                        Elmah.SqlErrorLog ErrorLog = new Elmah.SqlErrorLog(conn);
                        ErrorLog.Log(new Elmah.Error(new Exception(ex.ToString())));
                    }
                }
            }
            catch (Exception ex)
            {
                Elmah.SqlErrorLog ErrorLog = new Elmah.SqlErrorLog(conn);
                ErrorLog.Log(new Elmah.Error(new Exception(ex.ToString())));
                SetDWEmailReminderTimer();
            }
        }