private void btnAddUpdateBanks_Click(object sender, System.Windows.RoutedEventArgs e) { string bankName = txtBankName.Text.Trim(); if (string.IsNullOrEmpty(bankName)) { MessageBox.Show("Ingrese un nombre para el banco", "Información", MessageBoxButton.OK, MessageBoxImage.Information); return; } if (_isUpdateBank) { _bankToUpdate.Name = bankName; UpdateBank(_bankToUpdate); } else { Model.Bank bankToAdd = new Model.Bank() { Name = bankName, IsDeleted = false }; AddBank(bankToAdd); } }
private void Insert(Model.Bank bank, Utility.CRUD cru, Model.BrankBank branch = null) { if (insert != null) { insert(bank, cru, branch); } }
public override void Refresh() { if (this.bank == null) { this.bank = new Book.Model.Bank(); this.action = "insert"; } this.bindingSourceBank.DataSource = this.bankManager.Select(); this.textEditName.Text = this.bank.BankName; this.textEditDescription.Text = this.bank.Description; switch (this.action) { case "insert": this.textEditName.Properties.ReadOnly = false; this.textEditDescription.Properties.ReadOnly = false; break; case "update": this.textEditName.Properties.ReadOnly = false; this.textEditDescription.Properties.ReadOnly = false; break; case "view": this.textEditName.Properties.ReadOnly = true; this.textEditDescription.Properties.ReadOnly = true; break; default: break; } base.Refresh(); }
protected override void Delete() { if (this.bank == null) { return; } if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK) { return; } try { this.bankManager.Delete(this.bank.BankId); this.bank = this.bankManager.GetNext(this.bank); if (this.bank == null) { this.bank = this.bankManager.GetLast(); } } catch { throw; } return; }
private void InsertOrUpdate(Model.Bank bank, Utility.CRUD cru, Model.BrankBank branch = null) { if (bank != null && branch == null) { if (cru == CRUD.Insert) { gridUtility1.AddNewRow(bank); } if (cru == CRUD.Update) { gridUtility1.UpdateRow(bank); } } if (branch != null && bank != null) { if (cru == CRUD.Insert) { gridUtility2.AddNewRow(branch); } if (cru == CRUD.Update) { gridUtility2.UpdateRow(branch); } } }
/// <summary> /// Update a Bank. /// </summary> public void Update(Model.Bank bank) { // // todo: add other logic here. // Validate(bank); bank.UpdateTime = DateTime.Now; accessor.Update(bank); }
public void MyClick(ref ChooseItem item) { ChooseBankForm f = new ChooseBankForm(); if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Model.Bank bank = f.SelectedItem as Model.Bank; item = new ChooseItem(bank, bank.BankName, ""); } }
/// <summary> /// Insert a Bank. /// </summary> public void Insert(Model.Bank bank) { // // todo:add other logic here // Validate(bank); bank.InsertTime = DateTime.Now; bank.BankId = Guid.NewGuid().ToString(); accessor.Insert(bank); }
protected override void MoveNext() { Model.Bank bank = this.bankManager.GetNext(this.bank); if (bank == null) { throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows); } this.bank = bank; }
public PaymentActionCommand(long id, PaymentStatus status, Model.Bank bank, Officer officer, IEventBus eventBus) { _id = id; _status = status; _officer = officer; _bank = bank; _eventBus = eventBus; }
/// <summary> /// gridview3单击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gridView3_Click(object sender, EventArgs e) { Model.Bank bank = this.bindingSource_bank.Current as Model.Bank; if (bank != null) { this.currentBank = bank; this.action = "view"; this.Refresh(); } }
private void Validate(Model.Bank bank) { if (string.IsNullOrEmpty(bank.BankName)) { throw new Helper.RequireValueException(Model.Bank.PROPERTY_BANKNAME); } if (accessor.IsEixstsBankName(bank.BankId, bank.BankName)) { throw new Helper.InvalidValueException(Model.Bank.PROPERTY_BANKNAME); } }
private void gridViewBank_DoubleClick(object sender, EventArgs e) { Model.Bank bank = gridUtility1.GetSelectedItem <Model.Bank>(); if (bank == null) { return; } frmEditBankUpdate obj = new frmEditBankUpdate(bank); obj.updateBank = InsertOrUpdate; obj.ShowDialog(); }
private void gridViewBank_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { Model.Bank bank = gridUtility1.GetSelectedItem <Model.Bank>(); IList <Model.BrankBank> lstBranch = new List <Model.BrankBank>(); using (IUnitOfWork uow = new UnitOfWork()) { lstBranch = uow.BrankBankBaseRepository.GetAllBrankByBankID(bank.BankId.ToString()); uow.Commit(); } gridUtility2.BindingData(lstBranch); }
public AddEditBanksModal(Model.Bank bankToUpdate) { this.InitializeComponent(); _bankToUpdate = bankToUpdate; _isUpdateBank = _bankToUpdate != null; if (_isUpdateBank) { PrepareWindowForUpdates(); } }
private void savebtn_Click(object sender, RoutedEventArgs e) { Mouse.OverrideCursor = Cursors.Wait; if (SystemClass.CheckConnection()) { ImusCityHallEntities db = new ImusCityHallEntities(); if (String.IsNullOrEmpty(bankcodetb.Text) || String.IsNullOrEmpty(banknametb.Text)) { MessageBox.Show("Please input bank code and bank name"); } else if (String.IsNullOrEmpty(branchtb.Text)) { MessageBox.Show("Please enter branch name"); } else if (db.Banks.Any(m => m.BankCode == bankcodetb.Text)) { MessageBox.Show("The bank code is already used"); } else { ImusCityGovernmentSystem.Model.Bank bank = new Model.Bank(); bank.BankCode = bankcodetb.Text; bank.BankName = banknametb.Text; bank.Branch = branchtb.Text; bank.IsActive = true; db.Banks.Add(bank); db.SaveChanges(); Mouse.OverrideCursor = null; var audit = new AuditTrailModel { Activity = "Added new bank in the database. BANK CODE: " + bankcodetb.Text, ModuleName = this.GetType().Name, EmployeeID = App.EmployeeID }; SystemClass.InsertLog(audit); MessageBox.Show("New item added successfully."); SystemClass.ClearTextBoxes(this); } } else { Mouse.OverrideCursor = null; MessageBox.Show(SystemClass.DBConnectionErrorMessage); } Mouse.OverrideCursor = null; }
private void InsertOrUpdate(Model.Bank bank, Utility.CRUD cru, Model.BrankBank branch = null) { if (cru == CRUD.Insert) { //add parent node BANK if (bank != null && branch == null) { object obj = createObject(bank); TreeListNode node = treeList1.AppendNode(obj, treeList1.AllNodesCount); node.Tag = "Parent"; } //add child node BRANCH if (branch != null && bank != null) { object obj2 = createObject(null, branch); //Find parent node TreeListNode node = treeList1.AppendNode(obj2, findBankNode(bank.BankId.ToString())); node.Tag = "Child"; } } if (cru == CRUD.Update) { //update parent node BANK if (bank != null && branch == null) { TreeListNode node = treeList1.Selection[0]; node.SetValue("BankCode", bank.BankCode); node.SetValue("BankName", bank.BankName); node.SetValue("Phone", bank.Phone); node.SetValue("Fax", bank.Fax); node.SetValue("Email", bank.Email); node.SetValue("Address", bank.Address); node.SetValue("Note", bank.Note); node.SetValue("ModifyDate", bank.ModifyDate); node.SetValue("ModifyBy", bank.ModifyBy); } //update child node BRANCH if (branch != null && bank != null) { TreeListNode node = treeList1.Selection[0]; node.SetValue("BankName", branch.BrankName); node.SetValue("Phone", branch.Phone); node.SetValue("Address", branch.BrankAddress); node.SetValue("Note", branch.Note); node.SetValue("ModifyDate", branch.ModifyDate); node.SetValue("ModifyBy", branch.ModifyBy); } } }
public void MyLeave(ref ChooseItem item) { BL.BankManager bankmanager = new Book.BL.BankManager(); Model.Bank bank = bankmanager.SelectByName(item.ButtonText); if (bank != null) { item.EditValue = bank; item.LabelText = bank.Id; item.ButtonText = bank.BankName; } else { item.ErrorMessage = Properties.Resources.ChooseEmployeeError; } }
//gridview的click點擊事件 -----myj private void gridView1_Click(object sender, EventArgs e) { GridView view = sender as GridView; GridHitInfo hitInfo = view.CalcHitInfo(view.GridControl.PointToClient(Cursor.Position)); if (hitInfo.InRow && !view.IsGroupRow(hitInfo.RowHandle)) { Model.Bank bank = this.bindingSourceBank.Current as Model.Bank; if (bank != null) { this.bank = bank; this.action = "view"; this.Refresh(); } } }
private void DeleteBank() { int i = gridViewBank.GetSelectedRows()[0]; Model.Bank branch = gridUtility1.GetSelectedItem <Model.Bank>(); DialogResult result = FormUtility.MsgDelete(); if (result == DialogResult.Yes) { using (IUnitOfWork uow = new UnitOfWork()) { uow.BankBaseRepository.Remove(branch); uow.Commit(); } gridViewBank.DeleteRow(i); } }
private void lue_AccountName_EditValueChanged(object sender, EventArgs e) { if (this.lue_AccountName.EditValue != null) { Model.Bank bank = (this.bindingSourceBank.DataSource as IList <Model.Bank>).First(B => B.BankId == this.lue_AccountName.EditValue.ToString()); this.txt_AccountNo.Text = bank.Id; this.txt_BankName.Text = bank.BankName; this.txt_BankAddress.Text = bank.BankAddress; this.txt_SWIFTCode.Text = bank.SWIFTCode; } else { this.txt_AccountNo.Text = ""; this.txt_BankName.Text = ""; this.txt_BankAddress.Text = ""; this.txt_SWIFTCode.Text = ""; } }
//新增 protected override void AddNew() { switch (pageindex) { case 0: this.academ = new Book.Model.AcademicBackGround(); this.academ.AcademicBackGroundId = Guid.NewGuid().ToString(); break; case 1: this.currentduty = new Book.Model.Duty(); this.currentduty.DutyId = Guid.NewGuid().ToString(); break; case 2: this.currentBank = new Book.Model.Bank(); this.currentBank.BankId = Guid.NewGuid().ToString(); break; case 3: this.currentcompany = new Book.Model.Company(); this.currentcompany.CompanyId = Guid.NewGuid().ToString(); break; case 4: this.currentbusinessHours = new Book.Model.BusinessHours(); this.currentbusinessHours.BusinessHoursId = Guid.NewGuid().ToString(); break; case 5: this.currentleaveType = new Book.Model.LeaveType(); this.currentleaveType.LeaveTypeId = Guid.NewGuid().ToString(); break; case 6: this.currentAnnualholiday = new Book.Model.AnnualHoliday(); this.currentAnnualholiday.AnnualHolidayId = Guid.NewGuid().ToString(); break; case 7: break; } }
private object createObject(Model.Bank bank = null, BrankBank branch = null) { object obj = null; //insert for bank if (bank != null && branch == null) { obj = new object[] { bank.BankId, bank.BankCode, bank.BankName, bank.Address, bank.Phone, bank.Fax, bank.Email, bank.Note, bank.CreateDate, bank.CreateBy, bank.ModifyDate, bank.ModifyBy }; } if (bank == null && branch != null) { obj = new object[] { branch.BrankBankID, null,//code branch.BrankName, branch.BrankAddress, branch.Phone, null, //fax null, //email branch.Note, branch.CreateDate, branch.CreateBy, branch.ModifyDate, branch.ModifyBy }; } return(obj); }
public AddEditPaymentModal(Model.Payment paymentToUpdate, PaymentType paymentType, PaymentControl paymentControl, Model.Bank bank) { this.InitializeComponent(); _bank = bank; _paymentControl = paymentControl; _paymentType = paymentType; _paymentToUpdate = paymentToUpdate; _isUpdatePayment = _paymentToUpdate != null; FillBanks(); AdjustWindowForPaymentType(); if (_isUpdatePayment) { PrepareWindowForUpdates(); } this.Title += " (" + paymentType.ToString() + ")"; }
public override void Refresh() { if (this.bank == null) { this.bank = new Book.Model.Bank(); this.action = "insert"; } this.bindingSourceBank.DataSource = this.bankManager.Select(); this.textEditName.Text = this.bank.BankName; this.textEditAddress.Text = this.bank.BankAddress; this.txt_Id.Text = this.bank.Id; this.spe_OrderID.EditValue = this.bank.OrderId; this.txt_SWIFTCode.Text = this.bank.SWIFTCode; this.txt_Tel.EditValue = this.bank.BankPhone; this.txt_Fax.EditValue = this.bank.Fax; switch (this.action) { case "insert": this.textEditName.Properties.ReadOnly = false; this.textEditAddress.Properties.ReadOnly = false; break; case "update": this.textEditName.Properties.ReadOnly = false; this.textEditAddress.Properties.ReadOnly = false; break; case "view": this.textEditName.Properties.ReadOnly = true; this.textEditAddress.Properties.ReadOnly = true; break; default: break; } base.Refresh(); }
private void btnSave_Click(object sender, EventArgs e) { if (!ValidationUtility.FieldNotAllowNull(this)) { return; } Model.Bank bank = new Model.Bank(); CoverObjectUtility.GetAutoBindingData(this, bank); //bank.BankCode = txtCode.Text; //bank.BankName = txtName.Text; //bank.Address = txtAddress.Text; //bank.Phone = txtPhone.Text; //bank.Fax = txtFax.Text; //bank.Email = txtEmail.Text; //bank.Note = txtNote.Text; bank.SetCreate(); if (bank == null) { return; } try { using (IUnitOfWork uow = new UnitOfWork()) { uow.BankBaseRepository.Add(bank); uow.Commit(); } labelNotify1.SetText(UI.createsuccess, ToolBoxCS.LabelNotify.EnumStatus.Success); if (addnewBank != null) { addnewBank(bank, CRUD.Insert); } Close(); } catch { labelNotify1.SetText(UI.createfailed, ToolBoxCS.LabelNotify.EnumStatus.Failed); } }
private Model.Bank getBankRecord(TreeListNode node) { if (node == null) { return(null); } Model.Bank bank = new Model.Bank(); UtilityFunction.ConvertTreeListNodeToObj <Model.Bank>(treeList1, node, bank); //bank.BankId = Convert.ToInt32(node.GetDisplayText("BankId")); //bank.BankCode = node.GetDisplayText("BankCode"); //bank.BankName = node.GetDisplayText("BankName"); //bank.Address = node.GetDisplayText("Address"); //bank.Phone = node.GetDisplayText("Phone"); //bank.Fax = node.GetDisplayText("Fax"); //bank.Email = node.GetDisplayText("Email"); //bank.Note = node.GetDisplayText("Note"); //bank.CreateDate = string.IsNullOrWhiteSpace(node.GetDisplayText("CreateDate"))==false? Convert.ToDateTime(node.GetDisplayText("CreateDate")):DateTime.Now; //bank.CreateBy = node.GetDisplayText("CreateBy"); //if (!string.IsNullOrEmpty(node.GetDisplayText("ModifyDate"))) // bank.ModifyDate = Convert.ToDateTime(node.GetDisplayText("ModifyDate")); //bank.ModifyBy = node.GetDisplayText("ModifyBy"); return(bank); }
protected override void AddNew() { this.bank = new Model.Bank(); }
/// <summary> /// 有参数的构造函数 -----myj /// </summary> /// <param name="Bank">实体对象</param> /// <param name="action">動作</param> public EditForm(Model.Bank Bank, string action) { this.bank = Bank; this.action = action; }
/// <summary> /// 有参数的构造函数 -----myj /// </summary> /// <param name="Bank">实体对象</param> public EditForm(Model.Bank Bank) { this.bank = Bank; this.action = "update"; }
protected override void MoveLast() { this.bank = this.bankManager.GetLast(); }
protected override void MoveFirst() { this.bank = this.bankManager.GetFirst(); }
public Model.Bank GetNext(Model.Bank e) { return(accessor.GetNext(e)); }