Пример #1
0
        private void btnKeepPlace_Click(object sender, EventArgs e)
        {
            lstInfo.DataSource = null;
            lblMessge.Text     = btnKeepPlace.Text;
            DataTable dt = KeepPlaceMgr.GetAllPlace();

            lstInfo.DataSource    = dt;
            lstInfo.DisplayMember = dt.Columns[1].ToString();;
            lstInfo.ValueMember   = dt.Columns[0].ToString();
        }
Пример #2
0
        /// <summary>
        /// 初始化存地点列表
        /// </summary>
        private void InitKeepPlace()
        {
            DataTable dt = KeepPlaceMgr.GetAllPlace();

            if (dt != null)
            {
                cbxKeepPlace.DataSource    = dt;
                cbxKeepPlace.DisplayMember = dt.Columns[1].ToString();
                cbxKeepPlace.ValueMember   = dt.Columns[0].ToString();
            }
        }
Пример #3
0
        /// <summary>
        /// 构造资产保存地点节点
        /// </summary>
        /// <param name="parent">父节点</param>
        private void BuildKeepPlace(TreeNode parent)
        {
            TreeNode KeepPlace = new TreeNode();

            this.AddNode(KeepPlace, "保存地点", 1, parent);
            DataTable dt = KeepPlaceMgr.GetAllPlace();

            if (dt != null)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    TreeNode keep = new TreeNode();
                    this.AddNode(keep, dt.Rows[i][1].ToString(), 2, KeepPlace);
                }
            }
        }
Пример #4
0
        private void toolDelete_Click(object sender, EventArgs e)
        {
            int id = int.Parse(this.dgvKeepPlace.SelectedRows[0].Cells["编号"].Value.ToString());

            if (untCommon.QuestionMsg("您确定要删除选中的保存地点吗?"))
            {
                if (KeepPlaceMgr.Del(id))
                {
                    untCommon.InfoMsg("删除成功");
                    fresh();
                }
                else
                {
                    untCommon.InfoMsg("删除失败");
                }
            }
        }
Пример #5
0
        private void toolSave_Click(object sender, EventArgs e)
        {
            int    id    = 0;
            string place = this.txtKeepPlace.Text;

            if (this.txtKeepPlace.Text.Trim() != "")
            {
                if (isAdd)
                {
                    if (KeepPlaceMgr.AddPlace(place))
                    {
                        untCommon.InfoMsg("增加成功");
                        fresh();
                        clear();
                    }

                    else
                    {
                        untCommon.InfoMsg("增加失败");
                    }
                }
                else
                {
                    id = int.Parse(this.txtId.Text);
                    if (KeepPlaceMgr.UpdatePlace(id, place))
                    {
                        untCommon.InfoMsg("修改成功");
                        clear();
                        fresh();
                        isAdd = true;
                    }
                    else
                    {
                        untCommon.InfoMsg("修改失败");
                    }
                }
            }
            else
            {
                untCommon.InfoMsg("请在上方文本框内填写保存地点的名称");
            }
        }
Пример #6
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;
            }
        }
Пример #7
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;
            }
        }
Пример #8
0
 private void fresh()
 {
     this.dgvKeepPlace.DataSource = KeepPlaceMgr.GetAllPlace();
 }
Пример #9
0
 private void frmKeepPlace_Load(object sender, EventArgs e)
 {
     this.dgvKeepPlace.DataSource = KeepPlaceMgr.GetAllPlace();
 }