private void FormCustomerItemDiscount_FormClosed(object sender, FormClosedEventArgs e) { try { CustomerCopanyDiscount updatedCustomerCopanyDiscount = (sender as frmCustomerItemDiscountMaster).retCustomerCopanyDiscount; (dgvCompanyDiscount.Rows[dgvCompanyDiscount.SelectedCells[0].RowIndex].DataBoundItem as CustomerCopanyDiscount).CustomerItemDiscountMapping = updatedCustomerCopanyDiscount.CustomerItemDiscountMapping; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public frmCustomerItemDiscountMaster(CustomerCopanyDiscount CustomerCopanyDiscount) { try { InitializeComponent(); ExtensionMethods.SetChildFormProperties(this); ExtensionMethods.FormLoad(this, "Customer Item Discount"); this.retCustomerCopanyDiscount = CustomerCopanyDiscount; applicationFacade = new ApplicationFacade(ExtensionMethods.LoggedInUser); } 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) { CustomerCopanyDiscount existingItem = (CustomerCopanyDiscount)dgvCompanyDiscount.Rows[dgvCompanyDiscount.SelectedCells[0].RowIndex].DataBoundItem; frmCustomerItemDiscountMaster form = new frmCustomerItemDiscountMaster(existingItem); form.FormClosed += FormCustomerItemDiscount_FormClosed; form.Show(); } } } else if (keyData == Keys.F1) { ///DO NOT REMOVE BELOW CODE AS ITS WORKING FUNCTIONALITY /// //TextBox activePersonRouteType = new TextBox(); //string activePersonRouteTypeString = String.Empty; //switch (this.ActiveControl.Name) //{ // case "tbxZSM": // { // activePersonRouteType = tbxZSM; // activePersonRouteTypeString = Constants.RecordType.ZSMDISPLAYNAME; // } // break; // case "tbxRSM": // { // activePersonRouteType = tbxRSM; // activePersonRouteTypeString = Constants.RecordType.RSMDISPLAYNAME; // } // break; // case "tbxASM": // { // activePersonRouteType = tbxASM; // activePersonRouteTypeString = Constants.RecordType.ASMDISPLAYNAME; // } // break; // case "tbxSalesman": // { // activePersonRouteType = tbxSalesman; // activePersonRouteTypeString = Constants.RecordType.SALESMANDISPLAYNAME; // } // break; // case "tbxArea": // { // activePersonRouteType = tbxArea; // activePersonRouteTypeString = Constants.RecordType.AREADISPLAYNAME; // } // break; // case "tbxRoute": // { // activePersonRouteType = tbxRoute; // activePersonRouteTypeString = Constants.RecordType.ROUTEDISPLAYNAME; // } // break; //} //if (!String.IsNullOrWhiteSpace(activePersonRouteTypeString)) //{ // PersonRouteMaster personRouteMaster = new PersonRouteMaster() // { // RecordTypeNme = activePersonRouteTypeString, // PersonRouteID = ExtensionMethods.SafeConversionInt(Convert.ToString(activePersonRouteType.Tag)) ?? 0, // PersonRouteName = activePersonRouteType.Text // }; // frmPersonRouteMaster frmPersonRouteMaster = new frmPersonRouteMaster(); // //Set Child UI // ExtensionMethods.AddChildFormToPanel(this, frmPersonRouteMaster, ExtensionMethods.MainPanel); // frmPersonRouteMaster.WindowState = FormWindowState.Maximized; // frmPersonRouteMaster.FormClosed += FrmPersonRouteMaster_FormClosed; // frmPersonRouteMaster.Show(); // frmPersonRouteMaster.ConfigurePersonRoute(personRouteMaster); //} } return(base.ProcessCmdKey(ref msg, keyData)); }