public DefaultMenuController() { //m_serviceLayer = new ServiceLayerImpl(); m_imageService = new ImageServices(); defMenuUtility = new DefaultMenuUtility(); classifyServices = new ClassifierServices(); }
public void MyTestInitialize() { m_Testdb = new MongoDBForTest().DB; m_Testdb.Drop(); m_mocked = new Mock<IServicesLayer>(); m_MocServiceLayer = m_mocked.Object; m_mockedBackOffice = new Mock<IBackofficeService>(); m_MocBackOfficeService = m_mockedBackOffice.Object; m_imageService = new ImageServices(); }
public RestaurantController() { UserProfileFacade profileFacade = new UserProfileFacade(ApplicationName.Plateful); m_serviceLayer = new ServiceLayerImpl(profileFacade); m_imageService = new ImageServices(); }
public void ChainEdit(ChainEdit editProperties) { try { if (editProperties != null && editProperties.QueryString != null) { var restsList = restaurantsSearchUtilty.FindAllRestaurantsByOperator(editProperties.QueryString, editProperties.EmptyMenu); if (restsList != null) { log.InfoFormat("[ChainEdit] editProperties.QueryString={0}, editProperties.EmptyMenu={1}, restsList.Count={2}.", editProperties.QueryString, editProperties.EmptyMenu.ToString(), restsList.Count); RestaurantBasicData patternRest = null; if (editProperties.PatternId != null && !string.IsNullOrEmpty(editProperties.PatternId)) { patternRest = serviceLayer.GetRestaurantBasicById(editProperties.PatternId); } ImageServices m_imageService = new ImageServices(); DefaultMenuUtility defMenuUtil = new DefaultMenuUtility(); foreach (var rest in restsList) { bool updateFlag = false; if (!string.IsNullOrEmpty(editProperties.ChainName)) { rest.Operator = editProperties.ChainName; updateFlag = true; } //update chain logo if (editProperties.LogoUpdate && !string.IsNullOrEmpty(editProperties.Logo)) { m_imageService.UploadImageToRestaurant(rest, editProperties.Logo); } if (editProperties.CuisineUpdate && !string.IsNullOrEmpty(editProperties.Cuisine)) { if (rest.Cuisines == null) rest.Cuisines = new List<string>(); rest.Cuisines.Add(editProperties.Cuisine); updateFlag = true; } if (editProperties.DefaultMenuCopy) { defMenuUtil.AddDefaultMenuToRestaurant(rest); updateFlag = false; } if (patternRest != null) { if (editProperties.MenuCopyFlag && patternRest.Menu != null) { rest.Menu = patternRest.Menu; updateFlag = true; } //Copy image from pattern restuarant if (editProperties.LogoCopyFlag && patternRest.Image != null) { rest.Image = patternRest.Image; updateFlag = true; } } // Save updates in DB if (updateFlag) serviceLayer.UpdateRestaurant(rest); } } } else { log.WarnFormat("[ChainEdit] editProperties is null."); } } catch (Exception e) { log.ErrorFormat("[ChainEdit] Exception={0}.", e.Message); } }
public RestaurantController() { UserProfileFacade profileFacade = new UserProfileFacade(); m_serviceLayer = new ServiceLayerImpl(profileFacade); m_imageService = new ImageServices(); }
public string AddRestaurantToDB(RestaurantModel restaurantmodel) { log.DebugFormat("[AddRestaurantToDB] restaurantmodel={0}.", restaurantmodel.ToString()); using (Restaurants restaurantsDb = new Restaurants()) { MongoEntityRepositoryBase<RestaurantBasicData> basicData = new MongoEntityRepositoryBase<RestaurantBasicData>(restaurantsDb.DB); RestaurantBasicData tempRest = new RestaurantBasicData() { //Id = ObjectId.Parse(restaurantmodel.Id), Name = restaurantmodel.Name, Description = restaurantmodel.Description, LogoUrl = (restaurantmodel.LogoUrl != null) ? restaurantmodel.LogoUrl : "", Menu = restaurantmodel.Menu.ToMenuBasicModel(), Adress = restaurantmodel.Adress, ItemLocation = (restaurantmodel.Location != null) ? restaurantmodel.Location.toLoaction() : null, Phone = restaurantmodel.Phone, CreatedAt = DateTime.UtcNow, UpdatedAt = DateTime.UtcNow }; basicData.Add(tempRest); if (tempRest.LogoUrl != "" && tempRest.Image == null) { ImageServices m_imageService = new ImageServices(); m_imageService.UploadImageToRestaurant(tempRest, tempRest.LogoUrl); } if (m_userProfile.AppName != ApplicationName.BackOffice) { SaveUserActivity(new AddRestaurantActivity() { RestaurantID = tempRest.Id.ToString(), LocationAdd = tempRest.ItemLocation, ActivityLocation = tempRest.ItemLocation }); } return tempRest.Id.ToString(); } }
public string AddRestaurantBasicToDB(RestaurantBasicData restaurant) { log.DebugFormat("[AddRestaurantBasicToDB] restaurant={0}.", restaurant.ToString()); using (Restaurants restaurantsDb = new Restaurants()) { MongoEntityRepositoryBase<RestaurantBasicData> basicData = new MongoEntityRepositoryBase<RestaurantBasicData>(restaurantsDb.DB); restaurant.CreatedAt = DateTime.UtcNow; restaurant.UpdatedAt = DateTime.UtcNow; basicData.Add(restaurant); if (restaurant.LogoUrl != "" && restaurant.Image == null) { ImageServices m_imageService = new ImageServices(); m_imageService.UploadImageToRestaurant(restaurant, restaurant.LogoUrl); } if (m_userProfile.AppName != ApplicationName.BackOffice) { SaveUserActivity(new AddRestaurantActivity() { RestaurantID = restaurant.Id.ToString(), LocationAdd = restaurant.ItemLocation, ActivityLocation = restaurant.ItemLocation }); } return restaurant.Id.ToString(); } }
public MenuController() { m_serviceLayer = new BackOfficeServiceLayerImpl(); m_imageService = new ImageServices(); defaultMenuServices = new DefaultMenuUtility(); }