/// <summary> /// 处理搜索卡券的条件 /// </summary> public void CardSearch() { SearchCard su = new SearchCard(CurrentAdmin, CurrentLanguage.Code); string url = su.URL; Response.Write("{\"msg\":\"OK\",\"url\":\"" + url + "\"}"); }
private SearchQuery CreateSearchQueryFormSaved(string savedSearchId) { SearchCard searchCard = (SearchCard)Session.CardManager.GetDictionary(new Guid(SEARCH_CARD_TYPE)); SavedSearchQuery savedQuery = searchCard.GetQuery(new Guid(savedSearchId)); return(savedQuery.Export()); }
protected void Page_Load(object sender, EventArgs e) { if (!EX_Admin.Power("cardtype_list", "优惠券列表")) { PageReturnMsg = PageNoPowerMsg(); } su = new SearchCard(CurrentAdmin, CurrentLanguage.Code); type = RequestTool.RequestInt("type", 311); PageSize = RequestTool.getpageSize(25); string where = "1=1"; key = RequestTool.RequestString("key"); user_id = RequestTool.RequestInt("user_id"); if (key != "") { where += " and Code like lbsql{'%" + key + "%'} or User_UserName like lbsql{'%" + key + "%'}"; } if (user_id > 0) { where += " and User_id=" + user_id + ""; } where += su.SQL; models = B_Lebi_Card.GetList(where, "id desc", PageSize, page); int recordCount = B_Lebi_Card.Counts(where); PageString = Pager.GetPaginationString("?page={0}&key=" + key + "&user_id=" + user_id + "&" + su.URL, page, PageSize, recordCount); }
protected void Page_Load(object sender, EventArgs e) { SearchCard su = new SearchCard(CurrentAdmin, CurrentLanguage.Code); model = su.Model; callback = RequestTool.RequestString("callback"); }
/// <summary> /// 批量修改卡券 /// </summary> public void Cards_Edit() { if (!EX_Admin.Power("card_edit", "修改卡券")) { AjaxNoPower(); return; } string card_ids = RequestTool.RequestString("card_ids"); string card_codes = RequestTool.RequestString("card_codes"); SearchCard su = new SearchCard(CurrentAdmin, CurrentLanguage.Code); int CardStatus = RequestTool.RequestInt("CardStatus", 0); if (CardStatus == 0) { Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}"); return; } string where = ""; if (card_ids != "") { where = "id in (" + card_ids + ")"; } else { //where = "id>0 " + su.SQL; Response.Write("{\"msg\":\"" + Tag("没有选择任何数据") + "\"}"); return; } string sql = "update [Lebi_Card] set Type_id_CardStatus=" + CardStatus + " where " + where; Common.ExecuteSql(sql); Response.Write("{\"msg\":\"OK\"}"); }
/// <summary> /// Fonction de recherche dans un deck (ouverture d'une page type liste de carte) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void D_SeekCard(object sender, System.Windows.RoutedEventArgs e) { if (ID_Joueur == 1) { SearchCard sc = new SearchCard(Tools.CurrentGame.J1_Deck.Cartes); sc.ShowDialog(); } else if (ID_Joueur == 2) { SearchCard sc = new SearchCard(Tools.CurrentGame.J2_Deck.Cartes); sc.ShowDialog(); } }
protected void Page_Load(object sender, EventArgs e) { if (!EX_Admin.Power("card_edit", "修改卡券")) { WindowNoPower(); } int user_id = RequestTool.RequestInt("user_id", 0); card_ids = RequestTool.RequestString("ids"); su = new SearchCard(CurrentAdmin, CurrentLanguage.Code); if (card_ids != "") { models = B_Lebi_Card.GetList("id in (lbsql{" + card_ids + "})", ""); count = models.Count; } else { count = B_Lebi_Card.Counts("1=1" + su.SQL); } }
/// <summary> /// When OnTurn method receives a submit invoke activity on bot turn, it calls this method. /// </summary> /// <param name="turnContext">Provides context for a turn of a bot.</param> /// <param name="taskModuleRequestData">Task module invoke request value payload.</param> /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param> /// <returns>A task that represents a task module response.</returns> protected override async Task <TaskModuleResponse> OnTeamsTaskModuleSubmitAsync(ITurnContext <IInvokeActivity> turnContext, TaskModuleRequest taskModuleRequestData, CancellationToken cancellationToken) { var valuesFromTaskModule = JsonConvert.DeserializeObject <SearchSubmitAction>(taskModuleRequestData.Data?.ToString()); try { if (valuesFromTaskModule == null) { this.logger.LogInformation($"Request data obtained on task module submit action is null."); await turnContext.SendActivityAsync(Strings.ErrorMessage).ConfigureAwait(false); return(null); } switch (valuesFromTaskModule.Command.ToUpperInvariant().Trim()) { case Constants.MyProfile: this.logger.LogInformation("Activity type is invoke submit from my profile command"); await this.rootDialog.RunAsync(turnContext, this.dialogStatePropertyAccessor, cancellationToken).ConfigureAwait(false); break; case Constants.Search: this.logger.LogInformation("Activity type is invoke submit from search command"); foreach (var profile in valuesFromTaskModule.UserProfiles) { // Bot is expected to send multiple user profile cards which may cross the threshold limit of bot messages/sec, hence adding the retry logic. await RetryPolicy.ExecuteAsync(async() => { await turnContext.SendActivityAsync(MessageFactory.Attachment(SearchCard.GetUserCard(profile)), cancellationToken).ConfigureAwait(false); }).ConfigureAwait(false); } break; } return(null); } catch (Exception ex) { this.logger.LogError(ex, "Error in submit action of task module."); return(null); } }
/// <summary> /// Get user profile or search or edit profile based on activity type. /// </summary> /// <param name="stepContext">Provides context for a step in a bot dialog.</param> /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param> /// <returns>User profile or search or edit profile based on activity type.</returns> private async Task <DialogTurnResult> MyProfileAndSearchAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { var tokenResponse = (TokenResponse)stepContext.Result; var activity = stepContext.Context.Activity; if (tokenResponse == null) { this.logger.LogInformation($"User is not authenticated and token is null for: {activity.Conversation.Id}."); await stepContext.Context.SendActivityAsync(Strings.NotLoginText).ConfigureAwait(false); return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false)); } var token = tokenResponse.Token.ToString(CultureInfo.InvariantCulture); // signin/verifyState activity name used here to send my profile card after successful sign in. if ((activity.Type == MessageActivityType) || (activity.Name == SignInActivityName)) { var command = ((string)stepContext.Values["command"]).ToUpperInvariant().Trim(); switch (command) { case Constants.MyProfile: this.logger.LogInformation("my profile command triggered", new Dictionary <string, string>() { { "User", activity.From.Id }, { "AADObjectId", activity.From.AadObjectId } }); await this.MyProfileAsync(token, stepContext, cancellationToken).ConfigureAwait(false); break; case Constants.Search: this.logger.LogInformation("Search command triggered.", new Dictionary <string, string>() { { "User", activity.From.Id }, { "AADObjectId", activity.From.AadObjectId } }); await stepContext.Context.SendActivityAsync(MessageFactory.Attachment(SearchCard.GetSearchCard())).ConfigureAwait(false); break; default: await this.EditProfileAsync(token, stepContext, cancellationToken).ConfigureAwait(false); break; } return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false)); } // submit-invoke request at edit profile else if (activity.Type == InvokeActivityType) { await this.EditProfileAsync(token, stepContext, cancellationToken).ConfigureAwait(false); } return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken).ConfigureAwait(false)); }
/// <summary> /// Get user profile or search or edit profile based on activity type. /// </summary> /// <param name="stepContext">Provides context for a step in a bot dialog.</param> /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param> /// <returns>Tracking task.</returns> private async Task <DialogTurnResult> MyProfileAndSearchAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken) { var activity = stepContext.Context.Activity; var tokenResponse = (TokenResponse)stepContext.Result; if (tokenResponse == null) { this.logger.LogInformation($"User is not authenticated and token is null for: {activity.Conversation.Id}."); await stepContext.Context.SendActivityAsync(Strings.NotLoggedInText).ConfigureAwait(false); return(await stepContext.EndDialogAsync().ConfigureAwait(false)); } var token = tokenResponse.Token; // signin/verifyState activity name used here to send my profile card after successful sign in. if ((activity.Type == MessageActivityType) || (activity.Name == SignInActivityName)) { var command = ((string)stepContext.Values["command"]).Trim(); if (command.Equals(Strings.BotCommandMyProfile, StringComparison.CurrentCultureIgnoreCase) || command.Equals(Constants.MyProfile)) { this.logger.LogInformation("My profile command triggered", new Dictionary <string, string>() { { "User", activity.From.Id }, { "AADObjectId", activity.From.AadObjectId } }); await this.MyProfileAsync(token, stepContext, cancellationToken).ConfigureAwait(false); } else if (command.Equals(Strings.BotCommandSearch, StringComparison.CurrentCultureIgnoreCase) || command.Equals(Constants.Search)) { this.logger.LogInformation("Search command triggered", new Dictionary <string, string>() { { "User", activity.From.Id }, { "AADObjectId", activity.From.AadObjectId } }); await stepContext.Context.SendActivityAsync(MessageFactory.Attachment(SearchCard.GetSearchCard())).ConfigureAwait(false); } else { await stepContext.Context.SendActivityAsync(MessageFactory.Attachment(HelpCard.GetHelpCard())).ConfigureAwait(false); } } // submit-invoke request at edit profile else if (activity.Type == InvokeActivityType) { await this.EditProfileAsync(token, stepContext, cancellationToken).ConfigureAwait(false); } return(await stepContext.EndDialogAsync().ConfigureAwait(false)); }