Пример #1
0
 // "ADD" button click Event.
 private void button_addSch_Click(object sender, EventArgs e)
 {
     addForm = new DataAddForm(label_DateTemp, this, false);
     addForm.gboxSetting(gbox[gbox_index]);
     addForm.setDbConnect(dbConnect);
     addForm.Show();
 }
        // ADD, MODIFY, DELETE click check Event.
        private void AddFormDisposedCheckEvent(object sender, EventArgs e)
        {
            if (sender.Equals(button_addSch) || sender.Equals(button_modifySch) || sender.Equals(button_deleteSch))
            {
                if (addForm != null && addForm.IsDisposed)
                {
                    addForm = null;
                }
                if (addForm != null)
                {
                    return;
                }

                if (sender.Equals(button_addSch))
                {
                    AddButtonClickProcess(true);
                }
                else if (sender.Equals(button_modifySch))
                {
                    ModifyButtonClickProcess(true);
                }
                else if (sender.Equals(button_deleteSch))
                {
                    DeleteButtonClickProcess(true);
                }
            }

            else if (sender.Equals(button_today_add) || sender.Equals(button_today_modify) || sender.Equals(button_today_delete))
            {
                if (addForm_today != null && addForm_today.IsDisposed)
                {
                    addForm_today = null;
                }
                if (addForm_today != null)
                {
                    return;
                }

                if (sender.Equals(button_today_add))
                {
                    AddButtonClickProcess(false);
                }
                else if (sender.Equals(button_today_modify))
                {
                    ModifyButtonClickProcess(false);
                }
                else if (sender.Equals(button_today_delete))
                {
                    DeleteButtonClickProcess(false);
                }
            }
        }
        private void AddButtonClickProcess(bool isCalendar)
        {
            if (isCalendar)
            {
                addForm = new DataAddForm(label_DateTemp, this, connect[0], false);
                addForm.Show();
            }

            else
            {
                addForm_today = new TodayDataAddForm(this, connect[1], true);
                addForm_today.Show();
            }
        }
Пример #4
0
        // "Modify" button click Event.
        private void button_modifySch_Click(object sender, EventArgs e)
        {
            string[] datalist = new string[2];
            string   text     = listView_Schedule.SelectedItems[0].SubItems[1].Text.ToString();
            bool     actCheck = listView_Schedule.SelectedItems[0].SubItems[2].Text == "Y" ? true : false;

            datalist = listView_Schedule.SelectedItems[0].SubItems[0].Text.Split(':');

            addForm = new DataAddForm(label_DateTemp, this, true);
            addForm.gboxSetting(gbox[gbox_index]);
            addForm.setDbConnect(dbConnect);
            addForm.setSelectData(datalist, text, actCheck);
            addForm.Show();
        }
        private void ModifyButtonClickProcess(bool isCalendar)
        {
            if (isCalendar)
            {
                bool     actCheck = listView_Schedule.SelectedItems[0].SubItems[2].Text == "Y" ? true : false;
                string   text     = listView_Schedule.SelectedItems[0].SubItems[1].Text.ToString();
                string[] datalist = listView_Schedule.SelectedItems[0].SubItems[0].Text.Split(':');
                addForm = new DataAddForm(label_DateTemp, this, connect[0], true);
                addForm.SetSelectData(datalist, text, actCheck);
                addForm.Show();
            }

            else
            {
                addForm_today      = new TodayDataAddForm(this, connect[1], false);
                addForm_today.Text = "TodayDataAddForm(Modify)";
                addForm_today.PastDataSet(listView_todayList.SelectedItems[0].Text.ToString().Split(':'), listView_todayList.SelectedItems[0].SubItems[1].Text);
                addForm_today.Show();
            }
        }
Пример #6
0
        // main method.
        public CalendarMain()
        {
            InitializeComponent();
            alarm_onCheck = true;
            gbox          = new ListBox[42];
            addForm       = new DataAddForm(label_DateTemp, this, false);
            addForm_today = new TodayDataAddForm(this);


            // Database setting.
            dbConnect  = new SQLiteConnection("Data Source=" + path + dbFileName + ";Version=3;");
            dbConnect2 = new SQLiteConnection("Data Source=" + path + dbFileName2 + ";Version=3;");
            addForm.setDbConnect(dbConnect);
            addForm_today.setDbConnect(dbConnect2);

            if (!File.Exists(path + dbFileName))
            {
                dbCommand = new SQLiteCommand(QueryList.createTableSQL(), dbConnect);
                Directory.CreateDirectory(path);
                SQLiteConnection.CreateFile(path + dbFileName);
                MessageBox.Show("Created new calendar db.");
                dbConnect.Open();
                dbCommand.ExecuteNonQuery();
                dbConnect.Close();
            }

            if (!File.Exists(path + dbFileName2))
            {
                dbCommand2 = new SQLiteCommand(QueryList.createTableSQL_today(), dbConnect2);
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                SQLiteConnection.CreateFile(path + dbFileName2);
                MessageBox.Show("Created new today alarm db.");
                dbConnect2.Open();
                dbCommand2.ExecuteNonQuery();
                dbConnect2.Close();
            }



            tManager = new ThreadManager(label_Time, dbConnect, dbConnect2);    // Thread setting.
            dataview = new DataView(dbConnect, this);                           // DataView setting.


            // Panel setting.
            for (int count = 0; count < gbox.Length; count++)
            {
                gbox[count] = new ListBox();
            }

            // Current date setting.
            selectDay   = int.Parse(DateTime.Now.ToString("dd"));
            selectYear  = int.Parse(DateTime.Now.ToString("yyyy"));
            selectMonth = int.Parse(DateTime.Now.ToString("MM"));

            for (int row = 1, count = 0; row <= 6; row++)
            {
                for (int col = 0; col < 7; col++)
                {
                    panel_MonthList.Controls.Add(gbox[count], col, row); count++;
                }
            }

            label_DateTemp.Text  = selectYear.ToString() + "." + selectMonth.ToString() + "." + selectDay.ToString();
            label_YearMonth.Text = selectYear.ToString() + "." + selectMonth.ToString("00");
            changeCalendar();
            todayAlarmListRefresh();
        }