Esempio n. 1
0
        void ShowInfo()
        {
            this.txtDate.Attributes.Add("onFocus", "WdatePicker()");
            foreach (int num in Enum.GetValues(typeof(NewsType)))
            {
                this.ddl_type.Items.Add(new ListItem(Enum.GetName(typeof(NewsType), num), num.ToString()));
            }

            if (IsUpdate && ItemInfo != null)
            {
                this.ddl_type.SelectedValue    = ItemInfo.newstype.ToString();
                this.txtTitle.Text             = ItemInfo.newstitle;
                this.txtDate.Value             = FormatConvertor.DateTimeToDateString(ItemInfo.addTime);
                this.hfcontent.Value           = HttpUtility.HtmlEncode(ItemInfo.newscontent);
                this.cb_red.Checked            = ItemInfo.IsRed == 1;
                this.cb_top.Checked            = ItemInfo.IsTop == 1;
                this.cb_pop.Checked            = ItemInfo.IsPop == 1;
                this.cb_bold.Checked           = ItemInfo.Isbold == 1;
                this.rbl_Release.SelectedValue = ItemInfo.release ? "1" : "0";

                this.txtColorCode.Text = ItemInfo.Color;

                Newscontent = HttpUtility.HtmlDecode(ItemInfo.newscontent);
            }
            else
            {
                this.txtDate.Value = FormatConvertor.DateTimeToDateString(DateTime.Now);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 从QueryString中返回参数。
 /// </summary>
 /// <param name="param">参数。</param>
 /// <param name="defaultValue">默认值。</param>
 /// <returns></returns>
 public static DateTime GetQueryStringDateTime(string param, DateTime defaultValue)
 {
     if ((Request.QueryString[param] != null) && (Request.QueryString[param].Length != 0))
     {
         return(FormatConvertor.StringToDateTime(Request.QueryString[param]));
     }
     return(defaultValue);
 }
        internal Dictionary <TrackingMarker, Point2D> IdentifyMarkers(Frame frame)
        {
            int x0 = searchSpace.RangeX.Low, x1 = searchSpace.RangeX.High;
            int y0 = searchSpace.RangeY.Low, y1 = searchSpace.RangeY.High;
            int clipWidth  = x1 - x0;
            int clipHeight = y1 - y0;

            var output = new Dictionary <TrackingMarker, Point2D>();

            foreach (TrackingMarker marker in this.markers)
            {
                // threshold
                var hueTolerance = marker.HueTolerance;
                var thresh       = ClipAndThreshold(
                    frame.Colour,
                    FormatConvertor.PixelWidth(frame.ColourFormat),
                    FormatConvertor.PixelHeight(frame.ColourFormat),
                    x0, x1, y0, y1,
                    marker.Hue - hueTolerance,
                    marker.Hue + hueTolerance);

                if (DebugSettings.Default.DebugMode)
                {
                    ImageWriter.WritePPM(
                        thresh, clipWidth, clipHeight, DebugSettings.Default.LogRoot + @"\cv\" +
                        marker.Name.ToString() + ".thresh" + frame.FrameNumber + ".ppm", 1);
                }

                // remove outliers
                var cleanThresh = CleanImage(thresh, clipWidth, clipHeight);

                if (DebugSettings.Default.DebugMode)
                {
                    ImageWriter.WritePPM(
                        cleanThresh, clipWidth, clipHeight, DebugSettings.Default.LogRoot + @"\cv\" +
                        marker.Name.ToString() + ".thresh" + frame.FrameNumber + ".clean.ppm", 1);
                }

                // calculate centre
                var momentX = CalcMomentXOrder1(cleanThresh, clipWidth, clipHeight);
                var momentY = CalcMomentYOrder1(cleanThresh, clipWidth, clipHeight);
                var momentAv = CalcMomentXYOrder00(cleanThresh, clipWidth, clipHeight);
                int x = (int)(momentX / momentAv); int y = (int)(momentY / momentAv);
                var pointXY = new Point2D(x0 + x, y0 + y);

                // test confidence
                var count = CountPixelsSet(cleanThresh);
                if (count > ImageAnalysis.Settings.Default.MinimumThresholdPixels)
                {
                    output.Add(marker, pointXY);
                }
            }
            return(output);
        }
Esempio n. 4
0
        private async Task <DialogTurnResult> SearchClosingDateStepAsync(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var crmState = await _accessors.CRMStateAccessor.GetAsync(stepContext.Context, () => new CRMState(), cancellationToken);

            var userState = await _accessors.LoggedUserAccessor.GetAsync(stepContext.Context, () => new LoggedUserState(), cancellationToken);

            //Gathering the date if not already given
            if (crmState.Opportunity.EstimatedCloseDate == null || crmState.Opportunity.EstimatedCloseDate == DateTime.MinValue)
            {
                var luisResult = await _botServices.LuisServices[CulturedBot.LuisAppName].RecognizeAsync(stepContext.Context, cancellationToken);

                var    entities        = luisResult.Entities;
                string timex           = (string)entities["datetime"]?[0]?["timex"]?.First;
                var    formatConvertor = new FormatConvertor();
                crmState.Opportunity.EstimatedCloseDate = formatConvertor.TurnTimexToDateTime(timex);
            }
            //Asking for retry if necessary
            var promptMessage = "";

            if (crmState.Opportunity.EstimatedCloseDate == null || crmState.Opportunity.EstimatedCloseDate == DateTime.MinValue)
            {
                promptMessage = $"{CulturedBot.AdmitNotUnderstanding} {CulturedBot.AskIfWantToSkip}";
            }

            userState.IsEligibleForPotentialSkippingStep = !string.IsNullOrEmpty(promptMessage);
            if (userState.IsEligibleForPotentialSkippingStep)
            {
                await _accessors.LoggedUserAccessor.SetAsync(stepContext.Context, userState, cancellationToken);

                await _accessors.CRMStateAccessor.SetAsync(stepContext.Context, crmState, cancellationToken);

                var activityPrompt = MessageFactory.Text(promptMessage);
                activityPrompt.Locale = CulturedBot.Culture?.Name;

                var activityRetryPrompt = MessageFactory.Text(CulturedBot.AskYesOrNo);
                activityRetryPrompt.Locale = CulturedBot.Culture?.Name;

                var promptOptions = new PromptOptions
                {
                    Prompt      = activityPrompt,
                    RetryPrompt = activityRetryPrompt,
                };
                return(await stepContext.PromptAsync(_retryFetchingClosingDateFromUserPrompt, promptOptions, cancellationToken));
            }

            await _accessors.LoggedUserAccessor.SetAsync(stepContext.Context, userState, cancellationToken);

            await _accessors.CRMStateAccessor.SetAsync(stepContext.Context, crmState, cancellationToken);

            return(await stepContext.NextAsync(cancellationToken : cancellationToken));
        }
Esempio n. 5
0
 // POST api/values
 public HttpResponseMessage Post([FromBody] ReqestModel value)
 {
     if (value == null || string.IsNullOrEmpty(value.Format) || string.IsNullOrEmpty(value.TextToConvert))
     {
         var response = Request.CreateResponse <string>(HttpStatusCode.BadRequest, "Failed");
         return(response);
     }
     else
     {
         FormatConvertor formatConvertor = new FormatConvertor();
         var             response        = Request.CreateResponse <string>(HttpStatusCode.Created, formatConvertor.Convert(value.Format, value.TextToConvert));
         return(response);
     }
 }
Esempio n. 6
0
        public Recording(string mappingParamsPath, string timingPath, string depthPath, DepthFormat dFormat,
                         string colourPath, ColourFormat cFormat, string calibrationPath) : this()
        {
            // open mapping data
            var fMapping = new FileStream(mappingParamsPath, FileMode.Open);

            this.mappingParams = new byte[fMapping.Length];
            fMapping.Read(this.mappingParams, 0, this.mappingParams.Length);
            fMapping.Close();

            // get image file streams ready
            this.fDepth  = new FileStream(depthPath, FileMode.Open);
            this.fColour = new FileStream(colourPath, FileMode.Open);

            // deserialise calibration if required
            if (calibrationPath == null)
            {
                this.IsCalibratedRecording = false;
            }
            else
            {
                this.calibration           = Calibration.CreateFromFile(calibrationPath);
                this.IsCalibratedRecording = true;
            }


            // read and convert timing data to fractional seconds
            var fTiming      = new FileStream(timingPath, FileMode.Open);
            var timingReader = new BinaryReader(fTiming);

            this.Timestamps = new float[fTiming.Length / sizeof(Single)];
            for (int i = 0; i < this.Timestamps.Length; i++)
            {
                this.Timestamps[i] = timingReader.ReadSingle();
            }
            fTiming.Close();

            // set other recording properties
            this.cFrameSizeBytes  = FormatConvertor.ByteDataLength(cFormat);
            this.dFrameSizeShorts = FormatConvertor.PixelDataLength(dFormat);
            this.NumberOfFrames   = (int)this.fDepth.Length / FormatConvertor.ByteDataLength(dFormat);
        }
Esempio n. 7
0
        private async Task UpdateDialogStatesAsync(RecognizerResult luisResult, string intentName, ITurnContext turnContext)
        {
            if (luisResult.Entities != null && luisResult.Entities.HasValues)
            {
                // Get latest States
                var crmState = await _accessors.CRMStateAccessor.GetAsync(turnContext, () => new CRMState());

                var luisState = await _accessors.LuisStateAccessor.GetAsync(turnContext, () => new LuisState());

                var entities = luisResult.Entities;

                // Supported LUIS Entities
                string[] luisExpectedLeadName =
                {
                    "leadfullname",
                    "personNameP"
                };
                string luisExpectedCompanyName           = "companyName";
                string luisExpectedDateTime              = "datetime";
                string luisExpectedProductTitle          = "productTitle";
                string luisExpectedConfidenceOpportunity = "confidenceOpportunity";

                string luisHintSearchLeadAddress = "searchaddress";
                string luisHintSearchLeadCompany = "searchcompany";
                string luisHintSearchLeadPhone   = "searchphone";
                string luisHintSearchLeadEmail   = "searchemail";

                string luisHintSearchCompanyContact = "searchcontact";
                string luisHintSearchContactName    = "searchcontactname";

                string luisHintSearchNumberOpportunites = "searchnumberopportunities";
                string luisHintSearchOpportunites       = "searchopportunities";

                //Given Data
                foreach (var name in luisExpectedLeadName)
                {
                    if (entities[name] != null)
                    {
                        var fullName = (string)entities[name][0];
                        if (crmState.Lead == null)
                        {
                            crmState.Lead = new Lead();
                        }
                        crmState.Lead.FullName = fullName;
                        break;
                    }
                }

                if (entities[luisExpectedCompanyName] != null)
                {
                    var companyName = (string)entities[luisExpectedCompanyName][0].First;
                    crmState.Company.Name = companyName;
                }

                if (entities[luisExpectedDateTime] != null)
                {
                    string timex           = (string)entities[luisExpectedDateTime]?[0]?["timex"]?.First;
                    var    formatConvertor = new FormatConvertor();
                    crmState.Opportunity.EstimatedCloseDate = formatConvertor.TurnTimexToDateTime(timex);
                }

                if (entities[luisExpectedProductTitle] != null)
                {
                    var productTitle = (string)entities[luisExpectedProductTitle][0];
                    crmState.Product.Title = productTitle;
                }

                if (intentName == ProxiCallIntents.CreateOpportunity)
                {
                    if (entities[luisExpectedConfidenceOpportunity] != null)
                    {
                        var confidenceOpportunity = (string)entities[luisExpectedConfidenceOpportunity][0].First;
                        crmState.Opportunity.ChangeConfidenceBasedOnName(confidenceOpportunity);
                    }
                    else
                    {
                        crmState.Opportunity.ChangeConfidenceBasedOnName(OpportunityConfidence.Average.Name);
                    }
                }

                //Hints
                if (entities[luisHintSearchLeadAddress] != null)
                {
                    luisState.AddDetectedEntity(ProxiCallEntities.SEARCH_ADDRESS_ENTITYNAME);
                }

                if (entities[luisHintSearchLeadCompany] != null)
                {
                    luisState.AddDetectedEntity(ProxiCallEntities.SEARCH_COMPANY_ENTITYNAME);
                }

                if (entities[luisHintSearchLeadPhone] != null)
                {
                    luisState.AddDetectedEntity(ProxiCallEntities.SEARCH_PHONENUMBER_ENTITYNAME);
                }

                if (entities[luisHintSearchLeadEmail] != null)
                {
                    luisState.AddDetectedEntity(ProxiCallEntities.SEARCH_EMAIL_ENTITYNAME);
                }

                if (entities[luisHintSearchCompanyContact] != null)
                {
                    luisState.AddDetectedEntity(ProxiCallEntities.SEARCH_CONTACT_ENTITYNAME);
                }

                if (entities[luisHintSearchContactName] != null)
                {
                    luisState.AddDetectedEntity(ProxiCallEntities.SEARCH_CONTACT_NAME_ENTITYNAME);
                }

                if (entities[luisHintSearchOpportunites] != null)
                {
                    luisState.AddDetectedEntity(ProxiCallEntities.SEARCH_OPPORTUNITIES_NAME_ENTITYNAME);
                }

                if (entities[luisHintSearchNumberOpportunites] != null)
                {
                    luisState.AddDetectedEntity(ProxiCallEntities.SEARCH_NUMBER_OPPORTUNITIES_ENTITYNAME);
                }

                //Searching for "informations" about leads
                var searchInformationsOnLead =
                    intentName == ProxiCallIntents.SearchLeadData &&
                    (luisState.Entities == null || luisState.Entities.Count == 0);

                var searchInformationsOnCompany =
                    intentName == ProxiCallIntents.SearchCompanyData &&
                    (luisState.Entities == null || luisState.Entities.Count == 0);

                var searchInformationsOnContactLead =
                    intentName == ProxiCallIntents.SearchCompanyData &&
                    luisState.Entities != null &&
                    luisState.Entities.Contains(ProxiCallEntities.SEARCH_CONTACT_ENTITYNAME) &&
                    luisState.Entities.Count == 1;

                if (searchInformationsOnLead)
                {
                    luisState.AddDetectedEntity(ProxiCallEntities.SEARCH_COMPANY_ENTITYNAME);
                    luisState.AddDetectedEntity(ProxiCallEntities.SEARCH_NUMBER_OPPORTUNITIES_ENTITYNAME);
                }

                if (searchInformationsOnCompany)
                {
                    luisState.AddDetectedEntity(ProxiCallEntities.SEARCH_NUMBER_OPPORTUNITIES_ENTITYNAME);
                }

                if (searchInformationsOnContactLead)
                {
                    luisState.AddDetectedEntity(ProxiCallEntities.SEARCH_NUMBER_OPPORTUNITIES_ENTITYNAME);
                }

                // Set the new values into state.
                luisState.IntentName = intentName;
                await _accessors.CRMStateAccessor.SetAsync(turnContext, crmState);

                await _accessors.LuisStateAccessor.SetAsync(turnContext, luisState);
            }
        }
Esempio n. 8
0
        /// <summary>
        ///
        /// </summary>
        private void InitForm()
        {
            hfaction.Value = action;

            if (UserInfo != null)
            {
                #region 用户基本信息
                this.lblUserId.Text     = UserInfo.ID.ToString();
                this.lblUserName.Text   = UserInfo.UserName;
                this.lblUserStatus.Text = Enum.GetName(typeof(UserStatusEnum), UserInfo.Status);
                this.lblFullName.Text   = UserInfo.full_name;
                #endregion

                if (UsersAmt != null)
                {
                    #region 用户余额
                    decimal balanceAmt = 0M, freezeAmt = 0M, withdrawingAmt = 0M, detentionAmt = 0M;

                    balanceAmt     = UsersAmt.Balance;
                    freezeAmt      = UsersAmt.Freeze;
                    withdrawingAmt = UsersAmt.Unpayment;

                    detentionAmt = viviapi.BLL.Finance.Trade.GetUserTotalDetentionAmt(UserInfo.ID);

                    balanceAmt = balanceAmt - freezeAmt - withdrawingAmt - detentionAmt;

                    if (balanceAmt < 0M)
                    {
                        balanceAmt = 0M;
                    }

                    lblTotalBalance.Text   = (UsersAmt.Balance).ToString("f2");
                    lblWithdrawingAmt.Text = withdrawingAmt.ToString("f2");
                    lblFreezeAmt.Text      = freezeAmt.ToString("f2");
                    lblBalance.Text        = (balanceAmt).ToString("f2");

                    lblDeposit.Text = detentionAmt.ToString("f2");
                    #endregion
                }

                if (MSettlementAccount != null)
                {
                    #region 结算账号
                    lblStlAcctAccoutType.Text = viviapi.BLL.User.SettlementAccount.GetAccoutTypeName(MSettlementAccount.AccoutType);
                    lblStlAcctPayee.Text      = MSettlementAccount.PayeeName;
                    lblStlAcctBank.Text       = MSettlementAccount.PayeeBank;

                    if (MSettlementAccount.Pmode == 1)
                    {
                        lblSetAcctBankAddress.Text = MSettlementAccount.BankProvince + MSettlementAccount.BankCity + " " + MSettlementAccount.BankAddress;
                    }
                    this.lblStlAcctBankAccout.Text = MSettlementAccount.Account;
                    #endregion
                }
            }

            if (ItemInfo.ID > 0)
            {
                lblTranno.Text         = ItemInfo.Tranno;
                this.lblsettleAmt.Text = ItemInfo.Amount.ToString("f2");
                this.lblAddTime.Text   = FormatConvertor.DateTimeToTimeString(ItemInfo.Addtime);

                lblPayeeName.Text = ItemInfo.PayeeName;
                lblBank.Text      = ItemInfo.PayeeBank;

                lblPayeeaddress.Text = ItemInfo.BankProvince + ItemInfo.BankCity + " " + ItemInfo.Payeeaddress;

                lblAccount.Text = ItemInfo.Account;

                ChargesBox.Text = ItemInfo.Charges.ToString("f2");


                if (ItemInfo.Status != WithdrawStatus.Paying)
                {
                    this.TaxBox.Enabled      = false;
                    this.TaxBox.ReadOnly     = true;
                    this.ChargesBox.Enabled  = false;
                    this.ChargesBox.ReadOnly = true;
                    this.btnSure.Text        = "已支付";
                    this.btnSure.Enabled     = false;
                }
                if (action == "pay")
                {
                    btnSure.Visible = true;
                    btnSave.Visible = false;
                }
                else if (action == "modi")
                {
                    btnSure.Visible = false;
                    btnSave.Visible = true;
                }
            }
        }
Esempio n. 9
0
 public FitRunner(IEnumerable <string> assemblies, IEnumerable <string> namespaces)
 {
     this.assemblies = assemblies;
     this.namespaces = namespaces;
     convertor       = new FormatConvertor();
 }
Esempio n. 10
0
        /// <summary>
        ///
        /// </summary>
        private void WithdrawApply()
        {
            string msg = "";

            try
            {
                if (!SettleSettings.OpenWithdraw)
                {
                    msg = SettleSettings.ColseWithdrawReason;
                }
                else
                {
                    //提现金额
                    decimal          dwithdrawAmt = 0M, charges = 0M;
                    TocashSchemeInfo scheme = null;

                    string withdrawAmt = txtApplyMoney.Value.ToLower();
                    string safepass    = txtcashpwd.Text;

                    if (string.IsNullOrEmpty(withdrawAmt))
                    {
                        msg = "请输入您要提现的金额";
                    }
                    else if (!decimal.TryParse(withdrawAmt, out dwithdrawAmt))
                    {
                        msg = "请输入您正确的金额";
                    }
                    else if (string.IsNullOrEmpty(safepass))
                    {
                        msg = "请输入您的提现密码";
                    }
                    else if (Cryptography.MD5(safepass) != CurrentUser.Password2)
                    {
                        msg = "提现密码不正确";
                    }
                    else
                    {
                        scheme = TocashScheme.GetModelByUser(1, UserId);

                        if (scheme == null)
                        {
                            msg = "未设置提现方案,请联系客服人员!";
                        }
                        else
                        {
                            #region 比较余额
                            //账户可用余额
                            decimal balanceAmt = viviapi.BLL.User.UsersAmt.GetUserAvailableBalance(UserId);

                            if (dwithdrawAmt > balanceAmt)
                            {
                                msg = "余额不足,请修改提现金额";
                            }
                            else if (dwithdrawAmt < scheme.minamtlimitofeach)
                            {
                                msg = "您的提现金额小于最低提现金额限制.";
                            }
                            else if (dwithdrawAmt > scheme.maxamtlimitofeach)
                            {
                                msg = "您的提现金额大于最大提现金额限制.";
                            }
                            else
                            {
                                int todaytimes = viviapi.BLL.Finance.Withdraw.Instance.GetUserDaySettledTimes(UserId,
                                                                                                              FormatConvertor.DateTimeToDateString(DateTime.Now));

                                if (todaytimes >= scheme.dailymaxtimes)
                                {
                                    msg = "您今天的提现次数已达到最多限制,请明天再试。";
                                }
                                else
                                {
                                    decimal todayAmt = viviapi.BLL.Finance.Withdraw.Instance.GetUserDaySettledAmt(UserId,
                                                                                                                  FormatConvertor.DateTimeToDateString(DateTime.Now));

                                    if (todayAmt + dwithdrawAmt >= scheme.dailymaxamt)
                                    {
                                        msg = string.Format("您今天的提现将超过最大限额,你最多还可提现{0:f2}", scheme.dailymaxamt - todayAmt);
                                    }
                                }
                            }

                            if (string.IsNullOrEmpty(msg))
                            {
                                #region 计算手续费
                                charges = scheme.chargerate * dwithdrawAmt;
                                if (scheme.lowerLimit > 0)
                                {
                                    if (charges < scheme.lowerAmt)
                                    {
                                        charges = scheme.lowerAmt;
                                    }
                                }
                                if (scheme.upperLimit > 0)
                                {
                                    if (charges > scheme.upperAmt)
                                    {
                                        charges = scheme.upperAmt;
                                    }
                                }
                                #endregion

                                if (charges >= dwithdrawAmt)
                                {
                                    msg = "余额不足";
                                }
                            }
                            #endregion

                            if (string.IsNullOrEmpty(msg))
                            {
                                #region 保存记录
                                var acctBLL           = new viviapi.BLL.User.SettlementAccount();
                                var settlementAccount = acctBLL.GetModel(this.UserId);

                                if (settlementAccount != null)
                                {
                                    var itemInfo = new Withdraw()
                                    {
                                        Tranno  = viviapi.BLL.Finance.Withdraw.Instance.GenerateOrderId(),
                                        Addtime = DateTime.Now,
                                        Amount  = dwithdrawAmt,
                                        Charges = charges,
                                        Paytime = DateTime.Now,
                                        Status  = WithdrawStatus.Auditing,
                                        Tax     = 0M,
                                        Userid  = UserId,


                                        BankCode  = settlementAccount.BankCode,
                                        PayeeBank = settlementAccount.PayeeBank,

                                        ProvinceCode = settlementAccount.ProvinceCode,
                                        BankProvince = settlementAccount.BankProvince,

                                        CityCode     = settlementAccount.CityCode,
                                        BankCity     = settlementAccount.BankCity,
                                        Payeeaddress = settlementAccount.BankAddress,


                                        PayeeName  = settlementAccount.PayeeName,
                                        AccoutType = settlementAccount.AccoutType,
                                        Account    = settlementAccount.Account,
                                        Paytype    = settlementAccount.Pmode,
                                        Settmode   = WithdrawMode.Manual,
                                        Required   = DateTime.Now.AddHours(2),
                                        Suppstatus = 0
                                    };

                                    if (DateTime.Now.Hour > 16)
                                    {
                                        itemInfo.Required = DateTime.Now.AddDays(1);
                                    }

                                    if (scheme.vaiInterface > 0)
                                    {
                                        itemInfo.SuppId     = chnlBLL.GetSupplier(itemInfo.BankCode);
                                        itemInfo.Suppstatus = 1;
                                    }

                                    int result = viviapi.BLL.Finance.Withdraw.Instance.Apply(itemInfo);
                                    itemInfo.ID = result;
                                    if (result > 0)
                                    {
                                        msg = "提现成功";

                                        #region 通过接口提现
                                        if (itemInfo.Suppstatus == 1 &&
                                            itemInfo.SuppId > 0 &&
                                            scheme.tranRequiredAudit == 0)
                                        {
                                            bool audit = viviapi.BLL.Finance.Withdraw.Instance.Audit(itemInfo.Tranno
                                                                                                     , DateTime.Now.ToString("yyyyMMddHHmmssfff")
                                                                                                     , 1
                                                                                                     , "自动确认");

                                            if (audit)
                                            {
                                                viviapi.ETAPI.Common.Withdrawal.InitDistribution(itemInfo);
                                            }
                                        }
                                        #endregion
                                    }
                                    else
                                    {
                                        msg = "提现失败";
                                    }
                                }
                                else
                                {
                                    msg = "未设置结算账户";
                                }



                                #endregion
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                msg = exception.Message;
            }

            lblMessage.Text = msg;

            string email     = System.Web.Configuration.WebConfigurationManager.AppSettings["SysEmail"];
            string useNotice = System.Web.Configuration.WebConfigurationManager.AppSettings["UseEmailNotice"];
            if (useNotice == "1")
            {
                var emailcom = new EmailSender(email
                                               , "提现通知"
                                               , "ID为" + UserId + "的用户正在申请提现,操作状态:" + msg
                                               , true
                                               , System.Text.Encoding.GetEncoding("gbk"));
                emailcom.Send();
            }
        }
Esempio n. 11
0
 /// <summary>
 /// 计划任务执行日志路径。
 /// </summary>
 /// <param name="date">日期。</param>
 /// <param name="config">配置值。</param>
 /// <returns>完整路径。</returns>
 public static string ScheduleTaskLogFilePath(DateTime date, ScheduledTaskConfiguration config)
 {
     return(AppDomain.CurrentDomain.BaseDirectory + "LogFiles/ScheduleTask/" + FormatConvertor.DateTimeToDateString(date, true) + ".log");
 }
Esempio n. 12
0
 /// <summary>
 /// 计划任务执行日志路径。
 /// </summary>
 /// <param name="date">日期。</param>
 /// <returns>完整路径。</returns>
 public static string ScheduleTaskExecuteLogFilePath(DateTime date)
 {
     return(AppDomain.CurrentDomain.BaseDirectory + "LogFiles/ScheduleTask/" + FormatConvertor.DateTimeToDateString(date, true) + "_execute.log");
 }
Esempio n. 13
0
        private async System.Threading.Tasks.Task HandleIncomingBotMessagesAsync(IList <Activity> botReplies, string callSid)
        {
            var voiceResponse    = new VoiceResponse();
            var says             = new StringBuilder();
            var forwardingNumber = string.Empty;
            var forward          = false;
            var error            = false;
            var errorMessage     = string.Empty;

            foreach (var activity in botReplies)
            {
                var languagesManager = new LanguagesManager();
                var localeCulture    = languagesManager.CheckAndReturnAppropriateCulture(activity.Locale);
                CultureInfo.CurrentCulture = new CultureInfo(localeCulture);

                //Using TTS to repond to the caller
                var ttsResponse = await System.Threading.Tasks.Task.Run(() =>
                                                                        _textToSpeech.TransformTextToSpeechAsync(activity.Text, CultureInfo.CurrentCulture.Name));

                var wavGuid = Guid.NewGuid();
                var pathToAudioDirectory = _hostingEnvironment.WebRootPath + "/audio";
                var pathCombined         = Path.Combine(pathToAudioDirectory, $"{ wavGuid }.wav");
                var formatConverter      = new FormatConvertor();
                await formatConverter.TurnAudioStreamToFile(ttsResponse, pathCombined);

                voiceResponse.Play(new Uri($"{_directlineConfig.Host}audio/{wavGuid}.wav"));

                if (activity.Entities != null)
                {
                    foreach (var entity in activity.Entities)
                    {
                        forward          = entity.Properties.TryGetValue("forward", out var numberJToken);
                        forwardingNumber = forward ? numberJToken.ToString() : string.Empty;

                        error = entity.Properties.TryGetValue("error", out var errorMessageJToken);
                        if (error)
                        {
                            break;
                        }
                    }
                }
            }

            if (error)
            {
                voiceResponse.Hangup();
            }
            else if (forward)
            {
                voiceResponse.Dial(number: forwardingNumber);
            }
            else
            {
                voiceResponse.Gather(
                    input: new List <Gather.InputEnum> {
                    Gather.InputEnum.Speech
                },
                    language: CultureInfo.CurrentCulture.Name,
                    action: new Uri($"{_directlineConfig.Host}api/voice/send"),
                    method: HttpMethod.Get,
                    speechTimeout: "auto",
                    hints: _hints
                    );
            }

            var xmlFileName        = Guid.NewGuid();
            var pathToXMLDirectory = _hostingEnvironment.WebRootPath + "/xml";

            System.IO.File.WriteAllText($"{pathToXMLDirectory}/{xmlFileName}.xml", voiceResponse.ToString());

            CallResource.Update(
                method: HttpMethod.Get,
                url: new Uri($"{_directlineConfig.Host}xml/{xmlFileName}.xml"),
                pathSid: callSid
                );
        }
Esempio n. 14
0
        /// <summary>
        /// 写执行日志文件。
        /// </summary>
        /// <param name="config">配置信息。</param>
        public static void WriteLog(ScheduledTaskConfiguration config)
        {
            if ((config != null) && LogSetting.ScheduledTaskLogEnabled)
            {
                try
                {
                    string str = string.Format("Task\t\t\t\t= {0}\r\nTime              = {1}", config.ScheduledTaskType, FormatConvertor.DateTimeToTimeString(DateTime.Now, true));
                    // LogHelper.Write(LogSetting.ScheduleTaskLogFilePath(DateTime.Today, config), str);

                    log.Info(str);
                }
                catch (Exception exception)
                {
                    ExceptionHandler.HandleException(exception);
                }
            }
        }