Example #1
0
        /// <summary>
        /// 领用资产
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            Borrow br = new Borrow();

            br.ID     = this.textSerialNO.Text;
            br.EqNo   = this.textEqNO.Text;
            br.EqName = this.textName.Text;
            DataTable Empdt = EmployeeMgr.GetAllName();
            DataTable Depdt = DepartMgr.GetAllDepartment();

            br.Department = this.name2ID(Depdt, this.textDepartment.Text, "departName");
            br.KeepPlace  = this.textKeepPlace.Text;
            br.Keeper     = this.name2ID(Empdt, this.textKeeper.Text, "name");
            br.BAgent     = this.name2ID(Empdt, _user, "name");
            br.Borrower   = this.cbxborrower.SelectedValue.ToString();
            br.BDate      = this.dtpBDate.Value;
            br.RDate      = this.dtpRDate.Value;
            br.bRemark    = this.textBorrowRemark.Text;
            bool flag;

            if (updata_flag)
            {
                flag = BoroowMgr.BUpdate(ID, br);
            }
            else
            {
                if (IsEqAvailable(this.textEqNO.Text))
                {
                    if (_power == "0" || _power == "1")
                    {
                        flag = BoroowMgr.AddWithoutVerify(br);
                    }
                    else
                    {
                        flag = BoroowMgr.Add(br);
                    }
                    flag = EqMgr.BorrowEq(br.EqNo);
                    if (flag)
                    {
                        untCommon.InfoMsg("出借成功。");
                    }
                    else
                    {
                        untCommon.InfoMsg("出借失败。");
                    }
                }
                else
                {
                    untCommon.InfoMsg("该资产状态已改变,无法修改该信息。");
                }
            }
            this.DialogResult = DialogResult.OK;
        }
Example #2
0
        /// <summary>
        /// 领用资产
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            Borrow br = new Borrow();

            if (this.nubCount.Value.ToString() == "")
            {
                untCommon.InfoMsg("请输入领用的数量。");
                return;
            }
            if (int.Parse(this.nubCount.Value.ToString()) == 0)
            {
                untCommon.InfoMsg("领用数量不能为0");
                return;
            }
            if (br.Count > this._max)
            {
                untCommon.InfoMsg("您领用的数量不能大于最大可领用数量。");
                return;
            }
            try
            {
                br.depart = this.cbxDepart.Text;
            }
            catch (FormatException)
            {
                untCommon.InfoMsg("领用数量请在英文输入法状态下输入数字");
                return;
            }

            br.Booker = this.txtBooker.Text;
            br.Count  = int.Parse(this.nubCount.Value.ToString());
            br.Date   = this.dtpDate.Value;

            br.EqNo     = this.txtEqNO.Text;
            br.Borrower = int.Parse(this.cbxEmp.SelectedValue.ToString());

            if (BoroowMgr.Add(br))
            {
                untCommon.InfoMsg("您成功的领用了该笔资产。");
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                untCommon.InfoMsg("领用失败。");
            }
        }