/// <summary>メンバーが更新された
 /// </summary>
 /// <param name="sender">イベントの発生したオブジェクト</param>
 /// <param name="e">発生したイベント</param>
 void timeTable_OnMembersEdited(object sender, EMembersEditedEventArgs e)
 {
     if (columns2.ContainsKey(e.Source))
     {
         ShiftComboBoxColumn column = columns2[e.Source];
         column.HeaderText = e.Source.Name;
     }
 }
        /// <summary>値設定
        /// </summary>
        /// <param name="sender">イベントの発生したオブジェクト</param>
        /// <param name="e">発生したイベント</param>
        private void CalenderView_CellValuePushed(object sender, DataGridViewCellValueEventArgs e)
        {
            if (TimeTable == null)
            {
                return;
            }
            DateTime date = GetDateFromRowIndex(e.RowIndex);

            if (e.ColumnIndex == 0)
            {
                // 日付
                //e.Value = date;
            }
            else
            {
                CScheduledDate sdate = TimeTable[date];
                if (e.ColumnIndex == 1)
                {
                    // 人員配置
                    sdate.Require = e.Value as CRequirePatterns;
                }
                else
                {
                    // メンバー||シフト
                    int index = e.ColumnIndex - 2;
                    if (index < columns1.Count)
                    {
                        ShiftComboBoxColumn col    = columns1[index];
                        CMember             member = col.Member;
                        if (member != null)
                        {
                            CSchedule schedule = sdate[member];
                            schedule.Pattern = e.Value as CPattern;
                        }
                    }
                }
            }
        }
        /// <summary>メンバー列の再作成
        /// </summary>
        private void ResetMembers()
        {
            CalenderView.Enabled = false;
            TimeTableManager.ElementCollection.CMemberCollection Members = TimeTable.Members;
            // 不要な列の削除
            int workcount = 0;

            while (workcount < columns1.Count)
            {
                ShiftComboBoxColumn column = columns1[workcount];
                CMember             member = column.Member;
                if (member.TimeTable != this.TimeTable)
                {
                    // 異なるタイムテーブルのメンバー
                    CalenderView.Columns.Remove(column);
                    columns1.Remove(column);
                    columns2.Remove(member);
                }
                else
                {
                    if (member.IsAvailable(StartDate, EndDate))
                    {
                        // 有効なら無視する
                        workcount++;
                    }
                    else
                    {
                        // 無効なら削除する
                        CalenderView.Columns.Remove(column);
                        columns1.Remove(column);
                        columns2.Remove(member);
                    }
                }
            }
            for (int i = 0; i < Members.Size(true); i++)
            {
                CMember member = Members[i, true];
                if (member.IsAvailable(StartDate, EndDate))
                {
                    // 列が必要なら追加
                    ShiftComboBoxColumn column;
                    if (columns2.ContainsKey(member))
                    {
                        column = columns2[member];
                        //column.CellTemplate = new PatternCell();
                        if (column.Index != i + 2)
                        {
                            CalenderView.Columns.Remove(column);
                            columns2.Remove(member);
                            columns1.Remove(column);
                            // 列
                            column = new ShiftComboBoxColumn();
                            column.CellTemplate  = new PatternCell();
                            column.Member        = member;
                            column.DataSource    = this.DsPatternComboBox;
                            column.DisplayMember = "TblPatternComboBox.ClmPatternNameComboBox";
                            column.HeaderText    = member.Name;
                            column.Name          = "MEMBER" + member.ObjectID.ToString();
                            column.Resizable     = System.Windows.Forms.DataGridViewTriState.True;
                            column.SortMode      = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
                            column.ValueMember   = "TblPatternComboBox.ClmPatternComboBox";
                            column.DisplayStyle  = System.Windows.Forms.DataGridViewComboBoxDisplayStyle.Nothing;
                            column.DisplayStyleForCurrentCellOnly = true;
                            columns2.Add(member, column);
                            if (i < columns1.Count)
                            {
                                columns1.Insert(i, column);
                                CalenderView.Columns.Insert(i + 2, column);
                            }
                            else
                            {
                                columns1.Add(column);
                                CalenderView.Columns.Add(column);
                            }
                        }
                    }
                    else
                    {
                        column = new ShiftComboBoxColumn();
                        column.CellTemplate  = new PatternCell();
                        column.Member        = member;
                        column.DataSource    = this.DsPatternComboBox;
                        column.DisplayMember = "TblPatternComboBox.ClmPatternNameComboBox";
                        column.HeaderText    = member.Name;
                        column.Name          = "MEMBER" + member.ObjectID.ToString();
                        column.Resizable     = System.Windows.Forms.DataGridViewTriState.True;
                        column.SortMode      = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
                        column.ValueMember   = "TblPatternComboBox.ClmPatternComboBox";
                        column.DisplayStyle  = System.Windows.Forms.DataGridViewComboBoxDisplayStyle.Nothing;
                        column.DisplayStyleForCurrentCellOnly = true;
                        CalenderView.Columns.Add(column);
                        columns1.Add(column);
                        columns2.Add(member, column);
                    }
                }
                else
                {
                    // 列が不要なら削除
                    ShiftComboBoxColumn column;
                    if (columns2.ContainsKey(member))
                    {
                        column = columns2[member];
                        //CalenderView.Columns.Remove(column);
                        columns2.Remove(member);
                        columns1.Remove(column);
                    }
                }
                //*/
            }
            CalenderView.Enabled = true;
            //CalenderView.EndEdit();
        }