Exemplo n.º 1
0
        private async Task <DialogTurnResult> GetMoneyStepAsync2(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            stepContext.Values["Choise"] = ((FoundChoice)stepContext.Result).Value;

            if (stepContext.Values["Choise"].ToString().ToLower() == "ja")
            {
                try
                {
                    var      lastmonth = DateTime.Now.Month - 1;
                    MoneyLog money     = JsonConvert.DeserializeObject <MoneyLog>(BotMethods.GetDocument("moneylog", "money_" + lastmonth.ToString() + "_" + DateTime.Now.Year + ".json", this.botConfig.Value.StorageAccountUrl, this.botConfig.Value.StorageAccountKey));

                    var userId = money.User.FindIndex(x => x.Name == (string)stepContext.Values["name"]);

                    var creditDialog_LastMonthDepts1 = MessageFactory.Text(string.Format(creditDialogLastMonthDepts, money.User[userId].Owe));
                    if (userId != -1)
                    {
                        await stepContext.Context.SendActivityAsync(creditDialog_LastMonthDepts1, cancellationToken);
                    }
                    else
                    {
                        await stepContext.Context.SendActivityAsync(MessageFactory.Text(creditDialogNoBillLastMonth), cancellationToken);
                    }
                }
                catch
                {
                    await stepContext.Context.SendActivityAsync(MessageFactory.Text(creditDialogNoBill), cancellationToken);
                }
            }

            await stepContext.EndDialogAsync();

            return(await stepContext.BeginDialogAsync(nameof(OverviewDialog)));
        }
Exemplo n.º 2
0
        private async Task <DialogTurnResult> GetMoneyStepAsync1(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            if (stepContext.Context.Activity.From.Name == "User")
            {
                stepContext.Values["name"] = (string)stepContext.Result;
            }



            try
            {
                MoneyLog money = JsonConvert.DeserializeObject <MoneyLog>(BotMethods.GetDocument("moneylog", "money_" + DateTime.Now.Month.ToString() + "_" + DateTime.Now.Year + ".json", this.botConfig.Value.StorageAccountUrl, this.botConfig.Value.StorageAccountKey));

                var userId = money.User.FindIndex(x => x.Name == (string)stepContext.Values["name"]);

                var creditDialogMonthDepts1 = MessageFactory.Text(string.Format(creditDialogMonthDepts, money.User[userId].Owe)); //monatliche Belastung

                if (userId != -1)
                {
                    await stepContext.Context.SendActivityAsync(creditDialogMonthDepts1, cancellationToken);

                    await stepContext.EndDialogAsync(cancellationToken : cancellationToken);

                    return(await stepContext.BeginDialogAsync(nameof(OverviewDialog)));
                }
                else
                {
                    return(await stepContext.PromptAsync(nameof(ChoicePrompt), new PromptOptions
                    {
                        Prompt = MessageFactory.Text(creditDialogNoOrder),
                        Choices = ChoiceFactory.ToChoices(new List <string> {
                            creditDialogYes, creditDialogNo
                        }),
                        Style = ListStyle.HeroCard,
                    }));
                }
            }
            catch
            {
                return(await stepContext.PromptAsync(nameof(ChoicePrompt), new PromptOptions
                {
                    Prompt = MessageFactory.Text(creditDialogNoBill),
                    Choices = ChoiceFactory.ToChoices(new List <string> {
                        creditDialogYes, creditDialogNo
                    }),
                    Style = ListStyle.HeroCard,
                }));
            }
        }
Exemplo n.º 3
0
        public static void MoneyAnsys(Operation_Record Operation_Record
                                      , decimal Using_Money, UserInfo userInfo, MoneyType MoneyType, string Araw_RetrunContent)
        {
            try
            {
                List <Award_Public>     Award_Public_List     = Constant.Award_Public_List;
                List <Operation_Record> Operation_Record_List = Constant.Operation_Record_List;
                List <Globe_Clue>       Globe_Clue_List       = Constant.Globe_Clue_List;
                List <UserInfo>         UserInfo_List         = Constant.userInfo_List;
                List <Globe>            Globe_List            = Constant.Globe_List;
                List <MoneyLog>         MoneyLog_List         = Constant.MoneyLog_List;

                MoneyLog MoneyLog = MoneyLog = new MoneyLog()
                {
                    UserID        = userInfo.LoginName,
                    UserName      = userInfo.Name,
                    O_Money       = Using_Money,
                    CreateTime    = DateTime.Now,
                    OperationType = (int)MoneyType,
                    CreateUID     = userInfo.LoginName,
                    IsDelete      = 0,
                    IsEnable      = (int)IsEnable.Enable,
                };
                if (MoneyType == TLC_Model.Enums.MoneyType.充值)
                {
                    MoneyLog.Type      = (int)MoneyLogType.Add;
                    MoneyLog.O_Content = "操作内容:" + "充值" + ";金额:" + Using_Money;
                }
                else if (MoneyType == TLC_Model.Enums.MoneyType.提现)
                {
                    MoneyLog.Type      = (int)MoneyLogType.Reduce;
                    MoneyLog.O_Content = "操作内容:" + "提现" + ";金额:" + Using_Money;
                }
                else
                {
                    //为了做支出支入做统计
                    Globe_Clue         clue         = Globe_Clue_List.FirstOrDefault(i => i.Code == Operation_Record.ClueCode);
                    Award_Public       Award_Public = Award_Public_List.FirstOrDefault(i => i.Code == Operation_Record.AwardCode);
                    Operation_Record_S os           = OperationManage.Get_Operation_Record_S(Operation_Record, Award_Public, clue, userInfo, Globe_List);
                    OperationManage.SetContent(clue, os);
                    switch (MoneyType)
                    {
                    case MoneyType.注:
                        MoneyLog.Type      = (int)MoneyLogType.Reduce;
                        MoneyLog.O_Content = "操作内容:" + "下注->" + "年号->" + Award_Public.Year + "期号->" + Award_Public.Name + clue.First_Name + "->" +
                                             clue.Second_Name + "->下注内容(" + os.BuyDisplay + os.BuyDisplay2 + ")->下注单价(" + Operation_Record.UnitPrice + ")" + ";金额:" + Using_Money;
                        break;

                    case MoneyType.返还奖金:
                        MoneyLog.Type      = (int)MoneyLogType.Add;
                        MoneyLog.O_Content = "操作内容:" + "返水->" + "年号->" + Award_Public.Year + "期号->" + Award_Public.Name + clue.First_Name + "->" +
                                             clue.Second_Name + "->下注内容(" + os.BuyDisplay + os.BuyDisplay2 + ")->下注单价(" + Operation_Record.UnitPrice + ")" + ";金额:" + Using_Money;
                        break;

                    case MoneyType.中奖:
                        MoneyLog.Type      = (int)MoneyLogType.Add;
                        MoneyLog.O_Content = "操作内容:" + "中奖->" + "年号->" + Award_Public.Year + "期号->" + Award_Public.Name + clue.First_Name + "->" +
                                             clue.Second_Name + "->下注内容(" + os.BuyDisplay + os.BuyDisplay2 + ")->下注单价(" + Operation_Record.UnitPrice + ")" + ")->派奖内容【" + Araw_RetrunContent + "】" + ";金额:" + Using_Money;
                        break;

                    case MoneyType.综合:
                        MoneyLog.Type      = (int)MoneyLogType.Add;
                        MoneyLog.O_Content = "操作内容:" + "和局->" + "年号->" + Award_Public.Year + "期号->" + Award_Public.Name + clue.First_Name + "->" +
                                             clue.Second_Name + "->下注内容(" + os.BuyDisplay + os.BuyDisplay2 + ")->下注单价(" + Operation_Record.UnitPrice + ")" + ")->派奖内容【" + Araw_RetrunContent + "】" + ";金额:" + Using_Money;
                        break;

                    case MoneyType.充值:

                    default:
                        break;
                    }
                }
                var jsm = Constant.MoneyLog_S.Add(MoneyLog);
                if (jsm.errNum == 0)
                {
                    MoneyLog.Id = Convert.ToInt32(jsm.retData);
                    MoneyLog_List.Add(MoneyLog);
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error(ex);
            }
        }