Пример #1
0
        public ItemListViewModel AddSeriesByItemID(string itemID, int quoteID, int currentUserId)
        {
            int?seriesid = _Context.Item.GetSingle(e => e.ItemID == itemID).Series;
            ItemListViewService _itemListViewSrv = new ItemListViewService();
            ItemListViewModel   itemListVM       = selectedOptions(string.Join(",", _itemListViewSrv.GetActiveItemList().Where(e => e.Series == seriesid).Select(e => Convert.ToString(e.ItemID)).ToArray()), quoteID.ToString(), currentUserId);

            return(itemListVM);
        }
Пример #2
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);
        }
Пример #3
0
        public ItemDetailedViewModel GetItemByISBN(string ISBN, string QuoteID)
        {
            ItemListViewService _itemListViewSrv = new ItemListViewService();
            Item item = _itemListViewSrv.GetActiveItemList().Where(e => e.ISBN == ISBN).FirstOrDefault();
            ItemDetailedViewModel kplVM = new ItemDetailedViewModel();

            if (item != null)
            {
                if (ISBN != null)
                {
                    string itemID = Convert.ToString(item.ItemID);
                    kplVM = GetItemByID(itemID, QuoteID);
                    return(kplVM);
                }
            }
            return(kplVM);
        }
Пример #4
0
        public List <Item> GetDetails()
        {
            string searchText = UserVM != null ? UserVM.SearchCategory : string.Empty;
            CategoriesItemContainerViewModel cicvm               = new CategoriesItemContainerViewModel();
            ItemContainerService             ics                 = new ItemContainerService();
            List <string>       lstTitlesBroughtBeforeItemIDs    = ics.GetTitlesBroughtBeforeItemIDs();
            List <string>       lstPreviewitemIDs                = ics.GetPreviewableItemIDs();
            List <string>       lstSeriesBroughtBeforeItemIDs    = new List <string>();
            List <string>       lstCharacterBroughtBeforeItemIDs = new List <string>();
            ItemListViewService ilsv = new ItemListViewService();
            string statusenumB       = Convert.ToString((char)ItemStatusEnum.OnListButNotPreViewable);
            string statusenumD       = Convert.ToString((char)ItemStatusEnum.OnListAndPreViewable);

            cicvm.item = ilsv.GetActiveItemList().Where(e => e.Title.ToLower().Contains(searchText.ToLower())).ToList();
            List <int> lstAuthorIDs = _Context.Author.GetAll().Where(e => e.AuthorName.Contains(searchText)).Select(e => e.AuthorID).ToList();

            if (lstAuthorIDs.Count > 0)
            {
                List <Item> lstAuthorItem = _Context.Item.GetAll().Where(e => e.ISBN != null && e.IsInMas == true && (e.Status == statusenumB || e.Status == statusenumD) && (e.AuthorID != null ? lstAuthorIDs.Contains((int)e.AuthorID) : false)).ToList();
                cicvm.item.RemoveAll(e => lstAuthorItem.Contains(e));
                cicvm.item.AddRange(lstAuthorItem);
            }
            List <int> lstSeriesIDs = _Context.SeriesAndCharacter.GetAll().Where(e => e.SCText.ToLower().Contains(searchText.ToLower())).Select(e => e.SCID).ToList();

            if (lstSeriesIDs.Count > 0)
            {
                List <Item> lstSeriesItem = _Context.Item.GetAll().Where(e => e.ISBN != null && e.IsInMas == true && (e.Status == statusenumB || e.Status == statusenumD) && (e.Series != null ? lstSeriesIDs.Contains((int)e.Series) : false || e.PrimeryCharacter != null ? lstSeriesIDs.Contains((int)e.PrimeryCharacter) : false)).ToList();
                cicvm.item.RemoveAll(e => lstSeriesItem.Contains(e));
                cicvm.item.AddRange(lstSeriesItem);
            }
            if (lstSeriesIDs.Count > 0)
            {
                List <Item> lstCharecterItem = _Context.Item.GetAll().Where(e => e.ISBN != null && e.IsInMas == true && (e.Status == statusenumB || e.Status == statusenumD) && (e.PrimeryCharacter != null ? lstSeriesIDs.Contains((int)e.PrimeryCharacter) : false)).ToList();
                cicvm.item.RemoveAll(e => lstCharecterItem.Contains(e));
                cicvm.item.AddRange(lstCharecterItem);
            }
            List <Item> lstItemByids = ilsv.GetActiveItemList().Where(e => e.ItemID.Contains(searchText)).ToList();

            if (lstItemByids.Count > 0)
            {
                cicvm.item.RemoveAll(e => lstItemByids.Contains(e));
                cicvm.item.AddRange(lstItemByids);
            }
            List <string> lstSetids = _Context.Item.GetAll(e => e.SetID == null && e.SetProfile == "Y" && e.IsInMas == true).Where(e => e.Title.ToLower().Contains(searchText.ToLower())).Select(e => e.ItemID).ToList();

            if (lstSetids.Count > 0)
            {
                List <Item> lstsetItems = null;
                foreach (string setid in lstSetids)
                {
                    lstsetItems = ilsv.GetActiveItemList().Where(e => e.SetID == Convert.ToInt32(setid)).ToList();
                    cicvm.item.RemoveAll(e => lstsetItems.Contains(e));
                    cicvm.item.AddRange(lstsetItems);
                }
            }
            cicvm.CategoriesPVM = new CategoriesPartialViewModel();
            cicvm.CategoriesPVM.SelectedTitleText = "Search Results for \"" + searchText + "\"";
            ItemContainerService itemContainerService = new ItemContainerService();

            cicvm.CategoriesPVM.pageDenomination               = itemContainerService.Pagenation("60");
            cicvm.CategoriesPVM.ItemGroupVM                    = new ItemGroupViewModel();
            cicvm.CategoriesPVM.ItemGroupVM.ItemPVM            = new ItemParentViewModel();
            cicvm.CategoriesPVM.ItemGroupVM.ItemPVM.ListItemVM = new List <ItemViewModel>();
            Quote SCQuote = _Context.Quote.GetSingle(e => e.UserID == UserVM.CRMModelProperties.LoggedINCustomerUserID && e.QuoteTypeID == (int)QuoteTypeEnum.ShoppingCart);

            cicvm.item.Distinct().ToList();
            cicvm.UserVM = UserVM;
            return(cicvm.item);
        }
Пример #5
0
        //Method to return selected item details and its sets
        public SingleItemDetailedModel GetSingleItemDetailsWithSets(string itemID, string quoteDWID)
        {
            SingleItemDetailedModel singleItemDetails = new SingleItemDetailedModel();

            singleItemDetails.ItemGroupVm         = new ItemGroupViewModel();
            singleItemDetails.KPLViewModel        = new KPLBasedCommonViewModel();
            singleItemDetails.ItemGroupVm.ItemPVM = new ItemParentViewModel();
            ItemListViewService itemListViewSrv = new ItemListViewService();

            Item item = _Context.Item.GetSingle(e => e.ItemID == itemID);//Getting particular selected item details
            //Getting shoppingcart details

            Quote scQuote = _Context.Quote.GetSingle(e => e.QuoteTypeID == (int)QuoteTypeEnum.ShoppingCart && e.UserID == UserVM.CRMModelProperties.LoggedINCustomerUserID);
            List <QuoteDetail> lstSCQuoteDetails = scQuote.QuoteDetails.ToList();

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

            if (originalSetID != null)
            {
                List <Item> itemList = itemListViewSrv.GetActiveItemList().Where(e => e.SetID == originalSetID).ToList();

                itemList.Remove(item);
                itemList.Insert(0, item);


                singleItemDetails.ItemGroupVm.GroupName      = itemList.FirstOrDefault().SetName;
                singleItemDetails.ItemGroupVm.GroupItemCount = itemList.Count;

                singleItemDetails.ItemGroupVm.ItemPVM.ListItemVM = AutoMapper.Mapper.Map <IList <Item>, IList <ItemViewModel> >(itemList).ToList();

                singleItemDetails.ItemGroupVm.ItemPVM.ListItemVM.Where(e => lstSCQuoteDetails.Any(x => x.ItemID == e.ItemID)).ToList().ForEach(it => it.IsInSCDWQuote = true);

                if (singleItemDetails.ItemGroupVm.ItemPVM.ListItemVM.Count > 0)
                {
                    singleItemDetails.ItemGroupVm.ItemPVM.ListItemVM.Where(e => e.ItemID == itemID).FirstOrDefault().IsSelected = true;
                }
                //binding KPL
                int qDWID = Convert.ToInt32(quoteDWID);
                //  Item ItemDetails = itemList.Where(e => e.ItemID == itemNo).FirstOrDefault();
                singleItemDetails.KPLViewModel.ARLevel          = item.ARLevel == null ? string.Empty : item.ARLevel;
                singleItemDetails.KPLViewModel.ARQuiz           = item.ARQuiz;
                singleItemDetails.KPLViewModel.Barcode          = item.Barcode == null ? string.Empty : item.Barcode;
                singleItemDetails.KPLViewModel.Classification   = item.Classification == null ? string.Empty : item.Classification;
                singleItemDetails.KPLViewModel.CopyRight        = item.Copyright == null ? 0 : Convert.ToInt32(item.Copyright);
                singleItemDetails.KPLViewModel.Description      = item.Description == null ? string.Empty : item.Description;
                singleItemDetails.KPLViewModel.Format           = item.Format == null ? string.Empty : item.Format;
                singleItemDetails.KPLViewModel.Illustrator      = item.Illustrator == null ? string.Empty : item.Illustrator;
                singleItemDetails.KPLViewModel.InterestGrade    = item.InterestGrade == null ? string.Empty : item.InterestGrade;
                singleItemDetails.KPLViewModel.ISBN             = item.ISBN == null ? string.Empty : item.ISBN;
                singleItemDetails.KPLViewModel.ItemID           = item.ItemID;
                singleItemDetails.KPLViewModel.Lexile           = item.Lexile == null ? string.Empty : item.Lexile;
                singleItemDetails.KPLViewModel.OnListDate       = item.OnListDate == null ? string.Empty : string.Format("{0:d}", item.OnListDate);
                singleItemDetails.KPLViewModel.Primarycharacter = item.SeriesAndCharacter == null ? string.Empty : item.SeriesAndCharacter.SCText;
                singleItemDetails.KPLViewModel.SecondCharacter  = item.SecondaryCharacter == null ? string.Empty : item.SecondaryCharacter;
                singleItemDetails.KPLViewModel.Pages            = item.Pages;
                singleItemDetails.KPLViewModel.Price            = item.Price;
                singleItemDetails.KPLViewModel.RCLevel          = item.RCLevel == null ? string.Empty : item.RCLevel;
                singleItemDetails.KPLViewModel.RCQuiz           = item.RCQuiz;
                singleItemDetails.KPLViewModel.ReviewSource     = item.ReviewSource == null ? string.Empty : item.ReviewSource;
                singleItemDetails.KPLViewModel.Series           = item.SeriesAndCharacter1 == null ? string.Empty : item.SeriesAndCharacter1.SCText;
                singleItemDetails.KPLViewModel.Title            = item.Title == null ? string.Empty : item.Title;
                singleItemDetails.KPLViewModel.Type             = item.ProductLine == null ? string.Empty : item.ProductLine.Trim().ToString();
                singleItemDetails.KPLViewModel.Publisher        = item.PublisherID == null ? string.Empty : _Context.Publisher.GetSingle(e => e.PublisherID == item.PublisherID).PublisherName;
                singleItemDetails.KPLViewModel.Author           = item.AuthorID == null ? string.Empty : _Context.Author.GetSingle(e => e.AuthorID == item.AuthorID).AuthorName;
                List <QuoteDetail> lstcurrentQuoteDetails = _Context.QuoteDetail.GetAll(e => e.QuoteID == qDWID).ToList();
                singleItemDetails.noOfNewCount   = _Context.QuoteDetail.GetAll(e => e.DWSelectionID == (int)DecisionWhizardStatusEnum.New && e.QuoteID == qDWID).Count();
                singleItemDetails.noOfYesCount   = _Context.QuoteDetail.GetAll(e => e.DWSelectionID == (int)DecisionWhizardStatusEnum.Yes && e.QuoteID == qDWID).Count();
                singleItemDetails.noOfNoCount    = _Context.QuoteDetail.GetAll(e => e.DWSelectionID == (int)DecisionWhizardStatusEnum.No && e.QuoteID == qDWID).Count();
                singleItemDetails.noOfMaybeCount = _Context.QuoteDetail.GetAll(e => e.DWSelectionID == (int)DecisionWhizardStatusEnum.MayBe && e.QuoteID == qDWID).Count();

                if (string.IsNullOrEmpty(item.QuoteDetails.Where(e => e.QuoteID == qDWID && e.ItemID == item.ItemID).ToString()) || item.QuoteDetails.Count == 0)
                {
                    singleItemDetails.KPLViewModel.DWSelectionStatus = "5";
                }
                else
                {
                    singleItemDetails.KPLViewModel.DWSelectionStatus = item.QuoteDetails.FirstOrDefault().DWSelectionID.ToString();
                }

                singleItemDetails.KPLViewModel.QuoteID = qDWID;
            }

            return(singleItemDetails);
        }
Пример #6
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);
        }