/// <summary> /// delete partner selected with the Partner Find Screen /// </summary> public static Boolean DeletePartnerRecord(Form AParentForm) { Boolean ResultValue = false; Int64 PartnerKey = -1; String ShortName; TPartnerClass?PartnerClass; TLocationPK ResultLocationPK; // the user has to select an existing partner to make that partner a supplier if (TPartnerFindScreenManager.OpenModalForm("", out PartnerKey, out ShortName, out PartnerClass, out ResultLocationPK, AParentForm)) { ResultValue = DeletePartner(PartnerKey, AParentForm); } return(ResultValue); }
/// <summary> /// create a new supplier /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void NewSupplier(object sender, EventArgs e) { Int64 PartnerKey = -1; String ResultStringLbl; TPartnerClass?PartnerClass; TLocationPK ResultLocationPK; // the user has to select an existing partner to make that partner a supplier if (TPartnerFindScreenManager.OpenModalForm("", TPartnerClass.ORGANISATION, out PartnerKey, out ResultStringLbl, out PartnerClass, out ResultLocationPK, FMainForm)) { TFrmAPEditSupplier frm = new TFrmAPEditSupplier(FMainForm); frm.LedgerNumber = FMainForm.LedgerNumber; frm.CreateNewSupplier(PartnerKey); frm.Show(); } }
/// <summary> /// Opens the Partner Find screen (or activates it in case a non-modal instance was already open and /// ARestrictToPartnerClasses is null). If ARestrictToPartnerClasses isn't null then the screen is opened modally. /// </summary> /// <remarks> /// For NUnit tests that just try to open the Partner Find screen but which don't instantiate a Main Form /// we need to ignore the <paramref name="AParentForm" /> Argument as it will be null in those cases! /// </remarks> /// <returns>void</returns> public static void FindPartnerOfClass(Form AParentForm, string ARestrictToPartnerClasses = null, TPartnerEditTabPageEnum APreferredInitialTabPage = TPartnerEditTabPageEnum.petpAddresses) { if (ARestrictToPartnerClasses == null) { // No Cursor change if run from within NUnit Test without Main Form instance... if (AParentForm != null) { AParentForm.Cursor = Cursors.WaitCursor; } TPartnerFindScreen PartnerFindForm = new TPartnerFindScreen(AParentForm); PartnerFindForm.SetParameters(false, -1); PartnerFindForm.Show(); // No Cursor change if run from within NUnit Test without Main Form instance... if (AParentForm != null) { AParentForm.Cursor = Cursors.Default; } } else { long PartnerKey; string ShortName; TPartnerClass?PartnerClass; TLocationPK LocationPK; if (TPartnerFindScreenManager.OpenModalForm(ARestrictToPartnerClasses, out PartnerKey, out ShortName, out PartnerClass, out LocationPK, AParentForm)) { // Open the Partner Edit screen TFrmPartnerEdit PartnerEditForm; // No Cursor change if run from within NUnit Test without Main Form instance... if (AParentForm != null) { AParentForm.Cursor = Cursors.WaitCursor; } PartnerEditForm = new TFrmPartnerEdit(AParentForm); if (APreferredInitialTabPage == TPartnerEditTabPageEnum.petpAddresses) { PartnerEditForm.SetParameters(TScreenMode.smEdit, PartnerKey, LocationPK.SiteKey, LocationPK.LocationKey); } else { PartnerEditForm.SetParameters(TScreenMode.smEdit, PartnerKey, APreferredInitialTabPage); } PartnerEditForm.Show(); if (ARestrictToPartnerClasses.Split(new Char[] { (',') })[0] == "PERSON") { TUserDefaults.SetDefault(TUserDefaults.USERDEFAULT_LASTPERSONPERSONNEL, PartnerKey); } else { TUserDefaults.SetDefault(TUserDefaults.USERDEFAULT_LASTPARTNERMAILROOM, PartnerKey); } // No Cursor change if run from within NUnit Test without Main Form instance... if (AParentForm != null) { AParentForm.Cursor = Cursors.Default; } } } }