/// <summary>ダブルクリック時の処理
 /// </summary>
 /// <param name="sender">イベントの発生したオブジェクト</param>
 /// <param name="e">発生したイベント</param>
 private void BodyTable_CellMouseDoubleClick (object sender, DataGridViewCellMouseEventArgs e) {
     if (e.RowIndex >= 0) {
         CMember member = this.Members[e.RowIndex];
         switch (e.ColumnIndex) {
             case 0:
                 // メンバーの修正
                 TimeTableManager.UI.FMemberDialog dialogM = new TimeTableManager.UI.FMemberDialog();
                 dialogM.Member = member;
                 if (dialogM.ShowDialog(this.MainForm) == DialogResult.OK) {
                     Refresh();
                 }
                 break;
             case 1:
                 // シフトの修正
                 PatternWrapper wrapper = Member2PatternWrapper[member];
                 CPattern pattern = wrapper.Pattern;
                 if (pattern != null && !pattern.BuiltIn) {
                     TimeTableManager.UI.FPatternDialog dialogP = new TimeTableManager.UI.FPatternDialog();
                     dialogP.Pattern = pattern;
                     if (dialogP.ShowDialog(this.MainForm) == DialogResult.OK) {
                         Refresh();
                     }
                 }
                 break;
             case 2:
                 // コメントの追加・修正
                 if (Dates.Count == 1 && Editable) {
                     BodyTable.CurrentCell = BodyTable[e.ColumnIndex, e.RowIndex];
                     BodyTable.BeginEdit(true);
                 }
                 break;
         }
     } else {
     }
 }
 /// <summary>勤務シフトを作成する
 /// </summary>
 /// <param name="member"></param>
 /// <param name="Span1"></param>
 /// <param name="Span2"></param>
 /// <param name="Rest"></param>
 private void CreatePattern (CMember member, TimeSpan Span1, TimeSpan Span2, TimeSpan Rest) {
     double dSpan1 = (long)(Span1.TotalHours / UMultiEditor.Threshold.TotalHours);
     double dSpan2 = (long)(Span2.TotalHours / UMultiEditor.Threshold.TotalHours);
     double dSpan3 = dSpan2 - dSpan1;
     CPattern newpattern = this.TimeTable.Patterns.CreatePattern();
     //newpattern.Name = "新しい作業用のシフト(" + dates[0].ToShortDateString() + (dates.Count <= 1 ? "" : "~" + dates[dates.Count - 1].ToShortDateString()) + ")";
     newpattern.Name = NewPatternName.Replace("%1", dates[0].ToShortDateString() + (dates.Count <= 1 ? "" : "~" + dates[dates.Count - 1].ToShortDateString()));
     newpattern.Start = TimeSpan.FromHours(dSpan1 * UMultiEditor.Threshold.TotalHours);
     newpattern.Scope = TimeSpan.FromHours(dSpan3 * UMultiEditor.Threshold.TotalHours);
     newpattern.Rest = Rest;
     newpattern.Notes = NewPatternNotes;
     newpattern.Created = dates[0];
     TimeTableManager.UI.FPatternDialog dialog = new TimeTableManager.UI.FPatternDialog();
     dialog.Pattern = newpattern;
     if (dialog.ShowDialog(MainForm) == DialogResult.OK) {
         TimeTable.Patterns.AddPattern(dialog.Pattern);
         foreach (DateTime date in dates) {
             if (date >= DateTime.Today) {
                 CScheduledDate sdate = TimeTable[date];
                 sdate[member].Pattern = dialog.Pattern;
             }
         }
         // 臨時用のみかどうか
         if (TimeTable.Patterns.Size() >= TimeTableManager.UI.FMainForm.MaxItemCount || MessageBox.Show(this.MainForm, CreatePatternMessage, CreatePatternTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) {
             newpattern.SetAvailable(false, dates[dates.Count - 1]);
         }
     }
 }
 /// <summary>勤務シフトの追加
 /// </summary>
 /// <param name="sender">イベントの発生したオブジェクト</param>
 /// <param name="e">発生したイベント</param>
 private void TsmiAddPattern_Click (object sender, EventArgs e) {
     if (this.TimeTable == null) return;
     if (this.TimeTable.Patterns.Size() >= TimeTableManager.UI.FMainForm.MaxItemCount) return;
     CPattern pattern = this.TimeTable.Patterns.CreatePattern(true);
     TimeTableManager.UI.FPatternDialog dialog = new TimeTableManager.UI.FPatternDialog();
     dialog.Pattern = pattern;
     if (dialog.ShowDialog(this.MainForm) == DialogResult.OK) {
         this.TimeTable.Patterns.AddPattern(pattern);
     }
 }
 /// <summary>勤務シフトの修正
 /// </summary>
 /// <param name="sender">イベントの発生したオブジェクト</param>
 /// <param name="e">発生したイベント</param>
 private void TsmiEditPattern_Click (object sender, EventArgs e) {
     CMember member = this.Members[CurrentRowIndex];
     PatternWrapper wrapper = Member2PatternWrapper[member];
     CPattern pattern = wrapper.Pattern;
     if (pattern != null && !pattern.BuiltIn) {
         TimeTableManager.UI.FPatternDialog dialog = new TimeTableManager.UI.FPatternDialog();
         dialog.Pattern = pattern;
         if (dialog.ShowDialog(this.MainForm) == DialogResult.OK) {
             Refresh();
         }
     }
 }
 /// <summary>勤務シフトの削除
 /// </summary>
 /// <param name="sender">イベントの発生したオブジェクト</param>
 /// <param name="e">発生したイベント</param>
 private void TsmiRemovePattern_Click (object sender, EventArgs e) {
     CMember member = this.Members[CurrentRowIndex];
     PatternWrapper wrapper = Member2PatternWrapper[member];
     CPattern pattern = wrapper.Pattern;
     if (pattern != null && !pattern.BuiltIn) {
         TimeTableManager.UI.FPatternDialog dialog = new TimeTableManager.UI.FPatternDialog();
         dialog.Pattern = pattern;
         pattern.SetAvailable(false, StartDate.AddDays(-1.0));
         if (dialog.ShowDialog(this.MainForm) == DialogResult.OK) {
             this.TimeTable.Patterns.DelPattern(pattern);
             SetUpValidMembers();
             Refresh();
         } else {
             pattern.SetAvailable(true);
         }
     }
 }