Пример #1
0
        public string getItemIdByISBN(string ISBN, string QuoteID)
        {
            int quoteid     = Convert.ToInt32(QuoteID);
            int quotetypeID = new QuoteViewService().getQuoteTypeId(quoteid);

            if (quotetypeID == (int)QuoteTypeEnum.Preview)
            {
                string prevStatusenum = Convert.ToString((char)ItemStatusEnum.OnListAndPreViewable);
                string itemid         = _Context.Item.GetSingle(e => e.ISBN == ISBN && e.Status == prevStatusenum) != null?_Context.Item.GetSingle(e => e.ISBN == ISBN && e.Status == prevStatusenum).ItemID : string.Empty;

                return(itemid);
            }
            return(_Context.Item.GetSingle(e => e.ISBN == ISBN).ItemID);
        }
        public CatalogInfoViewModel getCatalogInfoValues(int custAutoID)
        {
            CatalogInfoViewModel catalogInfoVM = new CatalogInfoViewModel();
            QuoteViewService     quoteService  = new QuoteViewService();

            catalogInfoVM.ThisUserID     = custAutoID;
            catalogInfoVM.CatalogOptions = FillCatalogOptionsInfo(catalogInfoVM.ThisUserID);
            catalogInfoVM.ValidationCatalogBasicProfileModel = FillValidationsInfo();
            CustomerCatalogInformation ccInfo = _Context.CustomerCatalogInformation.GetAll(e => e.CustAutoID == custAutoID).OrderByDescending(e => e.UpdatedDate).FirstOrDefault();

            catalogInfoVM.UpdatedDate     = ccInfo != null ? ccInfo.UpdatedDate : (DateTime?)null;
            catalogInfoVM.UpdatedUserName = ccInfo != null ? ccInfo.User != null?ccInfo.User.UserName.ToString() : string.Empty : string.Empty;

            quoteService.UserVM   = UserVM;
            UserVM.CurrentQuoteID = quoteService.getCustomerSCQuoteID();
            catalogInfoVM.UserVM  = UserVM;
            return(catalogInfoVM);
        }
        public ContactViewModel getPenworthyContactDetails(int userID)
        {
            ContactViewModel contactVM   = new ContactViewModel();
            QuoteViewService qvs         = new QuoteViewService();
            RepUser          userProfile = new RepUser();
            User             repuser     = new User();
            string           dir         = ConfigurationManager.AppSettings["ContactusImageDirectory"];

            User crtuserdetails = _Context.User.GetSingle(e => e.UserId == userID);

            if (UserVM != null)
            {
                if (UserVM.CRMModelProperties != null && !UserVM.CRMModelProperties.IsRepLoggedIN)
                {
                    // repuser = _Context.User.GetSingle(e => e.CustAutoID == crtuserdetails.CustAutoID);
                    repuser = crtuserdetails.Customer.CustomerRep.RepUser.User;
                }
                else
                {
                    repuser = _Context.User.GetSingle(e => e.UserId == userID);
                }
            }
            else
            {
                repuser = _Context.User.GetSingle(e => e.UserId == userID);
            }
            //int repID = repuser.RepID == null ? repuser.Customer.CustomerRep.RepID :(int) repuser.RepID;
            //int repUserId = _Context.User.GetSingle(e => e.RepID == repID).UserId;
            //userProfile = _Context.RepUser.GetSingle(e => e.RepID == UserVM.CRMModelProperties.RepID);
            if (repuser != null)
            {
                contactVM.RepName              = repuser.FirstName + " " + repuser.LastName;
                contactVM.RepEmail             = repuser.Email;
                contactVM.PhoneCustomerService = repuser.RepUsers.FirstOrDefault().PhoneCustomerService;
                contactVM.PhoneDirect          = repuser.RepUsers.FirstOrDefault().PhoneDirect;
                contactVM.AboutRep             = repuser.RepUsers.FirstOrDefault().Biodata;
                contactVM.RepImage             = dir + repuser.RepUsers.FirstOrDefault().RepID + ".jpg";
                contactVM.Title = repuser.RepUsers.FirstOrDefault().Title;
            }
            contactVM.UserVM = UserVM;
            qvs.UserVM       = UserVM;
            contactVM.UserVM.CurrentQuoteID = qvs.getCustomerSCQuoteID();
            return(contactVM);
        }
Пример #4
0
        public LibrarianResourcesViewModel GetLibraryResource()
        {
            LibrarianResourcesViewModel LRVM = new LibrarianResourcesViewModel();
            QuoteViewService            qvs  = new QuoteViewService();

            LRVM.DictlibraryResource = new Dictionary <string, Dictionary <string, string> >();
            string dir = ConfigurationManager.AppSettings["CommonRepository"] + ConfigurationManager.AppSettings["LibraryResourseRootDirectory"];

            DirSearch(dir, LRVM);
            //foreach(string folderName in LRVM.DictlibraryResource.Keys)
            //{
            //    string path = LRVM.DictlibraryResource[folderName].Keys.Select(e => LRVM.DictlibraryResource[folderName][e] == "MainImage" ? e : string.Empty).FirstOrDefault();
            //}
            LRVM.UserVM = UserVM;
            qvs.UserVM  = UserVM;
            if (UserVM != null)
            {
                LRVM.UserVM.CurrentQuoteID = qvs.getCustomerSCQuoteID();
            }
            return(LRVM);
        }
Пример #5
0
        public string GetItemIDsListByIsbn(string ISBN, string QuoteID)
        {
            ItemListViewService  _itemListViewSrv  = new ItemListViewService();
            ItemContainerService _itemContainerSrv = new ItemContainerService();
            string        ItemIDs = string.Empty;
            List <string> lstPreviewableItemIds = _itemContainerSrv.GetPreviewableItemIDs();
            // int? setID = _Context.Item.GetSingle(x => x.ISBN == ISBN).SetID;
            Item item        = _itemListViewSrv.GetActiveItemList().Where(e => e.ISBN == ISBN).FirstOrDefault();
            int  quoteid     = Convert.ToInt32(QuoteID);
            int  quotetypeID = new QuoteViewService().getQuoteTypeId(quoteid);

            if (item != null)
            {
                ItemIDs = item.ItemID;
                int?setID = item.SetID;
                if (quotetypeID == (int)QuoteTypeEnum.Preview)
                {
                    if (!lstPreviewableItemIds.Contains(ItemIDs))
                    {
                        ItemIDs = string.Empty;
                    }
                }
                if (setID != null)
                {
                    ItemIDs = string.Empty;
                    if (quotetypeID == (int)QuoteTypeEnum.Preview)
                    {
                        ItemIDs = string.Join(",", _itemListViewSrv.GetActiveItemList().Where(e => e.SetID == setID && lstPreviewableItemIds.Contains(e.ItemID)).Select(e => Convert.ToString(e.ItemID)).ToList());
                    }
                    else
                    {
                        ItemIDs = string.Join(",", _itemListViewSrv.GetActiveItemList().Where(e => e.SetID == setID).Select(e => Convert.ToString(e.ItemID)).ToList());
                    }
                }
            }

            return(ItemIDs);
        }
Пример #6
0
        public FAQViewModel GetDetails()
        {
            FAQViewModel       FAQVM       = new FAQViewModel();
            QuoteViewService   qvs         = new QuoteViewService();
            List <FAQCategory> faqCategory = _Context.FAQCategory.GetAll().ToList();

            FAQVM.FAQCategories = AutoMapper.Mapper.Map <IList <FAQCategory>, IList <FAQCategoriesViewModel> >(faqCategory).ToList();

            List <FAQ> faqQuestion = _Context.FAQ.GetAll().ToList();

            FAQVM.FAQuestions = AutoMapper.Mapper.Map <IList <FAQ>, IList <FAQuestionsViewModel> >(faqQuestion).ToList();

            List <FAQDetail> faqAnswers = _Context.FAQDetail.GetAll().ToList();

            FAQVM.FAQAnswers = AutoMapper.Mapper.Map <IList <FAQDetail>, IList <FAQDetailsViewModel> >(faqAnswers).ToList();
            FAQVM.UserVM     = UserVM;
            qvs.UserVM       = UserVM;
            if (UserVM != null)
            {
                FAQVM.UserVM.CurrentQuoteID = qvs.getCustomerSCQuoteID();
            }
            return(FAQVM);
        }
Пример #7
0
        public ItemDetailedViewModel GetItemByID(string itemID, string Quoteid, string type = "")
        {
            ItemDetailedViewModel kplVM = new ItemDetailedViewModel();

            kplVM.LstItemParentVM = new List <ItemParentViewModel>();

            int  quoteid = UserVM != null ? UserVM.CurrentQuoteID : Convert.ToInt32(Quoteid);
            Item item    = _Context.Item.GetSingle(e => e.ItemID == itemID);

            ItemListViewService itemListViewSrv = new ItemListViewService();

            int?seriesID      = item.Series;
            int?originalSetID = null;

            originalSetID = item != null ? item.SetID : (int?)null;

            QuoteViewService QuoteViewService = new QuoteViewService();

            Item itVM = null;
            List <QuoteDetail> lstQuoteDetailsType = null;
            List <Item>        itemList            = new List <Item>();
            Item setItemInfo = null;


            if (originalSetID != null)
            {
                string setID = Convert.ToString(originalSetID);
                setItemInfo = _Context.Item.GetSingle(e => e.ItemID == setID);
                itemList    = itemListViewSrv.GetActiveItemList().Where(e => e.SetID == originalSetID).ToList();
            }

            itemList = itemListViewSrv.SortingAlgorithim(itemList);
            itemList.Remove(item);
            itemList.Insert(0, item);
            kplVM.LstItemParentVM.Add(new ItemParentViewModel());
            kplVM.LstItemParentVM.Add(new ItemParentViewModel());
            Quote  currentQuote  = new Quote();
            string quotetypetext = "";
            Quote  scQuote       = GetQuoteByLoggedIn(quoteid, type);

            if (quoteid != 0)
            {
                currentQuote = _Context.Quote.GetSingle(e => e.QuoteID == quoteid); //GetQuoteByLoggedIn(quoteid, type);

                lstQuoteDetailsType = scQuote.QuoteDetails.ToList();
                quotetypetext       = currentQuote.QuoteType.QuoteTypeText;
            }
            kplVM.QuoteTypeText = quotetypetext;

            ItemContainerService itemContainerService = new ItemContainerService();

            itemContainerService.UserVM = UserVM;
            List <string> lstTitlesBroughtBeforeItemIDs    = itemContainerService.GetTitlesBroughtBeforeItemIDs();
            List <string> lstCharacterBroughtBeforeItemIDs = new List <string>();
            List <string> lstSeriesBroughtBeforeItemIDs    = new List <string>();

            if (UserVM != null && UserVM.CRMModelProperties != null)
            {
                lstSeriesBroughtBeforeItemIDs    = itemContainerService.GetListSeriesCharacterbyCustomerID(UserVM.CRMModelProperties.CustAutoID, "SE");
                lstCharacterBroughtBeforeItemIDs = itemContainerService.GetListSeriesCharacterbyCustomerID(UserVM.CRMModelProperties.CustAutoID, "PC");
            }

            kplVM.LstItemParentVM[0].ListItemVM = itemList.Select(e => new ItemViewModel
            {
                ItemID                 = e.ItemID,
                Title                  = e.Title,
                IPrice                 = (double)e.Price,
                ISBN                   = e.ISBN,
                Description            = e.Description,
                Lexile                 = e.Lexile,
                ARLevel                = e.ARLevel,
                Author                 = e.Author != null ? e.Author.AuthorName : string.Empty,
                IsInCustomerTitles     = lstTitlesBroughtBeforeItemIDs.Contains(e.ItemID) ? true : false,
                SeriesBroughtBefore    = lstSeriesBroughtBeforeItemIDs.Contains(e.ItemID) ? true : false,
                CharecterBroughtBefore = lstCharacterBroughtBeforeItemIDs.Contains(e.ItemID) ? true : false,
                //ProductLine =e.ProductLine
            }).ToList();
            if (quoteid != 0)
            {
                kplVM.LstItemParentVM[0].ListItemVM = UpdateIsScDWQuoteStatus(currentQuote.QuoteTypeID, lstQuoteDetailsType,
                                                                              kplVM.LstItemParentVM[0].ListItemVM);
                kplVM.LstItemParentVM[0].ListItemVM.ToList().ForEach(e => e.QuoteTypeText = quotetypetext);
                kplVM.LstItemParentVM[0].ListItemVM.ToList().ForEach(e => e.QuoteFlag     = type);
                if (currentQuote.QuoteTypeID == (int)QuoteTypeEnum.Preview)
                {
                    List <string> lstPreviewableItemIds = itemContainerService.GetPreviewableItemIDs();
                    kplVM.LstItemParentVM[0].ListItemVM.Where(e => lstPreviewableItemIds.Contains(e.ItemID)).ToList().ForEach(e => e.IsPreviewItem = true);
                }
            }
            if (kplVM.LstItemParentVM[0].ListItemVM.Count > 0)
            {
                kplVM.LstItemParentVM[0].ListItemVM.Where(e => e.ItemID == itemID).FirstOrDefault().IsSelected = true;
            }

            kplVM.SetItemsTotalPrice = Convert.ToDouble(kplVM.LstItemParentVM[0].ListItemVM.Sum(e => e.IPrice));
            itVM = item;
            string strempty = string.Empty;

            kplVM.Binding          = "Penworthy " + itVM.Type == null ? strempty : itVM.Type + " Book";
            kplVM.InterestGrade    = itVM.InterestGrade == null ? strempty : itVM.InterestGrade == ((int)InterestGradeEnums.Grade2to3).ToString() ? QuoteValidationConstants.Grade2to3 : itVM.InterestGrade == ((int)InterestGradeEnums.Grade4Above).ToString() ? QuoteValidationConstants.Grade4Above : itVM.InterestGrade == QuoteValidationConstants.Preschooltograde1Text ? QuoteValidationConstants.Preschooltograde1 : string.Empty;
            kplVM.ItemID           = itVM.ItemID;
            kplVM.ISBN             = itVM.ISBN == null ? string.Empty : itVM.ISBN;
            kplVM.ReviewSource     = (itVM.SLJ == "Y" ? QuoteValidationConstants.SLJ + "," : string.Empty) + (itVM.PW == "Y" ? QuoteValidationConstants.PW + "," : string.Empty) + (itVM.Horn == "Y" ? QuoteValidationConstants.HORN + "," : string.Empty) + (itVM.Kirkus == "Y" ? QuoteValidationConstants.KIRKUS + "," : string.Empty) + (itVM.LJ == "Y" ? QuoteValidationConstants.LJ : string.Empty);
            kplVM.Subject          = itVM.Subject == null ? strempty : itVM.Subject;
            kplVM.Primarycharacter = itVM.SeriesAndCharacter == null ? strempty : itVM.SeriesAndCharacter.SCText;
            kplVM.SecondCharacter  = itVM.SecondaryCharacter == null ? strempty : itVM.SecondaryCharacter;
            kplVM.Format           = itVM.Format == null ? strempty : itVM.Format;
            kplVM.Series           = itVM.SeriesAndCharacter1 == null ? strempty : itVM.SeriesAndCharacter1.SCText;
            //kplVM.Quantity = itVM.QuoteDetails.FirstOrDefault().Quantity == null ? 1 : itVM.QuoteDetails.FirstOrDefault().Quantity;
            QuoteDetail quote = lstQuoteDetailsType != null?lstQuoteDetailsType.Where(e => e.ItemID == itVM.ItemID).FirstOrDefault() : null;

            if (quote != null)
            {
                kplVM.Quantity = quote.Quantity;
            }
            else
            {
                kplVM.Quantity = 1;
            }
            kplVM.Size           = itVM.Size == null ? strempty : itVM.Size;
            kplVM.Fiction        = ClassificationEnums.Fiction.ToString();
            kplVM.Dewey          = itVM.Dewery == null ? strempty : itVM.Dewery;
            kplVM.ARLevel        = itVM.ARLevel == null ? strempty : itVM.ARLevel;
            kplVM.ARQuiz         = itVM.ARQuiz;
            kplVM.Barcode        = itVM.Barcode == null ? strempty : itVM.Barcode;
            kplVM.Classification = itVM.Classification == null ? strempty : itVM.Classification;
            kplVM.CopyRight      = itVM.Copyright == null ? 0 : Convert.ToInt32(itVM.Copyright);
            kplVM.Description    = itVM.Description == null ? strempty : itVM.Description;
            kplVM.Illustrator    = itVM.Illustrator == null ? strempty : itVM.Illustrator;
            kplVM.ISBN           = itVM.ISBN == null ? strempty : itVM.ISBN;
            kplVM.Lexile         = itVM.Lexile == null ? strempty : itVM.Lexile;
            kplVM.OnListDate     = itVM.OnListDate == null ? strempty : string.Format("{0:d}", itVM.OnListDate);
            kplVM.Pages          = itVM.Pages;
            kplVM.Price          = itVM.Price;
            kplVM.RCLevel        = itVM.RCLevel == null ? strempty : itVM.RCLevel;
            kplVM.RCQuiz         = itVM.RCQuiz;
            kplVM.Title          = itVM.Title == null ? string.Empty : itVM.Title;
            kplVM.SetTitle       = setItemInfo != null ? setItemInfo.Title == null ? string.Empty : setItemInfo.Title : string.Empty;
            kplVM.SetDescription = setItemInfo != null ? setItemInfo.Description == null ? string.Empty : setItemInfo.Description : string.Empty;
            kplVM.Type           = itVM.ProductLine == null ? string.Empty : itVM.ProductLine.Trim().ToString();
            kplVM.Publisher      = itVM.PublisherID == null ? strempty : _Context.Publisher.GetSingle(e => e.PublisherID == itVM.PublisherID).PublisherName;
            kplVM.Author         = itVM.AuthorID == null ? strempty : _Context.Author.GetSingle(e => e.AuthorID == itVM.AuthorID).AuthorName;
            kplVM.ProductLine    = itVM.ProductLine == "" ? strempty : itVM.ProductLine;
            kplVM.QuoteFlag      = type;

            QuoteDetail quoteDetails = null;

            quoteDetails = _Context.QuoteDetail.GetSingle(e => e.QuoteID == quoteid && e.ItemID == itemID);
            if (quoteid != 0 && originalSetID != null)
            {
                kplVM.QuoteID     = Convert.ToInt32(quoteid);
                kplVM.QuoteTypeID = (Int32)_Context.Quote.GetSingle(e => e.QuoteID == quoteid).QuoteTypeID;

                if (quoteDetails != null && lstQuoteDetailsType != null)
                {
                    kplVM.IsInSCDWQuote     = kplVM.LstItemParentVM[0].ListItemVM.Where(e => e.ItemID == itemID).FirstOrDefault().IsInSCDWQuote;
                    kplVM.DWSelectionStatus = _Context.QuoteDetail.GetSingle(e => e.QuoteID == quoteid && e.ItemID == itemID) != null?_Context.QuoteDetail.GetSingle(e => e.QuoteID == quoteid && e.ItemID == itemID).DWSelectionID.ToString() : "";
                }
                else
                {
                    kplVM.IsInSCDWQuote     = kplVM.LstItemParentVM[0].ListItemVM.Where(e => e.ItemID == itemID).FirstOrDefault().IsInSCDWQuote;
                    kplVM.DWSelectionStatus = kplVM.IsInSCDWQuote ? "1" : "5";
                }
            }

            if (Quoteid != "0" && originalSetID == null)
            {
                // QuoteDetail quoteDetails = quoteDetails// _Context.QuoteDetail.GetSingle(e => e.QuoteID == quoteid && e.ItemID == itemID);
                if (quoteDetails != null)
                {
                    kplVM.IsInSCDWQuote     = kplVM.LstItemParentVM[0].ListItemVM.Where(e => e.ItemID == itemID).FirstOrDefault().IsInSCDWQuote;
                    kplVM.DWSelectionStatus = Convert.ToString(quoteDetails.DWSelectionID);
                }
            }

            kplVM.UserVM = UserVM;
            return(kplVM);
        }