Beispiel #1
0
        /// <summary>
        /// 初始化资产名称
        /// </summary>
        private void InitName()
        {
            DataTable dt = EqNameMgr.GetAllEqname();

            if (dt != null)
            {
                cbxEqName.DataSource    = dt;
                cbxEqName.DisplayMember = dt.Columns[1].ToString();
            }
        }
Beispiel #2
0
        private void btnName_Click(object sender, EventArgs e)
        {
            lstInfo.DataSource = null;
            lblMessge.Text     = btnName.Text;
            DataTable dt = EqNameMgr.GetAllEqname();

            lstInfo.DataSource    = dt;
            lstInfo.DisplayMember = dt.Columns[1].ToString();;
            lstInfo.ValueMember   = dt.Columns[0].ToString();
        }
Beispiel #3
0
        /// <summary>
        /// 构造资产名称节点
        /// </summary>
        /// <param name="parent">父节点</param>
        private void BuildName(TreeNode parent)
        {
            TreeNode Name = new TreeNode();

            this.AddNode(Name, "资产名称", 5, parent);
            DataTable dt = EqNameMgr.GetAllEqname();

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    TreeNode name = new TreeNode();
                    this.AddNode(name, dt.Rows[i][1].ToString(), 2, Name);
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// 删除选中的项
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void btnDel_Click(object sender, EventArgs e)
        {
            if (lstInfo.SelectedIndex == -1)
            {
                untCommon.InfoMsg("请选择所要删除的项。");
                return;
            }
            switch (this.lblMessge.Text)
            {
            case "增长方式":      //删除增长方式
                if (untCommon.QuestionMsg("确定要删除该项吗"))
                {
                    if (AddTypeMgr.Del(int.Parse(lstInfo.SelectedValue.ToString())))
                    {
                        btnAddType_Click(null, null);
                    }
                    else
                    {
                        untCommon.InfoMsg("删除失败");
                    }
                }
                break;

            case "资产名称":     //删除资产名称
                if (untCommon.QuestionMsg("确定要删除该项吗"))
                {
                    if (EqNameMgr.Del(int.Parse(lstInfo.SelectedValue.ToString())))
                    {
                        btnName_Click(null, null);
                    }
                    else
                    {
                        untCommon.InfoMsg("删除失败");
                    }
                }
                break;

            case "保管地点":      //删除保管地点
                if (untCommon.QuestionMsg("确定要删除该项吗"))
                {
                    if (KeepPlaceMgr.Del(int.Parse(lstInfo.SelectedValue.ToString())))
                    {
                        btnKeepPlace_Click(null, null);
                    }
                    else
                    {
                        untCommon.InfoMsg("删除失败");
                    }
                }
                break;

            case "计量单位":      //删除计量单位
                if (untCommon.QuestionMsg("确定要删除该项吗"))
                {
                    if (UnitMgr.Del(int.Parse(lstInfo.SelectedValue.ToString())))
                    {
                        btnUnit_Click(null, null);
                    }
                    else
                    {
                        untCommon.InfoMsg("删除失败");
                    }
                }
                break;

            case "清理方式":     //删除清理方式
                if (untCommon.QuestionMsg("确定要删除该项吗"))
                {
                    if (ClearTypeMgr.Del(int.Parse(lstInfo.SelectedValue.ToString())))
                    {
                        btnClearType_Click(null, null);
                    }
                    else
                    {
                        untCommon.InfoMsg("删除失败");
                    }
                }
                break;

            case "资产类别":      //添加增长方式
                if (untCommon.QuestionMsg("确定要删除该项吗"))
                {
                    if (EqTypeMgr.Del(int.Parse(lstInfo.SelectedValue.ToString())))
                    {
                        btnTyp_Click(null, null);
                    }
                    else
                    {
                        untCommon.InfoMsg("删除失败");
                    }
                }
                break;
            }
        }
Beispiel #5
0
        /// <summary>
        /// 保存添加项
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.txtInput.Text.Trim() == "")
            {
                untCommon.InfoMsg("不能添加空相,请填写所要添加的内容。");
                return;
            }
            if (this.txtInput.Text == "请输入新加项的内容")
            {
                untCommon.InfoMsg("请输入合法的新项");
                return;
            }
            switch (this.lblMessge.Text)
            {
            case "增长方式":      //添加增长方式
                if (AddTypeMgr.Add(this.txtInput.Text))
                {
                    btnAddType_Click(null, null);
                    txtInput.Text = "";
                    txtInput.Focus();
                    this.btnDel.Enabled = true;
                }
                else
                {
                    untCommon.InfoMsg("添加失败");
                }
                break;

            case "资产名称":     ////添加资产名称
                if (EqNameMgr.AddName(this.txtInput.Text))
                {
                    btnName_Click(null, null);
                    txtInput.Text = "";
                    txtInput.Focus();
                    this.btnDel.Enabled = true;
                }
                else
                {
                    untCommon.InfoMsg("添加失败");
                }
                break;

            case "保管地点":    //添加保管地点
                if (KeepPlaceMgr.AddPlace(this.txtInput.Text))
                {
                    btnKeepPlace_Click(null, null);
                    txtInput.Text = "";
                    txtInput.Focus();
                    this.btnDel.Enabled = true;
                }
                else
                {
                    untCommon.InfoMsg("添加失败");
                }
                break;

            case "计量单位":     //添加计量单位
                if (UnitMgr.Add(this.txtInput.Text))
                {
                    btnUnit_Click(null, null);
                    txtInput.Text = "";
                    txtInput.Focus();
                    this.btnDel.Enabled = true;
                }
                else
                {
                    untCommon.InfoMsg("添加失败");
                }
                break;

            case "清理方式":    //添加清理方式
                if (ClearTypeMgr.Add(this.txtInput.Text))
                {
                    btnClearType_Click(null, null);
                    txtInput.Text = "";
                    txtInput.Focus();
                    this.btnDel.Enabled = true;
                }
                else
                {
                    untCommon.InfoMsg("添加失败");
                }
                break;

            case "资产类别":      //添加增长方式
                if (EqTypeMgr.AddType(this.txtInput.Text))
                {
                    btnTyp_Click(null, null);
                    txtInput.Text = "";
                    txtInput.Focus();
                    this.btnDel.Enabled = true;
                }
                else
                {
                    untCommon.InfoMsg("添加失败");
                }
                break;
            }
        }