Exemple #1
0
        /// <summary>
        /// カレンダーセルのクリックイベント
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CalendarGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                //修正
                if (e.RowIndex >= 0 && e.ColumnIndex == COL_修正.Index)
                {
                    switch (CalendarGrid.Rows[e.RowIndex].Cells[COL_CALENDARTYPE.Index].Value)
                    {
                    case CalendarType.固定カレンダー:
                    {
                        CalendarEditForm form = new CalendarEditForm();
                        //nullは新規作成
                        form.Init(int.Parse("" + CalendarGrid.Rows[e.RowIndex].Cells[COL_ID.Index].Value));
                        form.ShowDialog(this);
                    }
                    break;

                    default:
                    {
                        WebCalendarEditForm form = new WebCalendarEditForm();
                        //nullは新規作成
                        form.Init(int.Parse("" + CalendarGrid.Rows[e.RowIndex].Cells[COL_ID.Index].Value));
                        form.ShowDialog(this);
                    }
                    break;
                    }

                    LoadCalendarData();
                }
                //削除
                if (e.RowIndex >= 0 && e.ColumnIndex == COL_削除.Index)
                {
                    DialogResult result = this.ShowWarningDialog("カレンダーの削除の確認", "カレンダーを削除すると、利用中のプロジェクトに障害が発生する可能性がありますが、続行しますか?", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button1);

                    if (result == DialogResult.No)
                    {
                        return;
                    }

                    CalendarInfos.GetInstance().RemoveByKey(int.Parse("" + CalendarGrid.Rows[e.RowIndex].Cells[COL_ID.Index].Value));


                    this.ShowDialog("カレンダーの削除", "カレンダーを削除しました。");

                    LoadCalendarData();
                }
            }
            catch (Exception ex)
            {
                throw Program.ThrowException(ex);
            }
        }
Exemple #2
0
 /// <summary>
 /// カレンダー新規作成ボタンのクリックイベント
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void CreateCalendarButton_Click(object sender, EventArgs e)
 {
     try
     {
         CalendarEditForm form = new CalendarEditForm();
         //nullは新規作成
         form.Init(0);
         form.ShowDialog(this);
         LoadCalendarData();
     }
     catch (Exception ex)
     {
         throw Program.ThrowException(ex);
     }
 }