private void UpdateUI() { if (FMergedPartnerPartnerKey != -1) { txtMergedPartner.PartnerKey = FMergedPartnerPartnerKey; txtMergedPartner.LabelText = FMergedPartnerPartnerShortName + " [" + SharedTypes.PartnerClassEnumToString(FMergedPartnerPartnerClass) + "]"; if (FMergedIntoPartnerKey != -1) { txtMergedIntoPartner.PartnerKey = FMergedIntoPartnerKey; txtMergedIntoPartner.LabelText = FMergedIntoPartnerShortName; txtMergedIntoPartnerClass.Text = SharedTypes.PartnerClassEnumToString( FMergedIntoPartnerClass); txtMergedBy.Text = FMergedBy; txtMergeDate.Date = FMergeDate; } else { pnlMergedIntoPartner.Visible = false; lblInstructions.Text = MPartnerResourcestrings.StrMergedPartnerNotPossible; btnOK.Enabled = false; } } else { MessageBox.Show("Need to call one of the SetParameters Methods to initialise this Dialog!", "Developer Message"); Close(); } }
private static SponsorshipTDS CreateNewChild() { Int64 SiteKey = DomainManager.GSiteKey; SponsorshipTDS MainDS = new SponsorshipTDS(); Int64 PartnerKey = NewPartnerKey(); DateTime CreationDate = DateTime.Today; string CreationUserID = UserInfo.GetUserInfo().UserID; // Create DataRow for Partner using the default values for all DataColumns // and then modify some. PPartnerRow PartnerRow = MainDS.PPartner.NewRowTyped(true); PartnerRow.PartnerKey = PartnerKey; PartnerRow.DateCreated = CreationDate; PartnerRow.CreatedBy = CreationUserID; PartnerRow.PartnerClass = SharedTypes.PartnerClassEnumToString(TPartnerClass.FAMILY); PartnerRow.StatusCode = SharedTypes.StdPartnerStatusCodeEnumToString(TStdPartnerStatusCode.spscACTIVE); PartnerRow.UserId = CreationUserID; MainDS.PPartner.Rows.Add(PartnerRow); PFamilyRow FamilyRow = MainDS.PFamily.NewRowTyped(true); FamilyRow.PartnerKey = PartnerKey; FamilyRow.DateCreated = CreationDate; FamilyRow.CreatedBy = CreationUserID; MainDS.PFamily.Rows.Add(FamilyRow); PPartnerTypeRow PartnerTypeRow = MainDS.PPartnerType.NewRowTyped(true); PartnerTypeRow.PartnerKey = PartnerKey; PartnerTypeRow.TypeCode = TYPE_SPONSOREDCHILD; MainDS.PPartnerType.Rows.Add(PartnerTypeRow); return(MainDS); }
private void PartnerStatusCodeChangePromotion(System.Object sender, EventArgs e) { string PartnerStatus = cmbPartnerStatus.GetSelectedString(); // Business Rule: if the Partner's StatusCode changes, give the user the // option to promote the change to all Family Members (if the Partner is // a FAMILY and has Family Members). if ((FMainDS != null) && (!FIgnorePartnerStatusChange) && (FPartnerClass == SharedTypes.PartnerClassEnumToString(TPartnerClass.FAMILY))) { if (PartnerStatus != SharedTypes.StdPartnerStatusCodeEnumToString(TStdPartnerStatusCode.spscMERGED)) { if (PartnerStatusCodeChangePromotion(PartnerStatus)) { // Set the StatusChange date (this would be done on the server side // automatically, but we want to display it now for immediate user feedback) FMainDS.PPartner[0].StatusChange = DateTime.Today; } else { // User wants to cancel the change of the Partner StatusCode // Undo the change in the DataColumn FIgnorePartnerStatusChange = true; UndoData(FMainDS.PPartner[0], cmbPartnerStatus); cmbPartnerStatus.SelectNextControl(cmbPartnerStatus, true, true, true, true); FIgnorePartnerStatusChange = false; } } } }
/// <summary> /// convert a partner class given as a string to an enum value /// </summary> /// <param name="APartnerClass">class written as string</param> /// <returns>the correct enum for that partner class</returns> public static TOfficeSpecificDataLabelUseEnum PartnerClassStringToOfficeSpecificDataLabelUseEnum(String APartnerClass) { if (APartnerClass == SharedTypes.PartnerClassEnumToString(TPartnerClass.PERSON)) { return(TOfficeSpecificDataLabelUseEnum.Person); } else if (APartnerClass == SharedTypes.PartnerClassEnumToString(TPartnerClass.FAMILY)) { return(TOfficeSpecificDataLabelUseEnum.Family); } else if (APartnerClass == SharedTypes.PartnerClassEnumToString(TPartnerClass.CHURCH)) { return(TOfficeSpecificDataLabelUseEnum.Church); } else if (APartnerClass == SharedTypes.PartnerClassEnumToString(TPartnerClass.ORGANISATION)) { return(TOfficeSpecificDataLabelUseEnum.Organisation); } else if (APartnerClass == SharedTypes.PartnerClassEnumToString(TPartnerClass.BANK)) { return(TOfficeSpecificDataLabelUseEnum.Bank); } else if (APartnerClass == SharedTypes.PartnerClassEnumToString(TPartnerClass.UNIT)) { return(TOfficeSpecificDataLabelUseEnum.Unit); } else if (APartnerClass == SharedTypes.PartnerClassEnumToString(TPartnerClass.VENUE)) { return(TOfficeSpecificDataLabelUseEnum.Venue); } throw new ArgumentException("Cannot convert the submitted PartnerClass '" + APartnerClass + "' to a TOfficeSpecificDataLabelUseEnum!"); }
/// <summary> /// Tests whether the current user has access to a particular Partner. /// </summary> /// <remarks> /// <para>Corresponds to Progress 4GL Method 'CanAccessPartner' in /// common/sp_partn.p</para> /// <para>A shared implementation of this Method exists that has two additional /// Arguments. It needs the Foundation Row to be passed in, but has the /// advantage of not needing a Server roundtrip for a DB lookup!</para> /// </remarks> /// <param name="APartnerRow">Partner for which access should be checked for.</param> /// <param name="ADataBase">An instantiated <see cref="TDataBase" /> object, or null (default = null). If null /// gets passed then the Method executes DB commands with a new Database connection</param> /// <returns><see cref="T:TPartnerAccessLevelEnum.palGranted" /> if access /// to the Partner is granted, otherwise a different /// <see cref="T:TPartnerAccessLevelEnum" /> value.</returns> public static TPartnerAccessLevelEnum CanAccessPartner( PPartnerRow APartnerRow, TDataBase ADataBase = null) { TDBTransaction ReadTransaction; Boolean NewTransaction; PFoundationTable FoundationTable; if (APartnerRow.PartnerKey != 0) { // If PartnerClass is ORGANISATION, we need to check if it is a Foundation if (APartnerRow.PartnerClass == SharedTypes.PartnerClassEnumToString( TPartnerClass.ORGANISATION)) { TDataBase db = DBAccess.Connect("DetermineBestAddress", ADataBase); ReadTransaction = db.GetNewOrExistingTransaction( IsolationLevel.ReadCommitted, out NewTransaction); // Load Foundation try { FoundationTable = PFoundationAccess.LoadByPrimaryKey(APartnerRow.PartnerKey, ReadTransaction); if (FoundationTable.Rows.Count > 0) { // The ORGANISATION is a Foundation, we need to check Foundation Security return(Ict.Petra.Shared.MPartner.TSecurity.CanAccessPartner(APartnerRow, true, FoundationTable[0])); } else { // The ORGANISATION isn't a Foundation, we don't need to check Foundation Security return(Ict.Petra.Shared.MPartner.TSecurity.CanAccessPartner(APartnerRow, false, null)); } } finally { if (NewTransaction) { ReadTransaction.Commit(); TLogging.LogAtLevel(8, "TSecurity.CanAccessPartnerByKey: committed own transaction."); } } } else { // PartnerClass isn't ORGANISATION, we don't need to check Foundation Security return(Ict.Petra.Shared.MPartner.TSecurity.CanAccessPartner(APartnerRow, false, null)); } } else { // Invalid Partner. Access Level is Granted in this case. return(TPartnerAccessLevelEnum.palGranted); } }
/// <summary> /// Loads FamilyMembers Data from Petra Server into FMainDS. /// /// </summary> /// <returns>true if successful and Family has Family Members, otherwise false. /// //DevAge.ComponentModel.Validator;</returns> public Boolean LoadDataOnDemand() { Boolean ReturnValue; TRecalculateScreenPartsEventArgs RecalculateScreenPartsEventArgs; Int64 FamilyPartnerKey; if (FMainDS.PPartner[0].PartnerClass == SharedTypes.PartnerClassEnumToString(TPartnerClass.FAMILY)) { FamilyPartnerKey = FMainDS.PFamily[0].PartnerKey; } else { FamilyPartnerKey = FMainDS.PPerson[0].FamilyKey; } // retrieve Family Members from PetraServer // If family has no members, returns false try { // Make sure that Typed DataTable is already there at Client side if (FMainDS.FamilyMembers == null) { FMainDS.Tables.Add(new PartnerEditTDSFamilyMembersTable(PartnerEditTDSFamilyMembersTable.GetTableName())); FMainDS.InitVars(); } FMainDS.FamilyMembers.Rows.Clear(); FMainDS.Merge(FPartnerEditUIConnector.GetDataFamilyMembers(FamilyPartnerKey, "")); FMainDS.FamilyMembers.AcceptChanges(); if (FMainDS.FamilyMembers.Rows.Count > 0) { ReturnValue = true; } else { ReturnValue = false; } } catch (System.NullReferenceException) { ReturnValue = false; return(false); } catch (Exception) { ReturnValue = false; // raise; } // Fire OnRecalculateScreenParts event RecalculateScreenPartsEventArgs = new TRecalculateScreenPartsEventArgs(); RecalculateScreenPartsEventArgs.ScreenPart = TScreenPartEnum.spCounters; OnRecalculateScreenParts(RecalculateScreenPartsEventArgs); FDataGrid.Selection.Focus(new Position(1, 1), true); return(ReturnValue); }
private void TPartnerNewDialogWinForm_Load(System.Object sender, System.EventArgs e) { FLogic = new TPartnerNewDialogScreenLogic(); cmbPartnerClass.InitialiseUserControl(); cmbAcquisitionCode.InitialiseUserControl(); // Hide invalid Acquisition Codes this.cmbAcquisitionCode.Filter = PAcquisitionTable.GetValidAcquisitionDBName() + " <> 0"; // Setup Data // As part of bug 5556 testing, checked if this returned a DataTable with any rows with RowState Modified. // The test didn't return much so this isn't conclusive, but it doesn't point to an error: // DataTable summary: 1 rows; 0 Added, 0 deleted, 0 detached, ***0 modified***, 1 unchanged. Table name InstalledSitesList FInstalledSitesDT = TDataCache.TMPartner.GetCacheablePartnerTable(TCacheablePartnerTablesEnum.InstalledSitesList); if (FInstalledSitesDT.Rows.Count != 0) { FLogic.CreateColumns(grdInstalledSites, FInstalledSitesDT); // DataBindingrelated stuff SetupDataGridDataBinding(); // Setup screen with default values InitialiseUI(); if ((FPartnerClass == SharedTypes.PartnerClassEnumToString(TPartnerClass.PERSON)) || (FDefaultPartnerClass == SharedTypes.PartnerClassEnumToString(TPartnerClass.PERSON))) { ShowFamilyPartnerSelection(true); } // Make the Grid respond on updown keys cmbPartnerClass.Focus(); grdInstalledSites.Focus(); // make sure that the grid row gets selected; Mono would not do it automatically DataGrid_FocusRowEntered(null, null); FFormSetupFinished = true; } else { MessageBox.Show(StrCantCreateNewPartner, MCommonResourcestrings.StrErrorNoInstalledSites); DialogResult = System.Windows.Forms.DialogResult.Cancel; Close(); return; } }
private void CmbPartnerClass_SelectedValueChanged(System.Object Sender, System.EventArgs e) { if (FFormSetupFinished) { txtPartnerKey.PartnerClass = cmbPartnerClass.GetSelectedString(); if (cmbPartnerClass.GetSelectedString() == SharedTypes.PartnerClassEnumToString(TPartnerClass.PERSON)) { ShowFamilyPartnerSelection(true); } else { ShowFamilyPartnerSelection(false); } } }
/// <summary> /// Tests whether the current user has access to a particular Partner. /// </summary> /// <remarks> /// <para>Corresponds to Progress 4GL Method 'CanAccessPartner' in /// common/sp_partn.p</para> /// <para>A server-side implementation of this Method exists that has only the /// <paramref name="APartnerRow" />parameter as an Argument. It /// looks up the Foundation Row on its own if this is needed.</para> /// </remarks> /// <param name="APartnerRow">Partner for which access should be checked for.</param> /// <param name="AIsFoundation">Set to true if Partner is a Foundation.</param> /// <param name="AFoundationRow">Foundation Row needs to be passed in /// if Partner is a Foundation.</param> /// <returns><see cref="TPartnerAccessLevelEnum.palGranted" /> if access /// to the Partner is granted, otherwise a different /// <see cref="TPartnerAccessLevelEnum" /> value.</returns> public static TPartnerAccessLevelEnum CanAccessPartner(PPartnerRow APartnerRow, bool AIsFoundation, PFoundationRow AFoundationRow) { TPetraPrincipal userinfo = UserInfo.GetUserInfo(); if ((APartnerRow.Restricted == PARTNER_RESTRICTED_TO_USER) && !((APartnerRow.UserId == userinfo.UserID) || userinfo.IsInModule("SYSMAN"))) { TLogging.LogAtLevel(6, "CanAccessPartner: Access DENIED - Partner " + APartnerRow.PartnerKey.ToString() + " is restriced to User " + APartnerRow.UserId + "!"); return(TPartnerAccessLevelEnum.palRestrictedToUser); } else if ((APartnerRow.Restricted == PARTNER_RESTRICTED_TO_GROUP) && !((userinfo.IsInGroup(APartnerRow.GroupId)) || userinfo.IsInModule("SYSMAN"))) { TLogging.LogAtLevel(6, "CanAccessPartner: Access DENIED - Partner " + APartnerRow.PartnerKey.ToString() + " is restriced to Group " + APartnerRow.GroupId + "!"); return(TPartnerAccessLevelEnum.palRestrictedToGroup); } if (APartnerRow.PartnerClass == SharedTypes.PartnerClassEnumToString(TPartnerClass.ORGANISATION)) { if (AIsFoundation) { if (AFoundationRow != null) { if (!CheckFoundationSecurity(AFoundationRow)) { TLogging.LogAtLevel(6, "CanAccessPartner: Access DENIED - Partner " + APartnerRow.PartnerKey.ToString() + " is restriced by Foundation Ownership!"); return(TPartnerAccessLevelEnum.palRestrictedByFoundationOwnership); } } else { throw new System.ArgumentException("AFoundationRow must not be null if AIsFoundation is true"); } } } TLogging.LogAtLevel(6, "CanAccessPartner: Access to Partner " + APartnerRow.PartnerKey.ToString() + " is GRANTED!"); return(TPartnerAccessLevelEnum.palGranted); }
private void GetDataFromControlsExtra(PPartnerRow ARow) { /* * Extra logic is needed for FAMILY and PERSON Partners because ARow.NoSolicitations is overwritten in * the auto-generated GetDataFromControls Method by the value of chkOtherNoSolicitations.Checked! */ if (FPartnerClass == SharedTypes.PartnerClassEnumToString(TPartnerClass.FAMILY)) { ARow.NoSolicitations = chkFamilyNoSolicitations.Checked; ARow.AddresseeTypeCode = cmbFamilyAddresseeTypeCode.GetSelectedString(); } else if (FPartnerClass == SharedTypes.PartnerClassEnumToString(TPartnerClass.PERSON)) { ARow.NoSolicitations = chkPersonNoSolicitations.Checked; ARow.AddresseeTypeCode = cmbPersonAddresseeTypeCode.GetSelectedString(); } }
private void TPartnerNewDialogWinForm_Load(System.Object sender, System.EventArgs e) { FLogic = new TPartnerNewDialogScreenLogic(); cmbPartnerClass.InitialiseUserControl(); cmbAcquisitionCode.InitialiseUserControl(); // Hide invalid Acquisition Codes this.cmbAcquisitionCode.Filter = PAcquisitionTable.GetValidAcquisitionDBName() + " <> 0"; // Setup Data FInstalledSitesDT = TDataCache.TMPartner.GetCacheablePartnerTable(TCacheablePartnerTablesEnum.InstalledSitesList); if (FInstalledSitesDT.Rows.Count != 0) { FLogic.CreateColumns(grdInstalledSites, FInstalledSitesDT); // DataBindingrelated stuff SetupDataGridDataBinding(); // Setup screen with default values InitialiseUI(); if ((FPartnerClass == SharedTypes.PartnerClassEnumToString(TPartnerClass.PERSON)) || (FDefaultPartnerClass == SharedTypes.PartnerClassEnumToString(TPartnerClass.PERSON))) { ShowFamilyPartnerSelection(true); } // Make the Grid respond on updown keys cmbPartnerClass.Focus(); grdInstalledSites.Focus(); // make sure that the grid row gets selected; Mono would not do it automatically DataGrid_FocusRowEntered(null, null); FFormSetupFinished = true; } else { MessageBox.Show(StrCantCreateNewPartner, MCommonResourcestrings.StrErrorNoInstalledSites); DialogResult = System.Windows.Forms.DialogResult.Cancel; Close(); return; } }
private DataTable GetDataLabelsForPartnerClassesListTable(TDBTransaction AReadTransaction, string ATableName) { const string PARTNERCLASSCOL = "PartnerClass"; const string DLAVAILCOL = "DataLabelsAvailable"; DataTable TmpTable; DataRow NewDR; TOfficeSpecificDataLabelsUIConnector OfficeSpecificDataLabelsUIConnector; // Create our custom Cacheable DataTable on-the-fly TmpTable = new DataTable(ATableName); DataColumn PKColumn = new DataColumn(PARTNERCLASSCOL, System.Type.GetType("System.String")); TmpTable.Columns.Add(PKColumn); TmpTable.Columns.Add(new DataColumn(DLAVAILCOL, System.Type.GetType("System.Boolean"))); TmpTable.PrimaryKey = new DataColumn[] { PKColumn }; /* * Create an Instance of TOfficeSpecificDataLabelsUIConnector - PartnerKey and DataLabelUse are not important here * because we only call Method 'CountLabelUse', which doesn't rely on any of them. */ OfficeSpecificDataLabelsUIConnector = new TOfficeSpecificDataLabelsUIConnector(0, TOfficeSpecificDataLabelUseEnum.Family); // DataLabels available for PERSONs? NewDR = TmpTable.NewRow(); NewDR[PARTNERCLASSCOL] = SharedTypes.PartnerClassEnumToString(TPartnerClass.PERSON); NewDR[DLAVAILCOL] = (OfficeSpecificDataLabelsUIConnector.CountLabelUse(NewDR[PARTNERCLASSCOL].ToString(), AReadTransaction) != 0); TmpTable.Rows.Add(NewDR); // DataLabels available for FAMILYs? NewDR = TmpTable.NewRow(); NewDR[PARTNERCLASSCOL] = SharedTypes.PartnerClassEnumToString(TPartnerClass.FAMILY); NewDR[DLAVAILCOL] = (OfficeSpecificDataLabelsUIConnector.CountLabelUse(NewDR[PARTNERCLASSCOL].ToString(), AReadTransaction) != 0); TmpTable.Rows.Add(NewDR); // DataLabels available for CHURCHes? NewDR = TmpTable.NewRow(); NewDR[PARTNERCLASSCOL] = SharedTypes.PartnerClassEnumToString(TPartnerClass.CHURCH); NewDR[DLAVAILCOL] = (OfficeSpecificDataLabelsUIConnector.CountLabelUse(NewDR[PARTNERCLASSCOL].ToString(), AReadTransaction) != 0); TmpTable.Rows.Add(NewDR); // DataLabels available for ORGANISATIONs? NewDR = TmpTable.NewRow(); NewDR[PARTNERCLASSCOL] = SharedTypes.PartnerClassEnumToString(TPartnerClass.ORGANISATION); NewDR[DLAVAILCOL] = (OfficeSpecificDataLabelsUIConnector.CountLabelUse(NewDR[PARTNERCLASSCOL].ToString(), AReadTransaction) != 0); TmpTable.Rows.Add(NewDR); // DataLabels available for UNITs? NewDR = TmpTable.NewRow(); NewDR[PARTNERCLASSCOL] = SharedTypes.PartnerClassEnumToString(TPartnerClass.UNIT); NewDR[DLAVAILCOL] = (OfficeSpecificDataLabelsUIConnector.CountLabelUse(NewDR[PARTNERCLASSCOL].ToString(), AReadTransaction) != 0); TmpTable.Rows.Add(NewDR); // DataLabels available for BANKs? NewDR = TmpTable.NewRow(); NewDR[PARTNERCLASSCOL] = SharedTypes.PartnerClassEnumToString(TPartnerClass.BANK); NewDR[DLAVAILCOL] = (OfficeSpecificDataLabelsUIConnector.CountLabelUse(NewDR[PARTNERCLASSCOL].ToString(), AReadTransaction) != 0); TmpTable.Rows.Add(NewDR); // DataLabels available for VENUEs? NewDR = TmpTable.NewRow(); NewDR[PARTNERCLASSCOL] = SharedTypes.PartnerClassEnumToString(TPartnerClass.VENUE); NewDR[DLAVAILCOL] = (OfficeSpecificDataLabelsUIConnector.CountLabelUse(NewDR[PARTNERCLASSCOL].ToString(), AReadTransaction) != 0); TmpTable.Rows.Add(NewDR); return(TmpTable); }
private void AddPartner(System.Object sender, EventArgs e) { ExtractTDSMExtractRow NewRow; System.Int64 PartnerKey = 0; string PartnerShortName; TPartnerClass?PartnerClass; TPartnerClass PartnerClass2; TLocationPK ResultLocationPK; DataRow[] ExistingPartnerDataRows; ExtractTDSMExtractRow ExisitingPartnerRow; // If the delegate is defined, the host form will launch a Modal Partner Find screen for us if (TCommonScreensForwarding.OpenPartnerFindScreen != null) { // delegate IS defined try { TCommonScreensForwarding.OpenPartnerFindScreen.Invoke ("", out PartnerKey, out PartnerShortName, out PartnerClass, out ResultLocationPK, this.ParentForm); if (PartnerKey != -1) { ExistingPartnerDataRows = FMainDS.MExtract.Select(ExtractTDSMExtractTable.GetPartnerKeyDBName() + " = " + PartnerKey.ToString()); if (ExistingPartnerDataRows.Length > 0) { // check if partner already exists in extract MessageBox.Show(Catalog.GetString("A record for this partner already exists in this extract"), Catalog.GetString("Add Partner to Extract"), MessageBoxButtons.OK, MessageBoxIcon.Information); // select the already existing partner record in the grid so the user can see it ExisitingPartnerRow = (ExtractTDSMExtractRow)ExistingPartnerDataRows[0]; SelectByPartnerKey(PartnerKey, ExisitingPartnerRow.SiteKey); return; } TRemote.MPartner.Partner.ServerLookups.WebConnectors.GetPartnerShortName( PartnerKey, out PartnerShortName, out PartnerClass2); // add new record to extract NewRow = FMainDS.MExtract.NewRowTyped(); NewRow.ExtractId = FExtractId; NewRow.PartnerKey = PartnerKey; NewRow.PartnerShortName = PartnerShortName; NewRow.PartnerClass = SharedTypes.PartnerClassEnumToString(PartnerClass2); NewRow.SiteKey = ResultLocationPK.SiteKey; NewRow.LocationKey = ResultLocationPK.LocationKey; FMainDS.MExtract.Rows.Add(NewRow); // Refresh DataGrid to show the added partner record grdDetails.Refresh(); // select the added partner record in the grid so the user can see the change SelectByPartnerKey(PartnerKey, ResultLocationPK.SiteKey); // enable save button on screen FPetraUtilsObject.SetChangedFlag(); } } catch (Exception exp) { throw new EOPAppException("Exception occured while calling PartnerFindScreen Delegate!", exp); } // end try } }
private void BtnOK_Click(System.Object sender, System.EventArgs e) { Int64 NewPartnerKey; String NewPartnerClass; NewPartnerClass = cmbPartnerClass.GetSelectedString(); if (NewPartnerClass == SharedTypes.PartnerClassEnumToString(TPartnerClass.PERSON)) { if (TAppSettingsManager.GetValue("AllowCreationPersonRecords", "true", false).ToLower() != "true") { MessageBox.Show("We are planning to change the Person and Family system to something more easy to understand." + Environment.NewLine + "To avoid problems upgrading your database, please create a FAMILY partner rather than a PERSON partner!" + Environment.NewLine + "Otherwise, please add a parameter AllowCreationPersonRecords with value true to your config files.", "NO CREATION OF PERSONS AT THE MOMENT", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } FFamilyPartnerKey = Convert.ToInt32(txtFamilyPartnerBox.Text); if (FFamilyPartnerKey == 0) { MessageBox.Show(StrFamilyNeedsToBeSelected, StrFamilyNeedsToBeSelectedTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtFamilyPartnerBox.Focus(); return; } else //check if a family with the given familyPartnerKey exists; if this is not the case then diplay a message box { TPartnerClass[] AValidPartnerClasses = new TPartnerClass[1]; AValidPartnerClasses[0] = TPartnerClass.FAMILY; bool APartnerExists; String APartnerShortName; TPartnerClass APartnerClass; TStdPartnerStatusCode APartnerStatus; if (!TServerLookup.TMPartner.VerifyPartner(FFamilyPartnerKey, AValidPartnerClasses, out APartnerExists, out APartnerShortName, out APartnerClass, out APartnerStatus)) { MessageBox.Show(StrCorrectFamilyKeyNeedsToBeEntered, StrCorrectFamilyKeyNeedsToBeEnteredTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtFamilyPartnerBox.Focus(); return; } } } NewPartnerKey = txtPartnerKey.PartnerKey; if (FPartnerEditUIConnector.SubmitPartnerKeyForNewPartner(FSiteKey, FPartnerKey, ref NewPartnerKey)) { FPartnerKey = NewPartnerKey; DialogResult = System.Windows.Forms.DialogResult.OK; Close(); } else { MessageBox.Show(String.Format(StrAPartnerKeyExists, txtPartnerKey.PartnerKey, StrAPartnerKeyExistsTitle)); txtPartnerKey.Focus(); } }
/// <summary> /// Determines whether DataLabels exist for a specified Partner Class. /// </summary> /// <param name="APartnerClass">Partner Class that should be checked for.</param> /// <param name="ACacheableDataLabelsForPartnerClassesList">Instance of the Cacheable DataTable 'DataLabelsForPartnerClassesList' /// that has data in it (ie. the Cacheable DataTable must have been retrieved by the caller).</param> /// <returns>True if at least one DataLabel exists for the Partner Class specified in <paramref name="APartnerClass"></paramref>, /// otherwise false.</returns> public static bool HasPartnerClassLocalPartnerDataLabels(TPartnerClass APartnerClass, DataTable ACacheableDataLabelsForPartnerClassesList) { bool ReturnValue = false; DataRow[] PartnerClassDR = ACacheableDataLabelsForPartnerClassesList.Select("PartnerClass = '" + SharedTypes.PartnerClassEnumToString(APartnerClass) + "'"); if (PartnerClassDR.Length > 0) { if (Convert.ToBoolean(PartnerClassDR[0]["DataLabelsAvailable"]) == true) { ReturnValue = true; } } return(ReturnValue); }