// // GET: /Navigations/ public ViewResult Index(int storeId = 0, String search = "") { storeId = GetStoreId(storeId); List <Navigation> resultList = new List <Navigation>(); if (storeId != 0) { resultList = NavigationRepository.GetNavigationsByStoreId(storeId, search); } ViewBag.Search = search; return(View(resultList)); }
private List <BaseEntity> SearchEntireStore(string adminsearchkey, int storeId) { var resultList = new List <BaseEntity>(); var contentList = ContentRepository.GetContentsByStoreId(storeId, adminsearchkey, StoreConstants.NewsType); resultList.AddRange(contentList); contentList = ContentRepository.GetContentsByStoreId(storeId, adminsearchkey, StoreConstants.BlogsType); resultList.AddRange(contentList); var productList = ProductRepository.GetProductsByStoreId(storeId, adminsearchkey); resultList.AddRange(productList); var brandList = BrandRepository.GetBrandsByStoreId(storeId, adminsearchkey); resultList.AddRange(brandList); var locationList = LocationRepository.GetLocationsByStoreId(storeId, adminsearchkey); resultList.AddRange(locationList); var emailList = EmailListRepository.GetStoreEmailList(storeId, adminsearchkey); resultList.AddRange(emailList); var contactsList = ContactRepository.GetContactsByStoreId(storeId, adminsearchkey); resultList.AddRange(contactsList); var categoriesList = CategoryRepository.GetCategoriesByStoreId(storeId, StoreConstants.NewsType, adminsearchkey); resultList.AddRange(categoriesList); categoriesList = CategoryRepository.GetCategoriesByStoreId(storeId, StoreConstants.BlogsType, adminsearchkey); resultList.AddRange(categoriesList); var productCategoriesList = ProductCategoryRepository.GetProductCategoriesByStoreId(storeId, StoreConstants.ProductType, adminsearchkey); resultList.AddRange(productCategoriesList); var settingsList = SettingRepository.GetStoreSettingsByType(storeId, "", adminsearchkey); resultList.AddRange(settingsList); var navigationList = NavigationRepository.GetNavigationsByStoreId(storeId, adminsearchkey); resultList.AddRange(navigationList); var activitiesList = ActivityRepository.GetActivitiesByStoreId(storeId, adminsearchkey); resultList.AddRange(activitiesList); return(resultList); }
private void CopyStoreData(int copyStoreId, int newStoreId) { StoreDbContext.Configuration.ProxyCreationEnabled = false; try { var items = NavigationRepository.GetNavigationsByStoreId(copyStoreId, ""); foreach (var item in items) { var s = GeneralHelper.DataContractSerialization(item); s.Id = 0; s.StoreId = newStoreId; NavigationRepository.Add(s); } NavigationRepository.Save(); } catch (Exception ex) { Logger.Error(ex, "CopyStore", newStoreId); } try { var items = LocationRepository.GetLocationsByStoreId(copyStoreId, ""); foreach (var item in items) { var s = GeneralHelper.DataContractSerialization(item); s.Id = 0; s.StoreId = newStoreId; LocationRepository.Add(s); } LocationRepository.Save(); } catch (Exception ex) { Logger.Error(ex, "CopyStore", newStoreId); } try { var items = EmailListRepository.GetStoreEmailList(copyStoreId, ""); foreach (var item in items) { var s = GeneralHelper.DataContractSerialization(item); s.Id = 0; s.StoreId = newStoreId; EmailListRepository.Add(s); } EmailListRepository.Save(); } catch (Exception ex) { Logger.Error(ex, "CopyStore", newStoreId); } try { var items = BrandRepository.GetBrandsByStoreId(copyStoreId, ""); foreach (var item in items) { var s = GeneralHelper.DataContractSerialization(item); s.Id = 0; s.StoreId = newStoreId; BrandRepository.Add(s); } BrandRepository.Save(); } catch (Exception ex) { Logger.Error(ex, "CopyStore", newStoreId); } try { var items = ContactRepository.GetContactsByStoreId(copyStoreId, ""); foreach (var item in items) { var s = GeneralHelper.DataContractSerialization(item); s.Id = 0; s.StoreId = newStoreId; ContactRepository.Add(s); } ContactRepository.Save(); } catch (Exception ex) { Logger.Error(ex, "CopyStore", newStoreId); } int productCategoryId = 0; try { var items = ProductCategoryRepository.GetProductCategoriesByStoreId(copyStoreId); foreach (var productCategory in items) { var s = GeneralHelper.DataContractSerialization(productCategory); s.Id = 0; s.StoreId = newStoreId; ProductCategoryRepository.Add(s); ProductCategoryRepository.Save(); productCategoryId = s.Id; } } catch (Exception ex) { Logger.Error(ex, "ProductCategoryRepository:CopyStore"); } int blogCategoryId = 0; int newsCategoryId = 0; try { var items = CategoryRepository.GetCategoriesByStoreId(copyStoreId, StoreConstants.BlogsType); foreach (var item in items) { var s = GeneralHelper.DataContractSerialization(item); s.Id = 0; s.StoreId = newStoreId; CategoryRepository.Add(s); CategoryRepository.Save(); blogCategoryId = s.Id; } items = CategoryRepository.GetCategoriesByStoreId(copyStoreId, StoreConstants.NewsType); foreach (var item in items) { var s = GeneralHelper.DataContractSerialization(item); s.Id = 0; s.StoreId = newStoreId; CategoryRepository.Add(s); CategoryRepository.Save(); newsCategoryId = s.Id; } } catch (Exception ex) { Logger.Error(ex, "CopyStore", newStoreId); } try { var items = ProductRepository.GetProductsByStoreId(copyStoreId, ""); foreach (var item in items) { var s = GeneralHelper.DataContractSerialization(item); s.Id = 0; s.ProductCategoryId = productCategoryId; s.StoreId = newStoreId; ProductRepository.Add(s); ProductRepository.Save(); } } catch (Exception ex) { Logger.Error(ex, "CopyStore", newStoreId); } try { var items = ContentRepository.GetContentsByStoreId(copyStoreId, "", StoreConstants.BlogsType); foreach (var item in items) { var s = GeneralHelper.DataContractSerialization(item); s.Id = 0; s.StoreId = newStoreId; s.CategoryId = blogCategoryId; ContentRepository.Add(s); ContentRepository.Save(); } items = ContentRepository.GetContentsByStoreId(copyStoreId, "", StoreConstants.NewsType); foreach (var item in items) { var s = GeneralHelper.DataContractSerialization(item); s.Id = 0; s.StoreId = newStoreId; s.CategoryId = newsCategoryId; ContentRepository.Add(s); ContentRepository.Save(); } } catch (Exception ex) { Logger.Error(ex, "CopyStore", newStoreId); } try { var items = LabelRepository.GetLabelsByStoreId(copyStoreId, ""); foreach (var item in items) { var s = GeneralHelper.DataContractSerialization(item); s.Id = 0; s.StoreId = newStoreId; LabelRepository.Add(s); LabelRepository.Save(); } } catch (Exception ex) { Logger.Error(ex, "CopyStore", newStoreId); } try { var items = ActivityRepository.GetActivitiesByStoreId(copyStoreId, ""); foreach (var item in items) { var s = GeneralHelper.DataContractSerialization(item); s.Id = 0; s.StoreId = newStoreId; ActivityRepository.Add(s); ActivityRepository.Save(); } } catch (Exception ex) { Logger.Error(ex, "CopyStore", newStoreId); } }
public ActionResult SearchAutoComplete(String term, String action, String controller, int id = 0) { String searchKey = term; var list = new List <String>(); if (action.Equals("Index", StringComparison.InvariantCultureIgnoreCase) && controller.Equals("PageDesigns", StringComparison.InvariantCultureIgnoreCase)) { int storePageDesignId = id; list = PageDesignRepository.GetPageDesignByStoreId(storePageDesignId, searchKey).Select(r => r.Name).ToList(); return(Json(list, JsonRequestBehavior.AllowGet)); } int storeId = GetStoreId(id); if (action.Equals("Index", StringComparison.InvariantCultureIgnoreCase) && controller.Equals("Products", StringComparison.InvariantCultureIgnoreCase)) { list = ProductRepository.GetProductByTypeAndCategoryId(storeId, StoreConstants.ProductType, 0, searchKey, null).Select(r => r.Name).ToList(); } else if (action.Equals("Index", StringComparison.InvariantCultureIgnoreCase) && controller.Equals("News", StringComparison.InvariantCultureIgnoreCase)) { list = ContentRepository.GetContentsByStoreId(storeId, searchKey, StoreConstants.NewsType).Select(r => r.Name).ToList(); } else if (action.Equals("Index", StringComparison.InvariantCultureIgnoreCase) && controller.Equals("Blogs", StringComparison.InvariantCultureIgnoreCase)) { list = ContentRepository.GetContentsByStoreId(storeId, searchKey, StoreConstants.BlogsType).Select(r => r.Name).ToList(); } else if (action.Equals("Index", StringComparison.InvariantCultureIgnoreCase) && controller.Equals("Navigations", StringComparison.InvariantCultureIgnoreCase)) { list = NavigationRepository.GetNavigationsByStoreId(storeId, searchKey).Select(r => r.Name).ToList(); } else if (action.Equals("Index", StringComparison.InvariantCultureIgnoreCase) && controller.Equals("Stores", StringComparison.InvariantCultureIgnoreCase)) { list = StoreRepository.GetStoresByStoreId(searchKey).Select(r => r.Name).ToList(); } else if (action.Equals("Index", StringComparison.InvariantCultureIgnoreCase) && controller.Equals("Labels", StringComparison.InvariantCultureIgnoreCase)) { list = LabelRepository.GetLabelsByStoreId(storeId, searchKey).Select(r => r.Name).ToList(); } else if (action.Equals("Index", StringComparison.InvariantCultureIgnoreCase) && controller.Equals("EmailLists", StringComparison.InvariantCultureIgnoreCase)) { list = EmailListRepository.GetStoreEmailList(storeId, searchKey).Select(r => r.Email).ToList(); } else if (action.Equals("Index", StringComparison.InvariantCultureIgnoreCase) && controller.Equals("Contacts", StringComparison.InvariantCultureIgnoreCase)) { list = ContactRepository.GetContactsByStoreId(storeId, searchKey).Select(r => r.Name).ToList(); } else if (action.Equals("Index", StringComparison.InvariantCultureIgnoreCase) && controller.Equals("Locations", StringComparison.InvariantCultureIgnoreCase)) { list = LocationRepository.GetLocationsByStoreId(storeId, searchKey).Select(r => r.Address).ToList(); } else if (action.Equals("Index", StringComparison.InvariantCultureIgnoreCase) && controller.Equals("Brands", StringComparison.InvariantCultureIgnoreCase)) { list = BrandRepository.GetBrandsByStoreId(storeId, searchKey).Select(r => r.Name).ToList(); } else if (action.Equals("Index", StringComparison.InvariantCultureIgnoreCase) && controller.Equals("ProductCategories", StringComparison.InvariantCultureIgnoreCase)) { list = ProductCategoryRepository.GetProductCategoriesByStoreId(storeId, StoreConstants.ProductType, searchKey).Select(r => r.Name).ToList(); } else if (action.Equals("Index", StringComparison.InvariantCultureIgnoreCase) && controller.Equals("BlogsCategories", StringComparison.InvariantCultureIgnoreCase)) { list = CategoryRepository.GetCategoriesByStoreId(storeId, StoreConstants.BlogsType, searchKey).Select(r => r.Name).ToList(); } else if (action.Equals("Index", StringComparison.InvariantCultureIgnoreCase) && controller.Equals("NewsCategories", StringComparison.InvariantCultureIgnoreCase)) { list = CategoryRepository.GetCategoriesByStoreId(storeId, StoreConstants.NewsType, searchKey).Select(r => r.Name).ToList(); } else if (action.Equals("Index", StringComparison.InvariantCultureIgnoreCase) && controller.Equals("StoreCategories", StringComparison.InvariantCultureIgnoreCase)) { list = CategoryRepository.GetCategoriesByStoreId(0, StoreConstants.StoreType, searchKey).Select(r => r.Name).ToList(); } else if (action.Equals("DisplayImages", StringComparison.InvariantCultureIgnoreCase) && controller.Equals("FileManager", StringComparison.InvariantCultureIgnoreCase)) { list = FileManagerRepository.GetFilesBySearchKey(storeId, searchKey).Select(r => r.OriginalFilename).ToList(); } else if (action.Equals("Settings", StringComparison.InvariantCultureIgnoreCase) && controller.Equals("Stores", StringComparison.InvariantCultureIgnoreCase)) { list = SettingRepository.GetStoreSettingsByType(storeId, "", searchKey).Select(r => String.Format("{0}", r.SettingKey)).ToList(); } else if (action.Equals("Index", StringComparison.InvariantCultureIgnoreCase) && controller.Equals("StoreLanguages", StringComparison.InvariantCultureIgnoreCase)) { list = StoreLanguageRepository.GetStoreLanguages(storeId, searchKey).Select(r => String.Format("{0}", r.Name)).ToList(); } else if (action.Equals("Index", StringComparison.InvariantCultureIgnoreCase) && controller.Equals("Activities", StringComparison.InvariantCultureIgnoreCase)) { list = ActivityRepository.GetActivitiesByStoreId(storeId, searchKey).Select(r => String.Format("{0}", r.Name)).ToList(); } return(Json(list, JsonRequestBehavior.AllowGet)); }