/// <summary> /// 构造函数 /// </summary> /// <param name="status"></param> /// <param name="id"></param> public DevAcceptanceBill(winStatusEnum status, AcceptanceBill ab = null) { InitializeComponent(); SetFormStatus(status); if (ab == null) m_acceptance_bill = new AcceptanceBill(); else m_acceptance_bill = ab; }
/// <summary> /// 构造函数 /// </summary> /// <param name="status"></param> /// <param name="balance"></param> public DevBalance(winStatusEnum status, Balance balance = null) { InitializeComponent(); if (balance != null) m_balance = balance; else m_balance = new Balance(); SetFromStatus(status); }
public DevContract(winStatusEnum status, Contract con = null) { InitializeComponent(); if (con != null) m_contract = con; else m_contract = new Contract(); SetFormStatus(status); }
public DevUnAuth(winStatusEnum status, UnAuth unauth = null) { InitializeComponent(); SetFormStatus(status); _unauth = unauth; if (status == winStatusEnum.新增) _unauth = new UnAuth(); Object2Form(); }
/// <summary> /// 编辑资金 /// </summary> private void EditAccount(winStatusEnum status = winStatusEnum.编辑) { if (gridView1.FocusedRowHandle < 0) return; long id = long.Parse(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, col_id).ToString()); DevMain main = (DevMain)this.ParentForm; main.OpenForm(new DevAccount(status, Account.CreateByID(id))); return; }
// 构造函数 public DevUser(User user = null) { InitializeComponent(); if (user != null) { m_user = user; m_status = winStatusEnum.编辑; } else { m_user = new User(); m_status = winStatusEnum.新增; } }
private winStatusEnum _status; // 当前窗口的状态,象新增之类的 #endregion Fields #region Constructors /// <summary> /// 构造函数 /// </summary> /// <param name="account"></param> public DevAccount(winStatusEnum status, Account account = null, long applyid = 0, long BalanceID = 0, long acceptid = 0) { InitializeComponent(); if (account != null) _account = account; else _account = new Account(); // 保存传过来的对应的贷款或合同ID或者合同验收号 if (applyid > 0) _account.ContractApplyID = applyid; if (BalanceID > 0) _account.BalanceID = BalanceID; if (acceptid > 0) _account.ContractAcceptID = acceptid; SetFormStatus(status); }
private void tsbNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { m_user = new User(); m_status = winStatusEnum.新增; MyRefresh(); }
private void SetFormStatus(winStatusEnum status) { m_status = status; bar1.Visible = true; bar2.Visible = false; bar3.Visible = false; switch (status) { case winStatusEnum.新增: case winStatusEnum.编辑: tbNew.Enabled = false; tbEdit.Enabled = false; tbDelete.Enabled = false; tbSave.Enabled = true; tbCheckPassed.Enabled = false; tbCheckFaild.Enabled = false; // 支付申请不能编辑 layoutControl2.Enabled = false; bar2.Visible = false; SetControlStatus(true); break; case winStatusEnum.查看: tbNew.Enabled = true; tbEdit.Enabled = true; tbDelete.Enabled = true; tbSave.Enabled = false; tbCheckPassed.Enabled = false; tbCheckFaild.Enabled = false; layoutControl2.Enabled = false; bar2.Visible = false; SetControlStatus(false); break; case winStatusEnum.复核: tbNew.Enabled = false; tbEdit.Enabled = false; tbDelete.Enabled = false; tbSave.Enabled = false; tbCheckPassed.Enabled = true; tbCheckFaild.Enabled = true; layoutControl2.Enabled = false; bar2.Visible = false; SetControlStatus(false); break; case winStatusEnum.付款申请: bar1.Visible = false; bar2.Visible = true; bar2.Offset = 0; xtraTabControl1.SelectedTabPage = xtraTabPage4; dtApplyDate.EditValue = DateTime.Now; // 支付申请能编辑 layoutControl2.Enabled = true; SetControlStatus(false); break; case winStatusEnum.设置决算价: bar1.Visible = false; bar2.Visible = false; bar3.Visible = true; SetControlStatus(false); calcCostMoney.Enabled = true; tbSave2.Caption = "保存决算价"; break; case winStatusEnum.设置审计价: bar1.Visible = false; bar2.Visible = false; bar3.Visible = true; SetControlStatus(false); txtCheckMoney.Enabled = true; tbSave2.Caption = "保存审计价"; break; } }
private void tsbSave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { txtCode.Focus(); txtName.Focus(); // 如果校验不通过,直接返回 if (!verifyData()) return; // 如果设置了密码,则加上 if (!string.IsNullOrEmpty(txtPassword.Text)) m_user.Password = txtPassword.Text; m_user.Save(); MessageBox.Show("用户保存成功!", "注意"); m_status = winStatusEnum.查看; MyRefresh(); }
/// <summary> /// 设置窗口的状态 /// </summary> /// <param name="status"></param> private void SetFromStatus(winStatusEnum status) { m_status = status; switch (status) { case winStatusEnum.新增: case winStatusEnum.编辑: btnNew.Enabled = false; btnEdit.Enabled = false; btnDelete.Enabled = false; btnSave.Enabled = true; btnCheck.Enabled = false; btnCheckFaild.Enabled = false; SetControlStatus(true); break; case winStatusEnum.查看: btnNew.Enabled = false; btnEdit.Enabled = false; btnDelete.Enabled = false; btnSave.Enabled = true; btnCheck.Enabled = false; btnCheckFaild.Enabled = false; SetControlStatus(false); break; case winStatusEnum.复核: barCheck.Visible = true; barNormal.Visible = false; SetControlStatus(false); break; case winStatusEnum.纯查看: btnNew.Enabled = true; btnEdit.Enabled = false; btnDelete.Enabled = false; btnSave.Enabled = false; btnCheck.Enabled = false; btnCheckFaild.Enabled = false; SetControlStatus(false); break; } }
// 取消支付 private void tbUnPay_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { _account.UnPayed(); ShowCheckPayPic(); tbUnPay.Enabled = false; tbPay.Enabled = true; tbPrint.Enabled = false; _status = winStatusEnum.纯查看; // 保证退出时不会提示 }
private void SetFormStatus(winStatusEnum status) { _status = status; switch (status) { case winStatusEnum.新增: tsbNew.Enabled = false; tsbEdit.Enabled = false; tsbDelete.Enabled = false; tsbSave.Enabled = true; SetEditorStatus(true); break; case winStatusEnum.编辑: tsbNew.Enabled = false; tsbEdit.Enabled = false; tsbDelete.Enabled = false; tsbSave.Enabled = true; SetEditorStatus(true); break; case winStatusEnum.查看: tsbNew.Enabled = true; tsbEdit.Enabled = true; tsbDelete.Enabled = true; tsbSave.Enabled = false; SetEditorStatus(false); break; } }
private void tsbEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (m_user != null) { m_status = winStatusEnum.编辑; MyRefresh(); } }
/// <summary> /// 设置当前窗口状态,也就是控制几个按钮的状态 /// </summary> /// <param name="status"></param> private void setWinStatus(winStatusEnum status) { m_status = status; switch (status) { case winStatusEnum.查看: tsbDelete.Enabled = true; tsbEdit.Enabled = true; tsbNew.Enabled = true; tsbSave.Enabled = false; break; case winStatusEnum.编辑: tsbDelete.Enabled = false; tsbEdit.Enabled = false; tsbNew.Enabled = false; tsbSave.Enabled = true; break; case winStatusEnum.新增: tsbDelete.Enabled = false; tsbEdit.Enabled = false; tsbNew.Enabled = false; tsbSave.Enabled = true; break; } }
/// <summary> /// 付款申请保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tbApplySave_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { // 先将界面的数据保存到对象里 ContractApply apply = new ContractApply() { ContractID = m_contract.ID, ApplyDate = DateTime.Parse(dtApplyDate.EditValue.ToString()) }; if (calcApplyMoney.EditValue != null) apply.Money = decimal.Parse(calcApplyMoney.EditValue.ToString()); apply.Memo = txtApplyMemo.Text; // 判断是否通过校验 if (!apply.InsertUpdateVerify()) { dxErrorProvider1.ClearErrors(); dxErrorProvider1.SetError(calcApplyMoney, apply.ErrorString); return; } else { apply.Save(); tbApplySave.Enabled = false; layoutControl2.Enabled = false; m_status = winStatusEnum.查看; MessageBox.Show("合同付款申请保存成功!", "注意"); } }
/// <summary> /// 根据是编辑 还是新增,设置按钮的状态 /// </summary> /// <param name="status"></param> private void SetFormStatus(winStatusEnum status) { m_status = status; switch (status) { case winStatusEnum.新增: tsbNew.Enabled = false; tsbEdit.Enabled = false; tsbSave.Enabled = true; SetControlStatus(true); // 控件可用 break; case winStatusEnum.编辑: tsbNew.Enabled = false; tsbEdit.Enabled = false; tsbSave.Enabled = true; SetControlStatus(true); // 控件可用 break; case winStatusEnum.查看: tsbNew.Enabled = true; tsbEdit.Enabled = true; tsbSave.Enabled = false; SetControlStatus(false); // 控件不可使用 break; } }
private void SetFormStatus(winStatusEnum status) { _status = status; switch (status) { case winStatusEnum.查看: tsbNew.Enabled = true; tsbEdit.Enabled = true; tsbDelete.Enabled = true; tsbSave.Enabled = false; gridView1.OptionsBehavior.Editable = false; break; case winStatusEnum.编辑: tsbNew.Enabled = false; tsbEdit.Enabled = false; tsbDelete.Enabled = false; tsbSave.Enabled = true; gridView1.OptionsBehavior.Editable = true; break; case winStatusEnum.新增: tsbNew.Enabled = false; tsbEdit.Enabled = false; tsbDelete.Enabled = false; tsbSave.Enabled = true; gridView1.OptionsBehavior.Editable = true; break; } }
private void tbSave2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (!Verify()) return; m_contract.Save(); MessageBox.Show("保存成功!"); tbSave2.Enabled = false; m_status = winStatusEnum.查看; }
/// <summary> /// 设置当前的状态,是新增,编辑,还是查看 /// </summary> /// <param name="status"></param> private void SetFormStatus(winStatusEnum status) { _status = status; switch (status) { case winStatusEnum.新增: tbNew.Enabled = false; tbEdit.Enabled = false; tbDelete.Enabled = false; tbSave.Enabled = true; tbCheck.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbUnCheck.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbPay.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbUnPay.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tb2Invoice.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbPrint.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; SetEditorStatus(true); break; case winStatusEnum.编辑: tbNew.Enabled = false; tbEdit.Enabled = false; tbDelete.Enabled = false; tbSave.Enabled = true; tbCheck.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbUnCheck.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbPay.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbUnPay.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tb2Invoice.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbPrint.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; SetEditorStatus(true); break; case winStatusEnum.查看: tbNew.Enabled = true; tbEdit.Enabled = true; tbDelete.Enabled = true; tbSave.Enabled = false; tbCheck.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbUnCheck.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbPay.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbUnPay.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tb2Invoice.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbPrint.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; SetEditorStatus(false); break; case winStatusEnum.复核: tbNew.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbEdit.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbDelete.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbSave.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbCheck.Enabled = true; tbUnCheck.Enabled = false; tbPay.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbUnPay.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tb2Invoice.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbPrint.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; SetEditorStatus(false); break; case winStatusEnum.撤消: tbNew.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbEdit.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbDelete.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbSave.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbCheck.Enabled = false; tbUnCheck.Enabled = true; tbPay.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbUnPay.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tb2Invoice.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbPrint.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; SetEditorStatus(false); break; case winStatusEnum.纯查看: tbNew.Enabled = false; tbEdit.Enabled = false; tbDelete.Enabled = false; tbSave.Enabled = false; tbCheck.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbUnCheck.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbPay.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbUnPay.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tb2Invoice.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbPrint.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; break; case winStatusEnum.审核: tbNew.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbEdit.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbDelete.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbSave.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbCheck.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbUnCheck.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbPay.Enabled = true; tbUnPay.Enabled = false; tb2Invoice.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbPrint.Enabled = false; //m_account.CanPrint(); SetEditorStatus(false); break; case winStatusEnum.撤审: tbNew.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbEdit.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbDelete.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbSave.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbCheck.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbUnCheck.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbPay.Enabled = false; tbUnPay.Enabled = true; tb2Invoice.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbPrint.Enabled = _account.CanPrint(); SetEditorStatus(false); break; case winStatusEnum.转正式发票: tbNew.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbEdit.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbDelete.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbSave.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbCheck.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbUnCheck.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbPay.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tbUnPay.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; tb2Invoice.Enabled = true; tbPrint.Visibility = DevExpress.XtraBars.BarItemVisibility.Never; SetEditorStatus(false); break; } }
// 转正式发票 private void tb2Invoice_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (!chkRelease.Checked) { _account.ConverInvoice(); //SetFormStatus(winStatusEnum.纯查看); //审核通过后,只能看。 ShowCheckPayPic(); tb2Invoice.Enabled = false; chkRelease.Checked = true; _status = winStatusEnum.纯查看; // 保证退出时不会提示 } }
private void tsbDelete_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (MessageBox.Show(this, "是否要删除指定的数据?", "警告", MessageBoxButtons.YesNoCancel) == DialogResult.Yes) { if (m_user != null && m_user.ID > 0 && m_user.Name != "admin") { m_user.Destory(); m_user = new User(); m_status = winStatusEnum.查看; MyRefresh(); } } }