private void FormSupplierItemDiscountMaster_FormClosed(object sender, FormClosedEventArgs e) { try { SupplierCompanyDiscount updatedSupplierCopanyDiscount = (sender as frmSupplierItemDiscountMaster).retSupplierCopanyDiscount; (dgvCompanyDiscount.Rows[dgvCompanyDiscount.SelectedCells[0].RowIndex].DataBoundItem as SupplierCompanyDiscount).SupplierItemDiscountMapping = updatedSupplierCopanyDiscount.SupplierItemDiscountMapping; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { //Add if (keyData == (Keys.Escape)) { if (this.ActiveControl.Name == "dgvCompanyDiscount") { btnSave.Focus(); } else if (IsInChildMode) { if (DialogResult.Yes == MessageBox.Show(Constants.Messages.ClosePrompt, Constants.Messages.Confirmation, MessageBoxButtons.YesNo, MessageBoxIcon.Warning)) { this.Close(); } } else { this.Close(); } } else if (keyData == (Keys.F9)) { } else if (keyData == (Keys.F3)) { if (dgvCompanyDiscount.SelectedCells.Count > 0) { bool DoesCompanyHaveDiscountMapping = dgvCompanyDiscount.CurrentRow != null && !( String.IsNullOrWhiteSpace(Convert.ToString((dgvCompanyDiscount.CurrentRow.Cells["Normal"].Value))) && String.IsNullOrWhiteSpace(Convert.ToString((dgvCompanyDiscount.CurrentRow.Cells["Breakage"].Value))) && String.IsNullOrWhiteSpace(Convert.ToString((dgvCompanyDiscount.CurrentRow.Cells["Expired"].Value))) ); ///OPen item discount mapping screen only if company discount existing if (DoesCompanyHaveDiscountMapping) { SupplierCompanyDiscount existingItem = (SupplierCompanyDiscount)dgvCompanyDiscount.Rows[dgvCompanyDiscount.SelectedCells[0].RowIndex].DataBoundItem; frmSupplierItemDiscountMaster formSupplierItemDiscountMaster = new frmSupplierItemDiscountMaster(existingItem); formSupplierItemDiscountMaster.FormClosed += FormSupplierItemDiscountMaster_FormClosed; formSupplierItemDiscountMaster.Show(); } } } else if (keyData == Keys.F1) { } return(base.ProcessCmdKey(ref msg, keyData)); }
public frmSupplierItemDiscountMaster(SupplierCompanyDiscount supplierCompanyDiscount) { try { InitializeComponent(); ExtensionMethods.SetChildFormProperties(this); ExtensionMethods.FormLoad(this, "Supplier Item Discount"); this.retSupplierCopanyDiscount = supplierCompanyDiscount; applicationFacade = new ApplicationFacade(ExtensionMethods.LoggedInUser); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }