public MainAnswerHelper(BotUserRequest _thisRequest, object _Bot, SocialNetworkType _type, BotUser _botUser, List <MallBotContext> _dbContextes, List <VKApiRequestModel> _Requests = null) { botUser = _botUser; dbContextes = _dbContextes; Requests = _Requests; Bot = _Bot; type = _type; thisRequest = _thisRequest; #region Кэшируем string CachedItemKey = "MallBotData"; var datafromCache = cacher.Get(CachedItemKey); if (datafromCache == null) { datasOfBot = cacher.Update(CachedItemKey, dbContextes); } else { datasOfBot = (List <CachedDataModel>)datafromCache; } #endregion texter = new BotTextHelper(botUser.Locale, type, datasOfBot[0].Texts); sender = new ApiRouter(type, Bot, botUser, Requests); dataGetter = new GetDataHelper(datasOfBot); if (botUser.NowIs != MallBotWhatIsHappeningNow.SettingCustomer) { char usersdbID = botUser.CustomerCompositeID[0]; var customerID = int.Parse(botUser.CustomerCompositeID.Remove(0, 1)); currentCustomer = dataGetter.GetStructuredCustomers(true).FirstOrDefault(x => x.DBaseID == usersdbID).Customers.FirstOrDefault(x => x.CustomerID == customerID); //дает возможность работы в тц не из тестового режима } }
private int GetFullFloorID() { var findedOrganizations = GetDataHelper.GetOrganizationFromFuzzySearchResult(answer.Result.QueryResults, dataOfBot); int max = 0; int index = 0; for (int i = 0; i < answer.FloorsPictures.Count; i++) { var count = dataOfBot.GetMapObjects(findedOrganizations).Where(x => x.FloorID == answer.FloorsPictures[i].FloorID).Count(); if (max < count) { max = count; index = answer.FloorsPictures[i].FloorID; } } return(index); }