/// <summary> /// 获取商品的打印条码的后三位 /// </summary> /// <param name="product"></param> /// <param name="prcou">打印数量</param> /// <returns></returns> private List <string> GetPrintBarcodeNumbs(ProductBarcodePrintInfo product, int prcou) { List <string> li = new List <string>(); string starFlg = "0"; if (product != null) { starFlg = product.CurPrintFlag; } lock (objlock) { string _key = "cur_barcode_flgnum_1109"; var tecurNum = CacheAccess.Get(_key) as string; if (!string.IsNullOrEmpty(tecurNum)) { starFlg = tecurNum; } } Math36 math = new Math36(); int curstar = (int)(math.To10(starFlg, 0)); for (int i = 0; i < prcou; i++) { curstar += 1; li.Add((math.To36(curstar)).PadLeft(3, '0')); } lock (objlock) { string _key = "cur_barcode_flgnum_1109"; CacheAccess.Set(_key, curstar, 2); } return(li); }
public override async void OnNavigatedTo(NavigationParameters parameters) { base.OnNavigatedTo(parameters); string firstAccess = "false"; if (parameters.ContainsKey(NavigationKeyParameters.FirstAccess)) firstAccess = parameters[NavigationKeyParameters.FirstAccess] as string; if (parameters.ContainsKey(NavigationKeyParameters.ClientsBirthday)) { await Task.Delay(2000); var listBirthdays = parameters[NavigationKeyParameters.ClientsBirthday] as ObservableCollection<Client>; await CacheAccess.Insert<ObservableCollection<Client>>(CacheKeys.BIRTHDAYS, listBirthdays); if (firstAccess == "true") { int dayMonthCache = 0; try { dayMonthCache = await CacheAccess.Get<int>(CacheKeys.DAY_MONTH); } catch { } if (dayMonthCache != DateTime.Now.Day) { await PopupAnniversaryHelper.Mostrar(_userAppService); } } } }
private async void GetBirthdays() { try { Birthdays = await CacheAccess.Get <ObservableCollection <Client> >(CacheKeys.BIRTHDAYS); } catch { } BirthdayTitle = "Aniversariantes do dia: " + DateTime.Now.Day + "/" + DateTime.Now.Month + "!"; }
private async Task <ObservableCollection <Client> > CheckAnniversary() { var clients = await CacheAccess.Get <List <Client> >(CacheKeys.CLIENTS); var clientsBirthday = new ObservableCollection <Client>(); foreach (var client in clients) { if (client.Birthdate.Day == DateTime.Now.Day && client.Birthdate.Month == DateTime.Now.Month) { clientsBirthday.Add(client); } } return(clientsBirthday); }
protected void Page_Load(object sender, EventArgs e) { //从缓存中获取指定城市ID的首页团购推荐 recommend = CacheAccess.Get <string>("IndexRecommend_" + cityId); if (string.IsNullOrEmpty(recommend)) { recommend = GetRecommend(); } //从缓存中获取指定城市ID的首页团购列表 newTuan = CacheAccess.Get <string>("IndexTuanList_" + cityId); if (string.IsNullOrEmpty(newTuan)) { newTuan = GetTuanList(0, 0, 0, null, true); } }
private async Task <GetClientsByUserIdResponse> TryGetClientsFromCache() { var clients = new GetClientsByUserIdResponse(); try { clients.Clients = await CacheAccess.Get <List <Client> >(CacheKeys.CLIENTS); } catch { var user = await CacheAccess.GetSecure <User>(CacheKeys.USER_KEY); clients = await _clientAppService.GetClientsByUserId(user.UsuarioId.ToString()); await CacheAccess.Insert <List <Client> >(CacheKeys.CLIENTS, clients.Clients); } return(clients); }
private async Task <GetSalesByUserIdResponse> TryGetSalesFromCache() { var sales = new GetSalesByUserIdResponse(); try { sales.Sales = await CacheAccess.Get <List <Sale> >(CacheKeys.SALES); } catch { var user = await CacheAccess.GetSecure <User>(CacheKeys.USER_KEY); sales = await _salesAppService.GetSalesByUserId(user.UsuarioId.ToString()); await CacheAccess.Insert <List <Sale> >(CacheKeys.SALES, sales.Sales); } return(sales); }
public override DataTable GetAllCity() { DataTable dt = CacheAccess.Get <DataTable>("ALLCITY"); if (dt == null) { string strSql = "SELECT CityID,ECity,City FROM TN_City WHERE IsDisplay=1 ORDER BY OrderID"; DataSet ds = SqlHelper.ExecuteQuery(CommandType.Text, strSql); if (ds != null && ds.Tables.Count > 0) { dt = ds.Tables[0]; CacheAccess.Set("ALLCITY", dt); } else { return(null); } } return(dt); }
private async Task CheckRegisterChallengeCompleted(List <Trophy> myTrophies, string usuarioId, List <Challenge> currentChallenges, Season CurrentSeason) { try { int myRegisterPoints = 0; var user = await CacheAccess.GetSecure <User>(CacheKeys.USER_KEY); try { myRegisterPoints = await CacheAccess.Get <int>(CacheKeys.REGISTER_POINTS_FOR_CHALLENGE); } catch { myRegisterPoints = await _clientsAppService.GetUserClientPointsForChallenge(usuarioId); await CacheAccess.Insert <int>(CacheKeys.REGISTER_POINTS_FOR_CHALLENGE, myRegisterPoints); } foreach (var challenge in currentChallenges) { bool _hasTrophy = false; bool _hasEnoughtPoints = false; if (challenge.Parameter == 3) { foreach (var trophy in myTrophies) { if (trophy.DesafioId.ToString() == challenge.DesafioId.ToString()) { _hasTrophy = true; break; } } _hasEnoughtPoints = (myRegisterPoints >= challenge.Goal) ? true : false; } if (!_hasTrophy && _hasEnoughtPoints) { await _trophyAppService.InsertNewTrophy(new InsertTrophyRequest { DesafioId = challenge.DesafioId, EndDate = challenge.EndDate, StartDate = challenge.StartDate, Goal = challenge.Goal, Name = challenge.Name, Parameter = challenge.Parameter, TemporadaId = CurrentSeason.TemporadaId, UsuarioId = new Guid(usuarioId), Prize = challenge.Prize }); await _userAppService.UpdateUserPoints(new UpdateUserPointsRequest() { AverageItensPerSalePoints = user.AverageItensPerSalePoints, AverageTicketPoints = user.AverageTicketPoints, InviteAllyFlowersPoints = user.InviteAllyFlowersPoints, RegisterClientsPoints = user.RegisterClientsPoints + challenge.Prize, SalesNumberPoints = user.SalesNumberPoints, UsuarioId = user.UsuarioId }); await CacheAccess.InsertSecure <User>(CacheKeys.USER_KEY, user); _hasWonTrophy = true; UserDialogs.Instance.Toast("Você acabou de ganhar um Troféu de Cadastro de Clientes! Parabéns!", new TimeSpan(0, 0, 4)); } } } catch { } }