Ejemplo n.º 1
0
        //作成月がNullの場合は今月の月を挿入
        private void Lost_Month(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(作成年))
            {
                string   Date;
                int      iDate;
                DateTime YYYY;
                YYYY  = DateTime.Today;
                Date  = Convert.ToString(YYYY);
                Date  = Date.Substring(0, 4);
                iDate = Convert.ToInt32(Date);
                作成年   = iDate.ToString();
            }

            if (string.IsNullOrEmpty(作成月))
            {
                string   Date;
                int      iDate;
                DateTime MM;
                MM    = DateTime.Today;
                Date  = Convert.ToString(MM);
                Date  = Date.Substring(5, 2);
                iDate = Convert.ToInt32(Date);
                作成月   = iDate.ToString();
            }

            if (!string.IsNullOrEmpty(作成締日))
            {
                int?換締日 = Convert.ToInt32(作成締日);
                if (換締日 < 31)
                {
                    string   Date = 作成年.ToString() + "/" + 作成月.ToString() + "/" + 01;
                    DateTime CheckDate;
                    if (!DateTime.TryParse(Date, out CheckDate))
                    {
                        return;
                    }
                    DateTime 作成年月 = Convert.ToDateTime(Date);
                    DateTime YYY, DDD, Test;
                    int      itest, i作成締日;
                    YYY = 作成年月.AddMonths(-1);
                    string test  = YYY.ToString();
                    string test2 = test;
                    Test = Convert.ToDateTime(test).AddMonths(+1).AddDays(-1);
                    string test3 = Test.ToString().Substring(8, 2);
                    itest = Convert.ToInt32(test3);
                    i作成締日 = Convert.ToInt32(作成締日);
                    if (itest < i作成締日)
                    {
                        test     = test.Substring(0, 7);
                        test     = test + "/" + itest;
                        YYY      = Convert.ToDateTime(test).AddDays(+1);
                        DDD      = YYY.AddMonths(+1).AddDays(-1);
                        集計期間From = YYY;
                        集計期間To   = DDD;
                    }
                    else
                    {
                        test     = test.Substring(0, 7);
                        test     = test + "/" + i作成締日.ToString();
                        YYY      = Convert.ToDateTime(test).AddDays(+1);
                        DDD      = Convert.ToDateTime(test).AddMonths(+1);
                        集計期間From = YYY;
                        集計期間To   = DDD;
                    }
                }
                else if (換締日 == 31)
                {
                    string   Date = 作成年.ToString() + "/" + 作成月.ToString() + "/" + 01;
                    DateTime CheckDate;
                    if (!DateTime.TryParse(Date, out CheckDate))
                    {
                        return;
                    }
                    DateTime YYY, DDD;
                    YYY      = Convert.ToDateTime(Date);
                    DDD      = Convert.ToDateTime(Date);
                    DDD      = DDD.AddMonths(+1).AddDays(-1);
                    集計期間From = YYY;
                    集計期間To   = DDD;
                }
            }
        }
Ejemplo n.º 2
0
 private void Kikan_Keisan()
 {
     if (作成年 < 2 || (作成月 < 1 || 作成月 > 12) || (作成締日 < 1 || 作成締日 > 31))
     {
         this.ErrorMessage = "入力値エラーです。もう一度入力してください。";
         MessageBox.Show("入力値エラーです。もう一度入力してください。");
         SetFocusToTopControl();
         ReturnValue = 0;
         return;
     }
     else
     {
         if (作成締日 < 31)
         {
             string   Date = 作成年.ToString() + "/" + 作成月.ToString() + "/" + 01;
             DateTime 作成年月 = Convert.ToDateTime(Date);
             DateTime YYY, DDD, Test;
             int      itest, i作成締日;
             YYY = 作成年月.AddMonths(-1);
             string test  = YYY.ToString();
             string test2 = test;
             Test = Convert.ToDateTime(test).AddMonths(+1).AddDays(-1);
             string test3 = Test.ToString().Substring(8, 2);
             itest = Convert.ToInt32(test3);
             i作成締日 = Convert.ToInt32(作成締日);
             if (itest < i作成締日)
             {
                 test     = test.Substring(0, 7);
                 test     = test + "/" + itest;
                 YYY      = Convert.ToDateTime(test).AddDays(+1);
                 DDD      = YYY.AddMonths(+1).AddDays(-1);
                 集計期間From = YYY;
                 集計期間To   = DDD;
             }
             else
             {
                 test     = test.Substring(0, 7);
                 test     = test + "/" + i作成締日.ToString();
                 YYY      = Convert.ToDateTime(test).AddDays(+1);
                 DDD      = Convert.ToDateTime(test).AddMonths(+1);
                 集計期間From = YYY;
                 集計期間To   = DDD;
             }
         }
         else if (作成締日 == 31)
         {
             string   Date = 作成年.ToString() + "/" + 作成月.ToString() + "/" + 01;
             DateTime YYY, DDD;
             YYY      = Convert.ToDateTime(Date);
             DDD      = Convert.ToDateTime(Date);
             DDD      = DDD.AddMonths(+1).AddDays(-1);
             集計期間From = YYY;
             集計期間To   = DDD;
         }
         if (集計期間From == null || 集計期間To == null)
         {
             ReturnValue = 0;
         }
         else
         {
             DateTime Wk;
             DateTime p集計期間To, p集計期間From;
             p集計期間To     = DateTime.TryParse(集計期間To.ToString(), out Wk) ? Wk : DateTime.Today;
             p集計期間From   = DateTime.TryParse(集計期間From.ToString(), out Wk) ? Wk : DateTime.Today;
             ReturnValue = 1;
             TimeSpan span = p集計期間To - p集計期間From;
             期間日数 = span.Days;
         }
     }
 }
Ejemplo n.º 3
0
        public GFUForm()
        {
            System.Threading.ThreadPool.SetMaxThreads(200, 200);

            semConn = new System.Threading.Semaphore(2, 2);

            string p = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GFU";

            try
            {
                Directory.CreateDirectory(p);
            }
            catch
            {
            }


            if (!Directory.Exists(p))
            {
                MessageBox.Show(this, "Unable to create Application Data folder: \n\n" + p, "Cannot start",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }



            try
            {
                InitializeComponent();
            }
            catch (Exception XXX)
            {
                MessageBox.Show(this, "Exception Caught:\n" + XXX.Message + "\n\n" + XXX.ToString(), "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            if (Properties.Settings.Default.IPAddress != "")
            {
                txtIP.Text   = Properties.Settings.Default.IPAddress;
                txtPwd.Text  = Properties.Settings.Default.Password;
                txtUser.Text = Properties.Settings.Default.UserName;
            }


            try
            {
                ckFlash.Checked   = true;
                ckGemini.Checked  = true;
                ckHC.Checked      = true;
                ckCat.Checked     = false;
                chkVideos.Checked = false;

                cbZip.Sorted = true;
                var      path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\GFU";
                string[] Zips = Directory.GetFiles(path, "*.zip");
                cbZip.Items.AddRange(Zips);

                cbZip.Items.AddRange(http_links);
                cbZip.SelectedIndex = cbZip.FindString("http://www.gemini-2.com/firmware1/current/combined.zip", 0);
            }
            catch (Exception YYY)
            {
                MessageBox.Show(this, "Exception Caught:\n" + YYY.Message + "\n\n" + YYY.ToString(), "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            lblVer.Text = "v" + Application.ProductVersion;

            tmTimer.Tick    += new EventHandler(tmTimer_Tick);
            tmTimer.Interval = 500;
        }