Пример #1
0
        public void Valid_GetFDInterestRateListYear()
        {
            DateTime lastYear = DateTime.Now.AddYears(-1);
            MainVM   mVM      = new MainVM();

            mVM.SelectedStartMonth = new FinModel.Model.Month(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(lastYear.Month), lastYear.Month);
            mVM.SelectedEndMonth   = new FinModel.Model.Month(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(DateTime.Now.Month), DateTime.Now.Month);
            mVM.SelectedStartYear  = lastYear.Year;
            mVM.SelectedEndYear    = DateTime.Now.Year;
            mVM.GetFDInterestRateList();
            Assert.AreEqual(true, mVM.FDInterestRateList.Count > 0);
        }
Пример #2
0
        public MainWindow()
        {
            InitializeComponent();

            try
            {
                if (App.Args != null)
                {
                    String[] args = App.Args;

                    if (args.Count() == 2)
                    {
                        string startDate = args[0];
                        int    sindex    = startDate.IndexOf("-");
                        string yr1       = (sindex > 0 ? startDate.Substring(0, sindex) : "0");
                        string mn1       = (sindex > 0 ? startDate.Substring(sindex + 1, startDate.Length - 1 - sindex) : "0");

                        string endDate = args[1];
                        int    eindex  = endDate.IndexOf("-");
                        string yr2     = (eindex > 0 ? endDate.Substring(0, eindex) : "0");
                        string mn2     = (eindex > 0 ? endDate.Substring(eindex + 1, endDate.Length - 1 - eindex) : "0");


                        mainVM = new MainVM();
                        mainVM.SelectedStartMonth = new FinModel.Model.Month(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(Convert.ToInt32(mn1)), Convert.ToInt32(mn1));
                        mainVM.SelectedEndMonth   = new FinModel.Model.Month(CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(Convert.ToInt32(mn2)), Convert.ToInt32(mn2));
                        mainVM.SelectedStartYear  = Convert.ToInt32(yr1);
                        mainVM.SelectedEndYear    = Convert.ToInt32(yr2);
                        mainVM.GetFDInterestRateList();
                    }
                }
                if (mainVM == null)
                {
                    mainVM = new MainVM();
                }
                DataContext = mainVM;
            }
            catch (Exception e)
            {
                Console.WriteLine("Error:" + e.Message);
            }
        }
Пример #3
0
 private void button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var startDate = new DateTime(mainVM.SelectedStartYear, mainVM.SelectedStartMonth.monthNumber, 1);
         var endDate   = new DateTime(mainVM.SelectedEndYear, mainVM.SelectedEndMonth.monthNumber, 1);
         if (startDate <= endDate)
         {
             mainVM.GetFDInterestRateList();
         }
         else
         {
             MessageBox.Show("Invalid date range!");
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Error:" + ex.Message);
     }
 }