Beispiel #1
0
        public override void AfterButtonClick(AfterButtonClickEventArgs e)
        {
            base.AfterButtonClick(e);
            string key = e.Key.ToUpperInvariant();

            switch (key)
            {
            case "FSYNCBTN":     //FSyncBtn
                if (mBtnLock)
                {
                    this.View.ShowMessage("[数据获取中...]此操作比较耗时,请勿频繁操作!");
                    return;
                }
                this.View.ShowMessage("确定进行数据的获取吗?\n提醒:此过程可能较为耗时,需要耐心等待!", MessageBoxOptions.YesNo, (result) =>
                {
                    if (result == MessageBoxResult.Yes)
                    {
                        mBtnLock    = true;
                        string from = this.Model.GetValue("FFromDt").ToString();
                        string to   = this.Model.GetValue("FToDt").ToString();
                        if (DateTime.Parse(to).CompareTo(DateTime.Parse(from)) <= 0)
                        {
                            this.View.ShowMessage("截止时间需要大于开始时间!");
                            return;
                        }
                        string FLog = "";
                        this.Model.SetValue("FLog", FLog);
                        SignInSyncUtils req = new SignInSyncUtils(this.Context);
                        //var that = this;
                        req.InsertDataWithinDate(from, to, (msg) => {
                            FLog += msg + "\n";
                        });
                        this.Model.SetValue("FLog", FLog);
                        mBtnLock = false;
                        this.View.ShowMessage("数据获取完成");
                    }
                });

                break;
            }
        }
Beispiel #2
0
        public void Run(Context ctx, Schedule schedule)
        {
            DateTime now  = DateTime.Now;
            string   from = "";
            string   to   = "";

            if (now.Day == 1)
            {
                int fromYear  = now.Month == 1 ? now.Year - 1 : now.Year;
                int fromMonth = now.Month == 1 ? 12 : now.Month - 1;
                from = string.Format("{0}-{1}-01", fromYear, fromMonth);
                to   = string.Format("{0}-{1}-01", now.Year, now.Month);
            }
            else
            {
                from = string.Format("{0}-{1}-01", now.Year, now.Month);
                to   = now.ToString();
            }
            var req = new SignInSyncUtils(ctx);

            req.InsertDataWithinDate(from, to);
        }