public CC1InplaceEdittingController(C1FlexGrid i_fg)
 {
     m_fg = i_fg;
     m_e_mode = e_CC1InplaceEdittingMode.none;
     m_b_update_when_row_changed = true;
     m_b_commit_successful = false;
     m_fg.BeforeRowColChange += catch_m_fg_before_row_col_change;
     m_fg.Leave += catch_m_fg_leave;
 }
 protected virtual void process_after_raise_on_event(CC1InplaceEdittingOnEventArgs i_obj_event_arg, CancelEventArgs i_obj_cancel_arg)
 {
     switch (i_obj_event_arg.next_action)
     {
         case e_CC1_inplace_editting_next_action.cancel_editting:
             CancelEdit();
             break;
         case e_CC1_inplace_editting_next_action.success_and_change_to_none_status:
             m_b_commit_successful = true;
             m_e_mode = e_CC1InplaceEdittingMode.none;
             break;
         case e_CC1_inplace_editting_next_action.continue_editting:
             i_obj_cancel_arg.Cancel = true;
             break;
     }
 }
        public virtual void StartDelete()
        {
            if (m_fg.Rows.Count == m_fg.Rows.Fixed)
            {
                return ;
            }
            //Ket thuc trang thai edit cua grid
            if (!m_fg.FinishEditing())
            {
                return;
            }
            //confirm user
            if (!BaseMessages.MsgBox_Confirm(eConfirmMsg.Sure_to_delete.ToString()))
            {
                return;
            }

            if (m_e_mode == e_CC1InplaceEdittingMode.none)
            {
                CC1InplaceEdittingEventArgs v_obj_even_arg = new CC1InplaceEdittingEventArgs(true);
                if (BeforeDeleteEvent != null)
                    BeforeDeleteEvent(this, v_obj_even_arg);
                if (v_obj_even_arg.continue_editting)
                {
                    m_e_mode = e_CC1InplaceEdittingMode.delete_mode;
                    m_b_commit_successful = false;
                    m_fg.BeforeRowColChange -= catch_m_fg_before_row_col_change;
                    CommitEdit();
                    m_fg.BeforeRowColChange += catch_m_fg_before_row_col_change;
                }
                else
                {
                    CancelEdit();
                }
            }
            else
            {
                if (m_e_mode == e_CC1InplaceEdittingMode.insert_mode)
                {
                    this.CancelEdit();
                }
                else
                {
                    if (m_e_mode == e_CC1InplaceEdittingMode.update_mode)
                    {
                        this.CancelEdit();
                        this.StartDelete();
                    }
                }
            }
        }
 public virtual void StartUpdate()
 {
     Debug.Assert((m_e_mode == e_CC1InplaceEdittingMode.none)
         || (m_e_mode == e_CC1InplaceEdittingMode.update_mode)
         || (m_e_mode == e_CC1InplaceEdittingMode.insert_mode),
         "FlexGrid co mode delete khi goi startUpdate");
     if (m_e_mode == e_CC1InplaceEdittingMode.none)
     {
         CC1InplaceEdittingEventArgs v_obj_even_arg = new CC1InplaceEdittingEventArgs(true);
         if (BeforeUpdateEvent != null)
             BeforeUpdateEvent(this, v_obj_even_arg);
         if (v_obj_even_arg.continue_editting)
         {
             m_e_mode = e_CC1InplaceEdittingMode.update_mode;
             m_b_commit_successful = false;
         }
         else
         {
             CancelEdit();
         }
     }
 }
 public virtual void CancelEdit()
 {
     m_fg.BeforeRowColChange -= catch_m_fg_before_row_col_change;
     EventArgs v_obj_even_arg = new EventArgs();
     switch (m_e_mode)
     {
         case e_CC1InplaceEdittingMode.insert_mode:
             if (OnCancelInsertEvent != null)
                 OnCancelInsertEvent(this, v_obj_even_arg);
             break;
         case e_CC1InplaceEdittingMode.update_mode:
             if (OnCancelUpdateEvent != null)
                 OnCancelUpdateEvent(this, v_obj_even_arg);
             break;
         case e_CC1InplaceEdittingMode.delete_mode:
             if (OnCancelDeleteEvent != null)
                 OnCancelDeleteEvent(this, v_obj_even_arg);
             break;
         case e_CC1InplaceEdittingMode.none:
             break;
     }
     m_e_mode = e_CC1InplaceEdittingMode.none;
     m_fg.BeforeRowColChange += catch_m_fg_before_row_col_change;
 }