private void DataArchive(object parameter)
        {
            if (SelectMonth == 0)
            {
                MessageBoxHelper.MessageBoxShowWarning("请选择归档的月份!");
                return;
            }

            string    sql = "select * from sys_key_value_setting where KeyID='AutoArchiveDaysBefore'";
            DataTable dt  = MySqlHelper.ExecuteDataset(EnvironmentInfo.ConnectionString, sql).Tables[0];

            if (dt.Rows.Count > 0 && this.AutoArchive)
            {
                if (MessageBoxHelper.MessageBoxShowQuestion("当前版本已经支持自动归档,是否继续配置?") == MessageBoxResult.No)
                {
                    this.AutoArchive  = false;
                    this.ManulArchive = true;
                    return;
                }
            }

            if (this.AutoArchive)
            {
                //ConfigHelper.WriterAppConfig("AutoArchive", "1");
                keyValueSettingManager.WriteSetting(new KeyValueSetting()
                {
                    KeyId = "AutoArchive", ValueText = "1"
                });
                EnvironmentInfo.IsAutoArchive = true;
                Notice.Show("数据归档任务将于每晚2点执行...", "通知", 3, MessageBoxIcon.Success);
            }
            else
            {
                //ConfigHelper.WriterAppConfig("AutoArchive", "0");
                keyValueSettingManager.WriteSetting(new KeyValueSetting()
                {
                    KeyId = "AutoArchive", ValueText = "0"
                });
                EnvironmentInfo.IsAutoArchive = false;

                ConfigHelper.WriterAppConfig("AutoArchiveMonth", SelectMonth.ToString());
                EnvironmentInfo.AutoArchiveMonth = SelectMonth;
                if (dt.Rows.Count == 0 && MessageBoxHelper.MessageBoxShowQuestion("使用工具归档后,数据在报表中不能查询,请确认是否继续归档?") == MessageBoxResult.Yes)
                {
                    Task.Factory.StartNew(() =>
                    {
                        ExecuteDataArchive dataArchive = new ExecuteDataArchive();
                        dataArchive.Execute();
                    });
                }
                else if (dt.Rows.Count > 0)
                {
                    Task.Factory.StartNew(() =>
                    {
                        ExecuteDataArchive dataArchive = new ExecuteDataArchive();
                        dataArchive.Execute();
                    });
                }
            }
        }
Пример #2
0
 protected override void RunCommand()
 {
     try
     {
         this.fpxfMain = new FpxfMain();
         if ((this.fpxfMain.xfThrad == null) || !this.fpxfMain.xfThrad.IsAlive)
         {
             SelectMonth.IsChaxun = false;
             SelectMonth.IsSingle = false;
             dlgSelectMonth       = new SelectMonth();
             dlgSelectMonth.Text  = "发票修复";
             if (DialogResult.OK == dlgSelectMonth.ShowDialog())
             {
                 this.fpxfMain.XFYear         = dlgSelectMonth.Year;
                 this.fpxfMain.XFMonth        = dlgSelectMonth.Month;
                 this.fpxfMain.XFFpdm         = SelectMonth.FPDM;
                 this.fpxfMain.XFFPHM         = SelectMonth.FPHM;
                 this.fpxfMain.IsSingle       = SelectMonth.IsSingle;
                 this.fpxfMain.XFIsShowDialog = true;
                 if (dlgSelectMonth != null)
                 {
                     dlgSelectMonth.Close();
                     dlgSelectMonth.Dispose();
                     dlgSelectMonth = null;
                 }
                 this.fpxfMain.ShowDialog();
                 this.fpxfMain.AutoEvent.WaitOne();
             }
             if (this.fpxfMain != null)
             {
                 this.fpxfMain.DisposeFormThread(this.fpxfMain);
                 this.fpxfMain = null;
             }
             this.loger.Error("发票修复线程运行结束,所有资源释放结束");
         }
     }
     catch (Exception exception)
     {
         this.loger.Error(exception.Message);
         MessageManager.ShowMsgBox(exception.Message);
     }
 }
Пример #3
0
 //method to fill register form
 public IWebElement Register(string fname, string lname, int date, string month, int year, string email, string passwrd)
 {
     TxtFirstName.SendKeys(fname);
     TxtLastName.SendKeys(lname);
     SelectDay.SendKeys(date.ToString());
     SelectMonth.SendKeys(month);
     SelectYear.SendKeys(year.ToString());
     TxtEmail.SendKeys(email);
     TxtPasswrd.SendKeys(passwrd);
     TxtConfirmPasswrd.SendKeys(passwrd);
     BtnRegister.Click();
     Console.WriteLine("Registering using MyAccountPage.Register");
     try
     {
         BtnContinue = PropertiesCollection.Driver.FindElement(By.Name("register-continue"));
     }
     catch (OpenQA.Selenium.NoSuchElementException)
     {
         BtnContinue = null;
     }
     Console.WriteLine(BtnContinue);
     return(BtnContinue);
 }
Пример #4
0
 public BaseForm RunCommand()
 {
     try
     {
         bMainExit = false;
         if ((fpcx == null) || !fpcx.HasShow())
         {
             dlgSelectMonth = new SelectMonth();
             if (DialogResult.OK == dlgSelectMonth.ShowDialog())
             {
                 int month = dlgSelectMonth.Month;
                 int year  = dlgSelectMonth.Year;
                 FaPiaoChaXun.CardClock = dlgSelectMonth.CardClock;
                 fpcx = new FaPiaoChaXunShow();
                 if (fpcx == null)
                 {
                     return(null);
                 }
                 fpcx.TabText = "选择发票号码查询";
                 fpcx.Text    = "选择发票号码查询";
                 fpcx.Month   = month;
                 fpcx.Year    = year;
                 fpcx.Edit(FaPiaoChaXun.EditFPCX.ChaXun);
                 fpcx.Closing += new CancelEventHandler(this.fpcx_Closing);
                 FormMain.ExecuteBeforeExitEvent += runexit;
                 return(fpcx);
             }
         }
         return(null);
     }
     catch (Exception exception)
     {
         this.loger.Error(exception.Message);
         return(null);
     }
 }
        public void ValidateSignIn(UserDto user)
        {
            Helper.ScrollToSeeTheRightButton(_driver, CreateAccountButton);
            EmailField.Click();
            var emailAddressValue = user.GetType().GetRuntimeProperty("emailAddress").GetValue(user);

            if (emailAddressValue != null)
            {
                EmailField.SendKeys(emailAddressValue.ToString());
            }
            CreateAccountButton.Click();
            Thread.Sleep(4000);

            Helper.ScrollToSeeTheRightButton(_driver, PersonalInformationTitleRadioButton);
            PersonalInformationTitleRadioButton.Click();

            PersonalInformationFirstNameField.Click();
            var firstNameValue = user.GetType().GetRuntimeProperty("firstName").GetValue(user);

            if (firstNameValue != null)
            {
                PersonalInformationFirstNameField.SendKeys(firstNameValue.ToString());
            }

            PersonalInformationLastNameField.Click();
            var lastNameValue = user.GetType().GetRuntimeProperty("lastName").GetValue(user);

            if (lastNameValue != null)
            {
                PersonalInformationLastNameField.SendKeys(lastNameValue.ToString());
            }

            PersonalInformationPasswordField.Click();
            var passwordValue = user.GetType().GetRuntimeProperty("password").GetValue(user);

            if (passwordValue != null)
            {
                PersonalInformationPasswordField.SendKeys(passwordValue.ToString());
            }

            SelectDayBox.Click();
            SelectDay.Click();
            SelectMonthBox.Click();
            SelectMonth.Click();
            SelectYearsBox.Click();
            SelectYear.Click();

            Helper.ScrollToSeeTheRightButton(_driver, AdressAddressField);
            Thread.Sleep(1000);
            AdressAddressField.Click();
            var adressAddressField = user.GetType().GetRuntimeProperty("address").GetValue(user);

            if (adressAddressField != null)
            {
                AdressAddressField.SendKeys(adressAddressField.ToString());
            }

            Thread.Sleep(1000);
            AdressCityField.Click();
            var adressCityField = user.GetType().GetRuntimeProperty("city").GetValue(user);

            if (adressCityField != null)
            {
                AdressCityField.SendKeys(adressCityField.ToString());
            }

            Thread.Sleep(1000);
            AdressStateDropdown.Click();
            AdressState.Click();

            Thread.Sleep(1000);

            AdressPostcodeField.Click();
            var adressPostcodeField = user.GetType().GetRuntimeProperty("postcode").GetValue(user);

            if (adressPostcodeField != null)
            {
                AdressPostcodeField.SendKeys(adressPostcodeField.ToString());
            }

            Thread.Sleep(1000);
            AdressMobilePhoneField.Click();
            var adressMobilePhoneField = user.GetType().GetRuntimeProperty("mobilePhone").GetValue(user);

            if (adressMobilePhoneField != null)
            {
                AdressMobilePhoneField.SendKeys(adressMobilePhoneField.ToString());
            }

            Thread.Sleep(1000);
            AdressAliasField.Clear();
            var adressAliasField = user.GetType().GetRuntimeProperty("alias").GetValue(user);

            if (adressAliasField != null)
            {
                AdressAliasField.SendKeys(adressAliasField.ToString());
            }

            Helper.ScrollToSeeTheRightButton(_driver, RegisterButton);
            RegisterButton.Click();
        }