private CatalogBaseModel FillCatalogShelfReadyInformation(CatalogBaseModel catSubOptShelfValBModel, CatalogSubjectOption catSubjOpt, List <CustomerCatalogInformation> lstCustCatInfo, int custAutoID) { catSubOptShelfValBModel.ID = catSubjOpt.CatalogSubjectoptionShelfReadies.FirstOrDefault().CSOShelfReadyID; catSubOptShelfValBModel.Text = "1"; catSubOptShelfValBModel.CatalogType = "S"; catSubOptShelfValBModel.IsSelected = catSubjOpt.CatalogSubjectOptionValues.FirstOrDefault() != null?catSubjOpt.CatalogSubjectOptionValues.FirstOrDefault().CustomerCatalogInformations.Where(e => e.CustAutoID == custAutoID).Count() > 0 ? catSubjOpt.CatalogSubjectOptionValues.FirstOrDefault().CustomerCatalogInformations.Where(e => e.CustAutoID == custAutoID).FirstOrDefault().CustomerCatalogShelfReadyInformations.Where(e => e.Status == true).Count() > 0 ? true : false : false : false; catSubOptShelfValBModel.Type = (int)catSubjOpt.ColumnType; catSubOptShelfValBModel.Value = (catSubjOpt.CatalogSubjectoptionShelfReadies.FirstOrDefault().ShelfReadyCount *Convert.ToDouble(catSubjOpt.CatalogSubjectoptionShelfReadies.FirstOrDefault().CatalogSubjectOptionShelfReadyValues.FirstOrDefault().CSOShelfReadyValue)).ToString(); return(catSubOptShelfValBModel); }
private CatalogBaseModel FillCatalogSubjectOptionValueBaseModel(CatalogBaseModel catSubOptValBModel, CatalogSubjectOption catSubjOpt, List <CustomerCatalogInformation> lstCustCatInfo, int custUserID) { if (catSubjOpt.ColumnType == (int)CatalogColumnTypeEnum.ComboBox || catSubjOpt.ColumnType == (int)CatalogColumnTypeEnum.CheckBox) { catSubOptValBModel.comboBase = new List <ComboBase>(); if (catSubjOpt.ColumnType == (int)CatalogColumnTypeEnum.ComboBox) { catSubOptValBModel.comboBase.Insert(0, new ComboBase { ItemValue = "--Select--", ItemID = "0" }); } } string strComments = string.Empty; List <CatalogSubjectOptionValue> lstCatalogSubOptValues = catSubjOpt.CatalogSubjectOptionValues.OrderBy(e => e.Priority).ToList(); if (catSubjOpt.CatalogSubjectOptionValues.Where(e => e.CatalogSubjectOptionID == 33).FirstOrDefault() != null) { lstCatalogSubOptValues = FillVersionValues(lstCustCatInfo, catSubjOpt); } if (lstCatalogSubOptValues != null && lstCatalogSubOptValues.Count() > 0) { foreach (CatalogSubjectOptionValue catSubjOptVal in lstCatalogSubOptValues) { catSubOptValBModel.ID = catSubjOpt.CatalogSubjectOptionID; catSubOptValBModel.Type = (int)catSubjOpt.ColumnType; if (catSubjOpt.ColumnType == (int)CatalogColumnTypeEnum.ComboBox || catSubjOpt.ColumnType == (int)CatalogColumnTypeEnum.CheckBox) { ComboBase objCombo = new ComboBase(); objCombo.ItemID = catSubjOptVal.CatalogSubjectOptionValueID.ToString(); objCombo.ItemValue = catSubjOptVal.CatalogSubjectOptionValue1; objCombo.Selected = lstCustCatInfo.Where(e => e.CatalogSubjectOptionValueID == catSubjOptVal.CatalogSubjectOptionValueID && e.Status != false).FirstOrDefault() != null ? true : false; catSubOptValBModel.comboBase.Add(objCombo); } strComments = lstCustCatInfo.Where(e => e.CatalogSubjectOptionValue.CatalogSubjectOptionValueID == catSubjOptVal.CatalogSubjectOptionValueID && e.Status != false).FirstOrDefault() != null?lstCustCatInfo.Where(e => e.CatalogSubjectOptionValue.CatalogSubjectOptionValueID == catSubjOptVal.CatalogSubjectOptionValueID && e.Status != false).FirstOrDefault().Comments : strComments; catSubOptValBModel.Value = strComments; if (catSubjOpt.CatalogSubjectID == 16) { catSubOptValBModel.Type = catSubjOpt.ColumnType == (int)CatalogColumnTypeEnum.CheckBox ? (int)CatalogColumnTypeEnum.Label : (int)catSubjOpt.ColumnType; if (catSubjOpt.ColumnType == (int)CatalogColumnTypeEnum.CheckBox) { catSubOptValBModel.Value = catSubjOptVal.CatalogSubjectOptionValue1; } } } } else { catSubOptValBModel.ID = catSubjOpt.CatalogSubjectOptionID; catSubOptValBModel.Type = (int)catSubjOpt.ColumnType; } return(catSubOptValBModel); }
private CatalogBaseModel FillCatalogProtectorInformation(CatalogBaseModel catSubOptProtectorValBModel, CatalogSubjectOption catSubjOpt, List <CustomerCatalogInformation> lstCustCatInfo, int custAutoID) { catSubOptProtectorValBModel.ID = catSubjOpt.CatalogSubjectOptionProtectors.FirstOrDefault().CSOProtectorID; catSubOptProtectorValBModel.Text = catSubjOpt.CatalogSubjectOptionProtectors.FirstOrDefault().ProtectorCount.ToString(); catSubOptProtectorValBModel.CatalogType = "P"; catSubOptProtectorValBModel.Type = (int)catSubjOpt.ColumnType; catSubOptProtectorValBModel.IsSelected = catSubjOpt.CatalogSubjectOptionValues.FirstOrDefault() != null?catSubjOpt.CatalogSubjectOptionValues.FirstOrDefault().CustomerCatalogInformations.Where(e => e.CustAutoID == custAutoID).Count() > 0 ? catSubjOpt.CatalogSubjectOptionValues.FirstOrDefault().CustomerCatalogInformations.Where(e => e.CustAutoID == custAutoID).FirstOrDefault().CustomerCatalogProtectorInformations.Where(e => e.Status == true).Count() > 0 ? true : false : false : false; catSubOptProtectorValBModel.Value = catSubjOpt.CatalogSubjectOptionProtectors.FirstOrDefault().CatalogSubjectOptionProtectorValues.FirstOrDefault().CSOProtectorValue; return(catSubOptProtectorValBModel); }
private Dictionary <string, Dictionary <string, Dictionary <CatalogBaseModel, List <CatalogBaseModel> > > > FillCatalogOptionsInfo(int custAutoID) { Dictionary <string, Dictionary <string, Dictionary <CatalogBaseModel, List <CatalogBaseModel> > > > catalogInfo = new Dictionary <string, Dictionary <string, Dictionary <CatalogBaseModel, List <CatalogBaseModel> > > >();; Dictionary <CatalogBaseModel, List <CatalogBaseModel> > catalogSubOptionsModel = null; List <CustomerCatalogInformation> lstCustCatInfo = _Context.CustomerCatalogInformation.GetAll(e => e.CustAutoID == custAutoID).ToList(); List <CatalogInformation> lstCataloginfoObj = _Context.CatalogInformation.GetAll().OrderBy(e => e.Priority).ToList(); foreach (CatalogInformation CataloginfoObj in lstCataloginfoObj) { Dictionary <string, Dictionary <CatalogBaseModel, List <CatalogBaseModel> > > catalogOptionsModel = new Dictionary <string, Dictionary <CatalogBaseModel, List <CatalogBaseModel> > >(); foreach (CatalogSubject catSubj in CataloginfoObj.CatalogSubjects.Where(e => e.Priority != 0).OrderBy(e => e.Priority)) { catalogSubOptionsModel = new Dictionary <CatalogBaseModel, List <CatalogBaseModel> >(); foreach (CatalogSubjectOption catSubjOpt in catSubj.CatalogSubjectOptions.Where(e => e.Priority != 0).OrderBy(e => e.Priority).ToList()) { int catalogItemSubjectOptionProtectorId = 0, catalogItemSubjectOptionShelfReadyId = 0; int protectorsCheckedCount = 0; CatalogBaseModel catSubOptBModel = new CatalogBaseModel(); List <CatalogBaseModel> lstCatSubOptValBModel = new List <CatalogBaseModel>(); catSubOptBModel.ID = catSubjOpt.CatalogSubjectOptionID; catSubOptBModel.Text = catSubjOpt.CatalogSubjectOption1; catSubOptBModel.Type = (int)catSubjOpt.ColumnType; catSubOptBModel.IsSelected = catSubjOpt.CatalogSubjectID == 16 ? catSubOptBModel.Type == (int)CatalogColumnTypeEnum.CheckBox ? lstCustCatInfo.Where(e => e.CatalogSubjectOptionValueID == catSubjOpt.CatalogSubjectOptionValues.FirstOrDefault().CatalogSubjectOptionValueID).FirstOrDefault() != null && lstCustCatInfo.Where(e => e.CatalogSubjectOptionValueID == catSubjOpt.CatalogSubjectOptionValues.FirstOrDefault().CatalogSubjectOptionValueID).FirstOrDefault().Status != false ? true : false : false : false; CatalogBaseModel catSubOptValBModel = new CatalogBaseModel(); catSubOptValBModel = FillCatalogSubjectOptionValueBaseModel(catSubOptValBModel, catSubjOpt, lstCustCatInfo, custAutoID); lstCatSubOptValBModel.Add(catSubOptValBModel); if (catSubjOpt.CatalogSubjectOptionProtectors != null && catSubjOpt.CatalogSubjectOptionProtectors.Count() > 0) { CatalogBaseModel catSubOptProtectorValBModel = new CatalogBaseModel(); catSubOptProtectorValBModel = FillCatalogProtectorInformation(catSubOptProtectorValBModel, catSubjOpt, lstCustCatInfo, custAutoID); if (catSubOptProtectorValBModel.IsSelected) { catalogItemSubjectOptionProtectorId = catSubOptProtectorValBModel.ID; protectorsCheckedCount = Convert.ToInt32(catSubOptProtectorValBModel.Text); } lstCatSubOptValBModel.Add(catSubOptProtectorValBModel); } if (catSubjOpt.CatalogSubjectoptionShelfReadies != null && catSubjOpt.CatalogSubjectoptionShelfReadies.Count() > 0) { CatalogBaseModel catSubOptShelfValBModel = new CatalogBaseModel(); catSubOptShelfValBModel = FillCatalogShelfReadyInformation(catSubOptShelfValBModel, catSubjOpt, lstCustCatInfo, custAutoID); if (catSubOptShelfValBModel.IsSelected) { catalogItemSubjectOptionShelfReadyId = catSubOptShelfValBModel.ID; } lstCatSubOptValBModel.Add(catSubOptShelfValBModel); } catSubOptBModel.Value = catSubj.CatalogSubjectID == 16 ? catSubOptBModel.IsSelected ? calculatePriceForCatalog(catSubOptBModel.ID, catalogItemSubjectOptionProtectorId, catalogItemSubjectOptionShelfReadyId, protectorsCheckedCount) : string.Format("{0:C}", 0) : string.Empty; catalogSubOptionsModel.Add(catSubOptBModel, lstCatSubOptValBModel); } catalogOptionsModel.Add(catSubj.CatalogSubject1, catalogSubOptionsModel); } catalogInfo.Add(CataloginfoObj.CatalogInfoName, catalogOptionsModel); } return(catalogInfo); }