/// <summary>
        /// toolbar事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void toolbar_MenuItemClick(object sender, MenuEventArgs e)
        {
            switch (e.Item.Value)
            {
            case "Delete":
                for (int i = 0; i < grid.Rows.Count; i++)
                {
                    CheckBox chkItem = (CheckBox)grid.Rows[i].FindControl("chkItem");
                    if (chkItem != null && chkItem.Checked == true)
                    {
                        this.CodeDetailID = NDConvert.ToInt64(grid.DataKeys[i]["CodeDetailID"].ToString());

                        CodeDetailEntity entity = new CodeDetailEntity(CodeDetailID);
                        entity.IsDeleted = true;
                        new CodeDetailRule().Update(entity);
                    }
                }
                this.CurOperation       = (int)OperationEnum.INSERT;
                this.CodeDetailID       = 0;
                txtCodeDetailName.Text  = "";
                txtCodeDetailValue.Text = "";
                txtDetailMemo.Text      = "";
                BindGridView();
                PageHelper.ShowMessage("删除成功!");
                break;
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int RowIndex = NDConvert.ToInt32(e.CommandArgument.ToString());

            this.CodeDetailID = NDConvert.ToInt64(grid.DataKeys[RowIndex].Values["CodeDetailID"].ToString());
            CodeDetailEntity entity = new CodeDetailEntity(CodeDetailID);

            switch (e.CommandName)
            {
            case "Modify":
                txtCodeDetailName.Text  = entity.CodeDetailName;
                txtCodeDetailValue.Text = entity.CodeDetailValue;
                txtDetailMemo.Text      = entity.DetailMemo;
                this.CurOperation       = (int)OperationEnum.UPDATE;
                break;

            case "Del":
                entity.IsDeleted = true;
                new CodeDetailRule().Update(entity);
                txtCodeDetailName.Text  = "";
                txtCodeDetailValue.Text = "";
                txtDetailMemo.Text      = "";
                BindGridView();
                this.CurOperation = (int)OperationEnum.INSERT;
                this.CodeDetailID = 0;
                PageHelper.ShowMessage("删除成功!");
                break;
            }
        }
        /// <summary>
        /// 更新
        /// </summary>
        private void Update()
        {
            CodeDetailEntity entity = new CodeDetailEntity(this.CodeDetailID);

            entity.CodeDetailName  = txtCodeDetailName.Text.Trim();
            entity.CodeDetailValue = txtCodeDetailValue.Text.Trim();
            entity.DetailMemo      = txtDetailMemo.Text.Trim();
            new CodeDetailRule().Update(entity);
        }
        /// <summary>
        /// 保存
        /// </summary>
        private void Save()
        {
            CodeDetailEntity entity = new CodeDetailEntity();

            entity.CodeID          = this.CodeID;
            entity.CodeDetailName  = txtCodeDetailName.Text.Trim();
            entity.CodeDetailValue = txtCodeDetailValue.Text.Trim();
            entity.DetailMemo      = txtDetailMemo.Text.Trim();
            entity.IsDeleted       = false;
            new CodeDetailRule().Add(entity);
        }