Exemple #1
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("请在上方文本框内填写保存地点的名称");
            }
        }
Exemple #2
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;
            }
        }