// CheckCondition() // - Check the conditions before transaction // Return Value // - Boolean : Return True/False // Arguments // - FuncName as String : Fuction Name // private bool CheckCondition() { try { if (txtFileName.Text == "") { CmnFunction.ShowMsgBox(modLanguageFunction.GetMessage(6), "FMB Client", MessageBoxButtons.OK, 1); txtFileName.Focus(); return(false); } return(true); } catch (Exception ex) { CmnFunction.ShowMsgBox("frmFMBCreateLayOut.CheckCondition()" + "\r\n" + ex.Message, "FMB Client", MessageBoxButtons.OK, 1); return(false); } }
private void btnOK_Click(object sender, System.EventArgs e) { try { if (txtOperName.Text.Trim().Length == 0) { throw new BusinessException("操作员密码重置", "操作员名称不能为空"); } if (txtPwd.Text.Trim().Length == 0) { throw new BusinessException("操作员密码重置", "操作员密码不能为空"); } if (txtPwdConfirm.Text.Trim().Length == 0) { throw new BusinessException("操作员密码重置", "密码确认不能为空"); } if (txtPwd.Text != txtPwdConfirm.Text) { throw new BusinessException("操作员密码重置", "密码和密码确认不同"); } //Oper oper = new Oper(); //oper.cnvcOperName = txtOperName.Text; //oper.cnvcPwd = DataSecurity.Encrypt(txtPwd.Text); //SecurityManage securityManage = new SecurityManage(); //securityManage.ModifyPwd(oper); Membership.Provider.ChangePassword(txtOperName.Text, "123456", txtPwd.Text); MessageBox.Show(this, "操作员密码修改成功!", "操作员密码修改", MessageBoxButtons.OK, MessageBoxIcon.Information); txtPwd.Text = ""; txtPwdConfirm.Text = ""; txtPwd.Focus(); } catch (BusinessException bex) { MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (System.Exception ex) { MessageBox.Show(this, ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void txtCustomerID_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e) { #region txtCustomerID if (sender == txtCustomerID) { if (e.KeyCode == Keys.PageDown || e.KeyCode == Keys.F3) { return; } if (e.KeyCode.ToString() == "F2") { if (oCustomer.View()) { oPayment.CustomerID = oCustomer.ID; txtCustomerID.Text = oCustomer.ID; txtName.Text = oCustomer.Name; txtAmountDue.Enabled = false; txtAmountDue.Text = oCustomer.StatementAmountDue.ToString(); ctrType.Focus(); //txtAmount.Focus(); } return; } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtCustomerID.Text.Trim().Length == 0) { Clear(); txtCustomerID.Focus(); } if (oCustomer.Find(txtCustomerID.Text)) { oPayment.CustomerID = oCustomer.ID; txtCustomerID.Text = oCustomer.ID; txtName.Text = oCustomer.Name; txtAmountDue.Enabled = false; txtAmountDue.Text = oCustomer.StatementAmountDue.ToString(); //txtAmount.Focus(); ctrType.Focus(); return; } else { Clear(); } } } #endregion #region txtChargeID if (sender == txtChargeID) { if (e.KeyCode.ToString() == "F2") { if (oPayment.View()) { Display(); txtChargeID.Text = oPayment.ID; } return; } if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (oPayment.Find(txtChargeID.Text)) { Display(); txtChargeID.Text = oPayment.ID; } return; } } #endregion #region txtAmount if (sender == txtAmount) { if (e.KeyCode == Keys.Return || e.KeyCode == Keys.Tab) { if (txtAmount.Number != 0.00) { txtComment.Focus(); } return; } } #endregion #region txtText if (sender == txtComment) { if (e.KeyCode != Keys.PageDown) { return; } } #endregion #region Default Option //Default option switch (e.KeyCode) { case Keys.Tab: if (!e.Shift) { this.SelectNextControl(this.ActiveControl, true, true, true, true); } break; case Keys.Enter: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Down: this.SelectNextControl(this.ActiveControl, true, true, true, true); break; case Keys.Up: this.SelectNextControl(this.ActiveControl, false, true, true, true); break; case Keys.F8: break; case Keys.F3: { if (txtChargeID.Text.Trim() != String.Empty) { if (MessageBox.Show("Do you really want to Delete this Record?", "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No) { MessageBox.Show("Operation Cancelled"); return; } else { oPayment.Delete(); oCustomer.GetPayments(); oCustomer.UpdateCurrentTotals(); oCustomer.HasChanged = true; Clear(); txtCustomerID.Focus(); } } } break; case Keys.F7: this.Close(); break; case Keys.PageDown: oPayment.ID = txtChargeID.Text; oPayment.Date = (DateTime)txtDate.Value; oPayment.Comment = txtComment.Text; switch (ctrType.Text) { case "Payment": oPayment.Type = "P"; oPayment.Amount = txtAmount.Number * -1; break; case "Adjustment": oPayment.Type = "A"; oPayment.Amount = txtAmount.Number; break; case "Invoice": oPayment.Type = "I"; // if (txtAmount.Number < 0) oPayment.Amount = txtAmount.Number; break; default: oPayment.Amount = txtAmount.Number; break; } if (txtChargeID.Text == "") { oPayment.Insert(); if (oPayment.Type == "P" && oCustomer.StatementAmountDue != 0) { oCustomer.PrintStatement(null, PrinterDevice.Printer); } } else { oPayment.Save(); } oCustomer.GetPayments(); oCustomer.UpdateCurrentTotals(); oCustomer.HasChanged = true; Clear(); //txtCustomerID.Clear(); txtCustomerID.Focus(); break; } #endregion }
private void ResetBindings() { #region clear Databindings unePrecio.DataBindings.Clear(); uneCantidad.DataBindings.Clear(); unePrecioUnidadOrigen.DataBindings.Clear(); labelCantidadDestino.DataBindings.Clear(); editorID.DataBindings.Clear(); txtDescripcion.DataBindings.Clear(); #endregion #region reset values unePrecio.Value = 0; uneCantidad.Value = 1; //uneCantidad.Value = 0; unePrecioUnidadOrigen.Value = 0; labelUnidadOrigen.Text = ""; labelUnidadDestino.Text = ""; labelFormula.Text = ""; lblCodigoSecundario.Text = ""; lblInfoAdicional1.Text = ""; lblInfoAdicional2.Text = ""; labelCantidadDestino.Text = "0"; /* Silvina 20110217 - Tarea 0000018 */ //editorID.Text = ""; /* Fin Silvina 20110217 - Tarea 0000018 */ txtDescripcion.Text = ""; //German 20090331 //editorID.Focus(); if (encontrado) /* Silvina 20110427 - Tarea 0000018 */ { editorID.Text = ""; editorID.Focus(); } /* Fin Silvina 20110427 - Tarea 0000018 */ //Fin German 20090331 if (_uicontroller.IdListaDePrecios_Search == null || _uicontroller.IdListaDePrecios_Search.Equals(string.Empty)) { mzComboListaDePrecios.Value = _uicontroller.IdListaDePreciosDefault; } else { mzComboListaDePrecios.Value = _uicontroller.IdListaDePrecios_Search; } if (_uicontroller.TipoDePrecioDeCosto_Search == null || _uicontroller.TipoDePrecioDeCosto_Search.Equals(string.Empty)) { cboTipoDePrecioDeCosto.Text = _uicontroller.TipoDePrecioDeCostoDefault; } else { cboTipoDePrecioDeCosto.Text = _uicontroller.TipoDePrecioDeCosto_Search; } #endregion }