/// <summary>
        /// 刷新数据列表
        /// </summary>
        public void loadData()
        {
            ClientTypeManager cts = new ClientTypeManager();
            DataSet           ds  = cts.GetList("CT_Enable = 1");

            bindingDGVByDataTable(ds);
        }
        /// <summary>
        /// 删除按钮 转码code用于删除的where条件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void  除DToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (superGridControl1.PrimaryGrid.GetSelectedRows() == null)
            {
                ClientTypeManager         ctm = new ClientTypeManager();
                SelectedElementCollection col = superGridControl1.PrimaryGrid.GetSelectedRows();
                DialogResult dr = MessageBox.Show("确定要删除该数据吗?操作不可恢复", "请注意",
                                                  MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (dr == DialogResult.No)
                {
                    return;
                }

                GridRow row = col[0] as GridRow;

                string code = XYEEncoding.
                              strCodeHex(row.Cells["TypeCode"].Value.ToString());

                bool result = ctm.Delete(code);
                if (result)
                {
                    loadData();
                    MessageBox.Show("客户类别删除成功");
                }
                else
                {
                    MessageBox.Show("删除失败,请检查是否选中列");
                }
            }
            else
            {
                MessageBox.Show("请先选中要修改的数据所在行");
            }
        }
        /// <summary>
        /// 假删除所有的数据列表
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void 全部删除AToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (superGridControl1.PrimaryGrid.Rows != null)
            {
                DialogResult dr = MessageBox.Show("确定要删除所有客户类别吗?该操作不可恢复", "请注意",
                                                  MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

                GridItemsCollection col = superGridControl1.PrimaryGrid.Rows;
                if (col.Count > 0 && dr == DialogResult.No)
                {
                    List <string> ids = new List <string>();
                    //遍历ID 填充到list里
                    foreach (GridRow gr in col)
                    {
                        ids.Add(gr.Cells["TypeID"].Value.ToString());
                    }
                    //用逗号分割所有id数据 返回ID,ID形式的字符串
                    string idList = string.Join(",", ids);

                    ClientTypeManager ctm = new ClientTypeManager();
                    try
                    {
                        if (ctm.FakeDeleteList())
                        {
                            loadData();
                            MessageBox.Show("清除数据成功");
                        }
                        else
                        {
                            MessageBox.Show("清除数据失败,请检查错误");
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("清除数据失败,请检查错误:" + ex.Message);
                    }
                }
                else
                {
                    MessageBox.Show("客户类型已为空,不存在需要删除的数据");
                }
            }
        }
        private void buttonXOK_Click(object sender, EventArgs e)
        {
            ClientType        ct  = new ClientType();
            ClientTypeManager ctm = new ClientTypeManager();
            ClientTypeForm    ctf = (ClientTypeForm)this.Owner;

            switch (formStatic)
            {
            case "增":
                ct.CT_Name   = XYEEncoding.strCodeHex(textBoxXName.Text.Trim());
                ct.CT_Remark = XYEEncoding.strCodeHex(richTextBoxExRe.Text);
                ct.CT_Code   = XYEEncoding.strCodeHex(BuildCode.ModuleCode("CL"));
                ct.CT_Enable = 1;

                int insertResult = 0;
                try
                {
                    insertResult = ctm.Add(ct);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("系统异常:" + ex.Message);
                    exceptionFlag = false;
                }

                if (insertResult > 0 && exceptionFlag)
                {
                    ctf.loadData();
                    MessageBox.Show("添加成功!");
                }
                else
                {
                    MessageBox.Show("添加失败,请尝试重新添加");
                }
                break;

            case "改":
                ct.CT_Name   = XYEEncoding.strCodeHex(textBoxXName.Text.Trim());
                ct.CT_Remark = XYEEncoding.strCodeHex(richTextBoxExRe.Text);
                ct.CT_Enable = 1;

                bool updateResult = false;
                try
                {
                    updateResult = ctm.Update(ct);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("系统异常:" + ex.Message);
                    exceptionFlag = false;
                }

                if (updateResult && exceptionFlag)
                {
                    ctf.loadData();
                    MessageBox.Show("更新成功!");
                }
                else
                {
                    MessageBox.Show("更新失败,请尝试重新添加");
                }
                break;

            case "":
                MessageBox.Show("初始化异常,请重新操作");
                break;
            }
            if (!exceptionFlag)
            {
                this.Close();
            }
        }