/// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (CurrentDepotInfo.MaterialTypeGrade == 0)
            {
                MessageDialog.ShowPromptMessage("1级材料类别目录不允许删除!");
                return;
            }

            if (CurrentTreeNode == null || CurrentDepotInfo == null)
            {
                MessageDialog.ShowPromptMessage("请选中要删除的材料类别后再操作");
                return;
            }

            if (CurrentTreeNode.Nodes.Count > 0)
            {
                MessageDialog.ShowPromptMessage(string.Format("材料类别[{0}]下还存在子材料类别, 只能删除不存在子材料类别的节点",
                                                              CurrentDepotInfo.MaterialTypeCode));
                return;
            }

            if (DialogResult.No == MessageDialog.ShowEnquiryMessage(string.Format("您是否确定要删除部门[({0}){1}]",
                                                                                  CurrentDepotInfo.MaterialTypeCode, CurrentDepotInfo.MaterialTypeName)))
            {
                return;
            }

            MaterialTypeData parentDepotInfo = CurrentTreeNode.Parent.Tag as MaterialTypeData;

            if (CurrentTreeNode.Parent.Nodes.Count == 1 && CurrentTreeNode.Parent.Name != "材料类别")
            {
                parentDepotInfo = parentDepotInfo.Clone() as MaterialTypeData;

                // 修改父节点的IsEnd属性
                parentDepotInfo.IsEnd = true;

                if (!m_depotServer.DeleteMaterialType(CurrentDepotInfo.MaterialTypeCode, parentDepotInfo, out m_err))
                {
                    MessageDialog.ShowErrorMessage(m_err);
                    return;
                }

                CurrentTreeNode.Parent.Tag = parentDepotInfo;
            }
            else
            {
                if (!m_depotServer.DeleteMaterialType(CurrentDepotInfo.MaterialTypeCode, out m_err))
                {
                    MessageDialog.ShowErrorMessage(m_err);
                    return;
                }
            }

            // 从信息列表中移除元素
            m_findDepotCode = CurrentDepotInfo.MaterialTypeCode;
            int index = m_listDepotInfo.FindIndex(this.FindDepotListData);

            m_listDepotInfo.RemoveAt(index);

            CurrentTreeNode.Parent.Nodes.Remove(CurrentTreeNode);
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (!CheckInputItem(out m_err))
            {
                MessageDialog.ShowErrorMessage(m_err);
                return;
            }

            if (!CheckDepotCode(txtCode.Text, out m_err))
            {
                MessageDialog.ShowErrorMessage(m_err);
                return;
            }

            if (IsExistDepotCode(txtCode.Text))
            {
                txtCode.Focus();
                MessageDialog.ShowErrorMessage("部门编码已经存在, 不允许添加相同的编码");
                return;
            }

            if (!CheckDepotName(txtName.Text, out m_err))
            {
                txtName.Focus();
                MessageDialog.ShowErrorMessage(m_err);
                return;
            }

            // 从界面上获取材料类别信息
            MaterialTypeData info = GetDepotInfoFromFace();

            // 添加的节点必然是叶子节点
            info.IsEnd = true;

            TreeNode parentNode = GetParentNode(info);

            if (parentNode != null)
            {
                MaterialTypeData parentDepotInfo = parentNode.Tag as MaterialTypeData;

                parentDepotInfo = parentDepotInfo.Clone() as MaterialTypeData;

                // 修改父节点的IsEnd属性
                parentDepotInfo.IsEnd = false;

                if (!m_depotServer.AddMaterialType(info, parentDepotInfo, out m_err))
                {
                    MessageDialog.ShowErrorMessage(m_err);
                    return;
                }

                // 更新树节点的绑定数据
                parentNode.Tag = parentDepotInfo;

                // 从部门列表中更新父节点信息
                UpdateItemFromDepotList(parentDepotInfo.MaterialTypeCode, parentDepotInfo);
            }
            else
            {
                if (!m_depotServer.AddMaterialType(info, out m_err))
                {
                    MessageDialog.ShowErrorMessage(m_err);
                    return;
                }
            }

            AddTreeNode(info);
            m_listDepotInfo.Add(info);
            InitSetting(false);
            this.treeView.ExpandAll();
        }