/// <summary> /// 确定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { if (this.checkBox1.Checked) { Borrow br = new Borrow(); DataTable Empdt = EmployeeMgr.GetAllName(); br.RAgent = this.name2ID(Empdt, this._user, "name"); br.RDate = this.dtpBDate1.Value; br.rRemark = this.textRRemark.Text; string eqno = this.textEqNO.Text; if (_power == "0" || _power == "1") { bool flag = BoroowMgr.RUpdateWithoutVerify(_id, br); flag = EqMgr.ReturnEq(eqno); untCommon.InfoMsg("归还成功。"); } else { bool flag = BoroowMgr.RUpdate(_id, br); untCommon.InfoMsg("归还待审核。"); } } this.DialogResult = DialogResult.OK; this.Close(); }
/// <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; }
private void InitCombo() { DataTable dtEmp = EmployeeMgr.GetAllName(); this.cbxborrower.DataSource = dtEmp; this.cbxborrower.DisplayMember = "name"; this.cbxborrower.ValueMember = "empid"; if (!string.IsNullOrWhiteSpace(defaultBorrower)) { this.cbxborrower.SelectedValue = defaultBorrower; } }
/// <summary> /// 确定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { if (this.checkBox1.Checked) { Fix fix = new Fix(); DataTable Empdt = EmployeeMgr.GetAllName(); fix.RAgent = this.name2ID(Empdt, this._user, "name"); fix.EqNo = this.textEqNO.Text; fix.RDate = this.dtpBDate1.Value; fix.rRemark = this.textRRemark.Text; if (_power == "0" || _power == "1") { bool flag = FixMgr.RUpdateWithoutVerify(_id, fix); flag = EqMgr.ReturnEq(fix.EqNo); } else { bool flag = FixMgr.RUpdate(_id, fix); } } this.DialogResult = DialogResult.OK; this.Close(); }
private void btnOk_Click(object sender, EventArgs e) { if (view_only) { untCommon.InfoMsg("当前无法修改。"); } else { Clear clear = new Clear(); clear.ID = this.textSerialNO.Text; clear.EqNo = this.textEqNO.Text; clear.EqName = this.textName.Text; DataTable Empdt = EmployeeMgr.GetAllName(); DataTable Depdt = DepartMgr.GetAllDepartment(); clear.Department = this.name2ID(Depdt, this.textDepartment.Text, "departName"); clear.KeepPlace = this.textKeepPlace.Text; clear.Keeper = this.name2ID(Empdt, this.textKeeper.Text, "name"); clear.CType = this.cbxClearType.Text; clear.CAgent = this.name2ID(Empdt, _user, "name"); clear.CDate = this.dtpDate.Value; clear.Remark = this.textRemark.Text; bool flag; if (updata_flag) { flag = ClearMgr.CUpdate(ID, clear); if (flag) { untCommon.InfoMsg("修改成功。"); } else { untCommon.InfoMsg("修改失败。"); } } else { if (IsEqAvailable(this.textEqNO.Text)) { if (_power == "0" || _power == "1") { flag = ClearMgr.AddWithoutVerify(clear); untCommon.InfoMsg("注销成功。"); } else { flag = ClearMgr.Add(clear); untCommon.InfoMsg("注销成功待审核。"); } flag = EqMgr.ClearEq(clear.EqNo); if (!flag) { untCommon.InfoMsg("注销失败。"); } } else { untCommon.InfoMsg("该资产状态已改变,无法修改该信息。"); } } this.DialogResult = DialogResult.OK; } }
//保存修改的信息 private void toolEqUpdate_Click(object sender, EventArgs e) { if (this.checkInput()) { Equipment eq = new Equipment(); eq.EqNo = this.txtEqNo.Text; eq.EqName = this.txtEqName.Text; eq.AssetNo = this.txtAssetNo.Text; eq.EduNo = this.txtEduNo.Text; eq.EqType = this.cbxEqType.Text; eq.Gb = this.txtGB.Text; eq.Usage = this.cbxUsage.Text; eq.Unit = this.cbxUnit.Text; eq.Direction = this.cbxDirection.Text; eq.BuyWay = this.cbxBuyWay.Text; eq.GetWay = this.cbxGetWay.Text; eq.Purchaser = this.cbxPurchaser.Text; eq.Agent = this.txtAgent.Text; eq.Brand = this.txtBrand.Text; eq.Model = this.txtModel.Text; eq.Country = this.txtCountry.Text; eq.Mfrs = this.txtMfrs.Text; eq.ProductNo = this.txtProductNo.Text; eq.Supplier = this.txtSupplier.Text; eq.PriceType = this.cbxPriceType.Text; eq.EqKeeper = this.cbxEqKeeper.Text; eq.Department = DepartMgr.GetIdFromName(this.txtDepartment.Text); eq.Campus = this.cbxCampus.Text; eq.KeepPlace = this.cbxKeepPlace.Text; eq.Cn = this.txtCN.Text; eq.InvNo = this.txtInvNo.Text; eq.Funds = this.cbxFunds.Text; eq.BelongTo = ""; eq.Photo = ""; eq.Remark = this.txtRemark.Text; eq.Photo = this.getPhotoPath(); if (this.dtpGetDate.Checked == true) { eq.GetDate = this.dtpGetDate.Value.ToShortDateString(); } else { eq.GetDate = ""; } if (dtpAddDate.Checked == true) { eq.AddDate = this.dtpAddDate.Value.ToShortDateString(); } else { eq.AddDate = ""; } if (this.dtpBirthday.Checked == true) { eq.Birthday = this.dtpBirthday.Value.ToShortDateString(); } else { eq.Birthday = ""; } if (this.dtpSvcDate.Checked == true) { eq.SvcDate = this.dtpSvcDate.Value.ToShortDateString(); } else { eq.SvcDate = ""; } /*****************************根据资产类别判断所要填的项********************************************/ //资产类别为“土地、房屋及构筑物”时 if (eq.EqType == "土地、房屋及构筑物") { eq.Pr = this.cbxPR.Text; eq.Address = this.txtAddress.Text; eq.CertNature = this.cbxCertNature.Text; eq.Structure = this.cbxStructure.Text; //有产权时以下四项才可以被填写 if (eq.Pr == "有产权") { if (this.txtCertNo.Text.Trim() == "") { untCommon.InfoMsg("请输入权属证号"); return; } else { eq.CertNo = this.txtCertNo.Text; } if (this.dtpIssueDate.Checked == false) { untCommon.InfoMsg("请选择发证日期"); return; } else { eq.IssueDate = this.dtpIssueDate.Value.ToShortDateString(); } if (this.txtCertProve.Text.Trim() == "") { untCommon.InfoMsg("请输入权属证明"); return; } else { eq.CertProve = this.txtCertProve.Text; } try { eq.CertLim = int.Parse(this.txtCertLim.Text); } catch (FormatException) { untCommon.ErrorMsg("权属年限请输入数字。"); return; } } else { eq.CertNo = ""; eq.IssueDate = ""; eq.CertProve = ""; eq.CertLim = 0; } try { eq.Area = double.Parse(this.txtArea.Text); } catch (FormatException) { untCommon.ErrorMsg("建筑/土地面积请输入数字。"); return; } try { eq.TenuArea = double.Parse(this.txtTenuArea.Text); } catch (FormatException) { untCommon.ErrorMsg("自用面积请输入数字。"); return; } try { eq.TenuPrice = double.Parse(this.txtTenuPrice.Text); } catch (FormatException) { untCommon.ErrorMsg("自用价值请输入数字。"); return; } } else { eq.Pr = ""; eq.CertNo = ""; eq.IssueDate = ""; eq.CertProve = ""; eq.Address = ""; eq.CertNature = ""; eq.Structure = ""; eq.Area = 0; eq.TenuArea = 0; eq.TenuPrice = 0; eq.CertLim = 0; } //资产类别为"通用设备(车辆)" if (eq.EqType == "通用设备(车辆)") { eq.CarUse = this.cbxCarUse.Text; eq.CarBP = this.cbxCarBP.Text; eq.LicNo = this.txtLicNo.Text; eq.Dspl = this.txtDSPL.Text; eq.EngNo = this.txtEngNo.Text; eq.Formation = this.cbxFormation.Text; } else { eq.CarUse = ""; eq.CarBP = ""; eq.LicNo = ""; eq.Dspl = ""; eq.EngNo = ""; eq.Formation = ""; } //资产类别为"无形资产" if (eq.EqType == "无形资产") { eq.RegAuz = this.txtRegAuz.Text; eq.PatNo = this.txtPatNo.Text; eq.ApvNo = this.txtApvNo.Text; eq.MgtAgency = this.txtMgtAgency.Text; if (this.dtpRegTime.Checked == true) { eq.RegTime = this.dtpRegTime.Value.ToShortDateString(); } else { eq.RegTime = ""; } } else { eq.RegAuz = ""; eq.RegTime = ""; eq.PatNo = ""; eq.ApvNo = ""; eq.MgtAgency = ""; } //资产类别为"文物和陈列品" if (eq.EqType == "文物和陈列品") { eq.RelicLv = this.cbxRelicLv.Text; } else { eq.RelicLv = ""; } /*************************************判断结束******************************************************/ try { count = int.Parse(this.txtCount.Text); } catch (FormatException) { untCommon.ErrorMsg("数量请输入数字。"); return; } try { eq.Price = double.Parse(this.txtPrice.Text); } catch (FormatException) { untCommon.ErrorMsg("价值请输入数字。"); return; } try { if (this.txtUSDPrice.Text.Trim() != "") { eq.UsdPrice = double.Parse(this.txtUSDPrice.Text); } else { eq.UsdPrice = 0; } } catch (FormatException) { untCommon.ErrorMsg("美金单价请输入数字。"); return; } //判断更新模式 switch (this.mode) { case 0: this.DialogResult = DialogResult.OK; break; //直接修改 case 1: { int error = 0; //0级和1级用户直接更新 if (_power == "0" || _power == "1") { foreach (string field in eqnoList) { eq.EqNo = field; eq.State = "入库"; if (EqMgr.Update(eq)) { // } else { error++; } } if (error == 0) { untCommon.InfoMsg("更新成功"); this.DialogResult = DialogResult.OK; this.Close(); } else { untCommon.InfoMsg("操作失败,失败数目为:" + error.ToString()); this.DialogResult = DialogResult.OK; this.Close(); } } else { DataTable Empdt = EmployeeMgr.GetAllName(); foreach (string field in eqnoList) { eq.EqNo = "U" + this.Loginid + DateTime.Now.ToString("yyyyMMddHHmmss") + field; eq.State = "更新待审核"; if (EqMgr.Add(eq)) { // } else { error++; } } if (error == 0) { untCommon.InfoMsg("更新成功,请等待审核"); this.DialogResult = DialogResult.OK; this.Close(); } else { untCommon.InfoMsg("操作失败,失败数目为:" + error.ToString()); this.DialogResult = DialogResult.OK; this.Close(); } } break; } //直接批量修改 case 2: { string question = "确定要更改这单数量为: "; question += EqMgr.AssetCount(this.asset).ToString() + " 的资产吗?"; if (untCommon.QuestionMsg(question)) { if (_power == "0" || _power == "1") { eq.State = "入库"; if (EqMgr.UpdateByAsset(eq, asset)) { untCommon.InfoMsg("更新成功"); this.DialogResult = DialogResult.OK; this.Close(); } else { untCommon.InfoMsg("更新失败。"); this.DialogResult = DialogResult.OK; this.Close(); } } else { List <string> list = EqMgr.GetEqNoByAssetNo(this.asset); DataTable Empdt = EmployeeMgr.GetAllName(); int error = 0; if (list != null) { foreach (string field in list) { eq.EqNo = "U" + this.name2ID(Empdt, this._user, "name") + DateTime.Now.ToString("yyyyMMddHHmmss") + field; eq.State = "更新待审核"; if (EqMgr.Add(eq)) { } else { error++; } } } if (error == 0) { untCommon.InfoMsg("更新信息提交成功,请等待审核"); this.DialogResult = DialogResult.OK; this.Close(); } else { untCommon.InfoMsg("更新信息发生错误\n" + "失败数为: " + error.ToString()); this.DialogResult = DialogResult.OK; this.Close(); } } } break; } //从新增审核处修改 case 3: { eq.State = "新增待审核"; if (EqMgr.UpdateByAsset(eq, asset)) { untCommon.InfoMsg("更新信息提交成功,请等待审核"); this.DialogResult = DialogResult.OK; this.Close(); } else { untCommon.InfoMsg("更新失败。"); this.DialogResult = DialogResult.OK; this.Close(); } break; } //从更新审核处修改 case 4: { int error = 0; DataTable Empdt = EmployeeMgr.GetAllName(); foreach (string field in eqnoList) { eq.EqNo = field; eq.State = "更新待审核"; if (EqMgr.Update(eq)) { // } else { error++; } } if (error == 0) { untCommon.InfoMsg("更新成功,请等待审核"); this.DialogResult = DialogResult.OK; this.Close(); } else { untCommon.InfoMsg("操作失败,失败数目为:" + error.ToString()); this.DialogResult = DialogResult.OK; this.Close(); } break; } } } }
private void btnOK_Click(object sender, EventArgs e) { Fix fix = new Fix(); fix.ID = this.textSerialNO.Text; fix.EqNo = this.textEqNO.Text; fix.EqName = this.textName.Text; DataTable Empdt = EmployeeMgr.GetAllName(); DataTable Depdt = DepartMgr.GetAllDepartment(); fix.Department = this.name2ID(Depdt, this.textDepartment.Text, "departName"); fix.KeepPlace = this.textKeepPlace.Text; fix.Keeper = this.name2ID(Empdt, this.textKeeper.Text, "name"); fix.Maintainer = this.cbxMaintainer.Text; fix.MAgent = this.name2ID(Empdt, _user, "name"); fix.MDate = this.dtpMDate.Value; fix.RDate = this.dtpRDate.Value; fix.mRemark = this.textFixRemark.Text; bool flag; if (updata_flag) { flag = FixMgr.MUpdate(ID, fix); if (flag) { untCommon.InfoMsg("修改成功。"); } else { untCommon.InfoMsg("修改失败。"); } } else { if (IsEqAvailable(this.textEqNO.Text)) { if (_power == "0" || _power == "1") { flag = FixMgr.AddWithoutVerify(fix); } else { flag = FixMgr.Add(fix); } flag = EqMgr.FixEq(fix.EqNo); if (flag) { untCommon.InfoMsg("送修成功。"); } else { untCommon.InfoMsg("送修失败。"); } } else { untCommon.InfoMsg("该资产状态已改变,无法修改该信息。"); } } this.DialogResult = DialogResult.OK; }