private void btnModify_Click(object sender, EventArgs e)
        {
            
            if (!IsSetBoxNumLenAndHead())
            {
                CommControl.MessageBoxEx.MessageBoxEx.Show("还未进行基本设置,不能执行修改操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            StringBuilder sb = new StringBuilder();
            /*
            List<DB_Talk.Model.v_Member> list = new List<DB_Talk.Model.v_Member>();
            foreach (DataGridViewRow dr in dgvList.Rows)
            {
                if (Convert.ToBoolean(dr.Cells[0].Value.ToString()) == true)
                {

                    DB_Talk.Model.v_Member Model = (DB_Talk.Model.v_Member)dr.Tag; // dgvList.CurrentRow.Tag;
                    list.Add(Model);
                    sb.Append("," + Model.ID);
                }
            }
            */
            int count = dgvList.SelectedRows.Count;
            int operate = 0;
            List<DB_Talk.Model.v_Member> lstvModel = new List<DB_Talk.Model.v_Member>();
            //上次选中的行数
            int lastIndex = 0;
            if (dgvList.SelectedRows.Count <= 0)
            {
                CommControl.MessageBoxEx.MessageBoxEx.Show("请选择要修改的人员!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            lastIndex = dgvList.SelectedRows[0].Index;
            if (count > 1)
            {
                operate = 2; //修改多个
               
                foreach (DataGridViewRow item in dgvList.SelectedRows)
                {
                   
                    DB_Talk.Model.v_Member _mModel = (DB_Talk.Model.v_Member)item.Tag; // dgvList.CurrentRow.Tag;
                    bool b = MBoxSDK.ConfigSDK.MBOX_IsSubscriberExist(Global.Params.BoxHandle, _mModel.i_Number.Value);
                    if (b == false)
                    {
                        CommControl.MessageBoxEx.MessageBoxEx.Show(Global.Params.BOXNAME + "【" + Global.Params.BoxIP + "】中已经不存在此用户,不能再进行修改,只能进行删除操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        return;
                    }
                  
                    lstvModel.Add(_mModel); 
                }
                //CommControl.MessageBoxEx.MessageBoxEx.Show("一次只允许编辑一个人员,请重新选择", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else if(count == 1)
            {
                operate = 1;
                DB_Talk.Model.v_Member Model = (DB_Talk.Model.v_Member)dgvList.CurrentRow.Tag; //list[0];// 
                if (Model != null)
                {
                    bool b = MBoxSDK.ConfigSDK.MBOX_IsSubscriberExist(Global.Params.BoxHandle, Model.i_Number.Value);
                    if (b==false)
                    {
                        CommControl.MessageBoxEx.MessageBoxEx.Show(Global.Params.BOXNAME + "【" + Global.Params.BoxIP + "】中已经不存在此用户,不能再进行修改,只能进行删除操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        return;
                    }
                    lstvModel.Add(Model); 
                }
            }
            else
            {
                CommControl.MessageBoxEx.MessageBoxEx.Show("请选择要编辑的人员", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }

            UI.frmMember fu = new UI.frmMember(lstvModel, operate);
            fu.ShowDialog();
            if (fu.DialogResult == DialogResult.OK)
                LoadData("");
           // dgvList.CurrentCell = dgvList[lastIndex, 0];
            dgvList.ClearSelection();
            if (lastIndex<dgvList.Rows.Count)
            {
                dgvList.Rows[lastIndex].Selected = true;
                dgvList.CurrentCell = dgvList[1,lastIndex];
            }
            
        }
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (!IsSetBoxNumLenAndHead())
     {
         CommControl.MessageBoxEx.MessageBoxEx.Show("还未进行基本设置,不能执行添加操作!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     
     DB_Talk.BLL.m_Member _BLL = new DB_Talk.BLL.m_Member();
     List<DB_Talk.Model.m_Member> list = new List<DB_Talk.Model.m_Member>();
     list = _BLL.GetModelList(string.Format(" i_flag=0 and BoxID='{0}'", Global.Params.BoxID));
     if (list.Count >= Global.Params.MaxBoxMemberCount)
     {
         CommControl.MessageBoxEx.MessageBoxEx.Show(string.Format("不能添加,号码已经达到最大限制,【{0}】个!", Global.Params.MaxBoxMemberCount), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     UI.frmMember frm = new UI.frmMember(null, 0);
     frm.ShowDialog();
     if(frm.DialogResult==DialogResult.OK)
        LoadData("");
 
 }