/// <summary> /// Add Contact Log record for Partners in selected Extract /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void AddContactLog(object sender, EventArgs e) { PContactLogTable ContactLogTable = new PContactLogTable(); PContactLogRow ContactLogRow = ContactLogTable.NewRowTyped(); string MessageText; if (!WarnIfNotSingleSelection(Catalog.GetString("Add Contact Log")) && (GetSelectedDetailRow() != null)) { TFrmUpdateExtractAddContactLogDialog dialog = new TFrmUpdateExtractAddContactLogDialog(this.FindForm()); dialog.SetExtractName(GetSelectedDetailRow().ExtractName); if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { dialog.GetReturnedParameters(ref ContactLogRow); ContactLogTable.Rows.Add(ContactLogRow); // perform update of extract data on server side TRemote.MPartner.Partner.WebConnectors.AddContactLog( GetSelectedDetailRow().ExtractId, ref ContactLogTable); MessageText = string.Format(Catalog.GetString( "Contact Log {0} - {1} successfully added for {2} Partner(s) in Extract {3}."), ContactLogRow.ContactCode, ContactLogRow.ContactDate, GetSelectedDetailRow().KeyCount, GetSelectedDetailRow().ExtractName); MessageBox.Show(MessageText, Catalog.GetString("Add Contact Log"), MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private bool DeleteRowManual(PContactLogRow ARowToDelete, ref String ACompletionMessage) { foreach (DataRowView ContactLogRow in grdDetails.SelectedDataRows) { DataView PartnerContactLogs = new DataView(FMainDS.PPartnerContact); PartnerContactLogs.RowFilter = String.Format("{0} = {1} AND {2} = {3}", PPartnerContactTable.GetPartnerKeyDBName(), FMainDS.PPartner[0].PartnerKey, PPartnerContactTable.GetContactLogIdDBName(), ContactLogRow.Row[PContactLogTable.ColumnContactLogIdId]); // Delete the PartnerContact records foreach (DataRowView row in PartnerContactLogs) { row.Delete(); } // Actually delete the ContactLog if it's the last if (!TRemote.MPartner.Partner.WebConnectors.IsContactLogAssociatedWithMoreThanOnePartner((long)ContactLogRow.Row[PContactLogTable. ColumnContactLogIdId ])) { ContactLogRow.Row.Delete(); } } grdDetails.Refresh(); return(true); }
private void PostDeleteManual(PContactLogRow pContactLogRow, bool AAllowDeletion, bool ADeletionPerformed, string ACompletionMessage) { if (ADeletionPerformed) { RecalculateTabHeaderCounter(); } }
/// <summary> /// Called by the instantiator of this Dialog to retrieve the values of Fields /// on the screen. /// </summary> /// <param name="ARow"></param> /// <returns>Boolean</returns> public bool GetReturnedParameters(ref PContactLogRow ARow) { bool ReturnValue = true; DataUtilities.CopyAllColumnValues(FMainDS.PContactLog.Rows[0], ARow); return(ReturnValue); }
/// <summary> /// Called by the instantiator of this Dialog to retrieve the values of Fields /// on the screen. /// </summary> /// <param name="ARow"></param> /// <param name="ATable"></param> /// <returns>Boolean</returns> public bool GetReturnedParameters(ref PContactLogRow ARow, ref PPartnerContactAttributeTable ATable) { bool ReturnValue = true; DataUtilities.CopyAllColumnValues(FMainDS.PContactLog.Rows[0], ARow); ATable.Merge(FMainDS.PPartnerContactAttribute); return(ReturnValue); }
/// <summary> /// Display data in control based on data from ARow /// </summary> /// <param name="ARow"></param> public void ShowDetails(PContactLogRow ARow) { FInitializationRunning = true; FContactDR = ARow; ShowData(ARow); FInitializationRunning = false; }
private void NewRowManual(ref PContactLogRow ARow) { ARow.ContactLogId = TRemote.MCommon.WebConnectors.GetNextSequence(TSequenceNames.seq_contact); PPartnerContactRow PartnerContact = FMainDS.PPartnerContact.NewRowTyped(true); PartnerContact.ContactLogId = ARow.ContactLogId; PartnerContact.PartnerKey = ((PPartnerRow)FMainDS.PPartner.Rows[0]).PartnerKey; FMainDS.PPartnerContact.Rows.Add(PartnerContact); RecalculateTabHeaderCounter(); }
public static void AddContactLog(List <Int64> APartnerKeys, DateTime AContactDate, string AContactor, string AMethodOfContact, string AComment, string AModuleID, string AMailingCode) { TDBTransaction Transaction = new TDBTransaction(); bool SubmissionOK = false; DBAccess.WriteTransaction( ref Transaction, ref SubmissionOK, delegate { PContactLogTable contacts = new PContactLogTable(); PContactLogRow contact = contacts.NewRowTyped(); contact.ContactLogId = Transaction.DataBaseObj.GetNextSequenceValue("seq_contact", Transaction); contact.ContactDate = new DateTime(AContactDate.Year, AContactDate.Month, AContactDate.Day); //contact.ContactTime = AContactDate.Hour * 60 + AContactDate.Minute; contact.ContactCode = AMethodOfContact; contact.ContactComment = AComment; contact.ModuleId = AModuleID; contact.Contactor = AContactor; contact.UserId = UserInfo.GetUserInfo().UserID; contacts.Rows.Add(contact); if (AMailingCode.Length > 0) { contact.MailingCode = AMailingCode; } // TODO: restrictions implemented via p_restricted_l or s_user_id_c PPartnerContactTable partnerContacts = new PPartnerContactTable(); APartnerKeys.ForEach(partnerKey => { PPartnerContactRow partnerContact = partnerContacts.NewRowTyped(); partnerContact.ContactLogId = contact.ContactLogId; partnerContact.PartnerKey = partnerKey; partnerContacts.Rows.Add(partnerContact); }); PContactLogAccess.SubmitChanges(contacts, Transaction); PPartnerContactAccess.SubmitChanges(partnerContacts, Transaction); SubmissionOK = true; }); }
private bool PreDeleteManual(PContactLogRow pContactLogRow, ref string ADeletionQuestion) { ADeletionQuestion = Catalog.GetString("Are you sure you want to delete the current row?"); if (TRemote.MPartner.Partner.WebConnectors.IsContactLogAssociatedWithMoreThanOnePartner((long)pContactLogRow.ContactLogId)) { ADeletionQuestion = Catalog.GetString( Environment.NewLine + "Other Partners share this contact log." + Environment.NewLine + "Deleting this record will not affect other Partners" + Environment.NewLine + "To delete this contact for everyone, use \"Find and Delete Contacts\""); } ADeletionQuestion += String.Format("{0}{0}({1} {2})", Environment.NewLine, ucoDetails.ContactDate, ucoDetails.ContactCode); return(true); }
private void ShowDetailsManual(PContactLogRow ARow) { if (ARow != null) { ucoDetails.ShowDetails(ARow); if (TRemote.MPartner.Partner.WebConnectors.IsContactLogAssociatedWithMoreThanOnePartner((long)ARow.ContactLogId)) { lblRelatedLogs.Text = Catalog.GetString( "Note that this Contact Log associated with more than one Partner. Changes here will affect all Partners using this Contact Log."); } else { lblRelatedLogs.Text = Catalog.GetString("Note that this Contact Log is only associated with this Partner."); } } }
private void InitializeManualCode() { // show this dialog in center of screen this.StartPosition = FormStartPosition.CenterScreen; FMainDS = new PartnerEditTDS(); // now add the one subscription row to the DS that we are working with PContactLogTable ContactLogTable = new PContactLogTable(); FMainDS.Merge(ContactLogTable); PContactLogRow ContactLogRow = FMainDS.PContactLog.NewRowTyped(true); ContactLogRow.ContactCode = ""; FMainDS.PContactLog.Rows.Add(ContactLogRow); ucoContactLog.MainDS = FMainDS; ucoContactLog.SpecialInitUserControl(); FPetraUtilsObject.HasChanges = false; }
/// <summary> /// Display data in control based on data from ARow /// </summary> /// <param name="ARow"></param> public void ShowDetails(PContactLogRow ARow) { FInitializationRunning = true; FContactDR = ARow; ShowData(ARow); // if this is the first row to be showing then we need to set up the grid if ((FGridTableDV == null) && (FMainDS.PPartnerContactAttribute != null) && (FMainDS.PPartnerContactAttribute.Count > 0)) { ContactAttributesLogic.SetupContactAttributesGrid(ref grdSelectedAttributes, FMainDS.PPartnerContactAttribute, true, FContactDR.ContactLogId); } if (FGridTableDV != null) { FGridTableDV.RowFilter = PPartnerContactAttributeTable.GetContactIdDBName() + " = " + ARow.ContactLogId; } FInitializationRunning = false; }
/// <summary> /// Read data from controls into ARow parameter /// </summary> /// <param name="ARow"></param> public void GetDetails(PContactLogRow ARow) { ValidateAllData(false); GetDataFromControls(ARow); }
/// <summary> /// Called by the instantiator of this Dialog to retrieve the values of Fields /// on the screen. /// </summary> /// <param name="ARow"></param> /// <param name="ATable"></param> /// <returns>Boolean</returns> public bool GetReturnedParameters(ref PContactLogRow ARow, ref PPartnerContactAttributeTable ATable) { bool ReturnValue = true; DataUtilities.CopyAllColumnValues(FMainDS.PContactLog.Rows[0], ARow); ATable.Merge(FMainDS.PPartnerContactAttribute); return ReturnValue; }
public static void AddContactLog(List <Int64> APartnerKeys, DateTime AContactDate, string AContactor, string AMethodOfContact, string AComment, string AModuleID, string AMailingCode) { Boolean NewTransaction; TDBTransaction WriteTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.Serializable, TEnforceIsolationLevel.eilMinimum, out NewTransaction); try { PContactLogTable contacts = new PContactLogTable(); PContactLogRow contact = contacts.NewRowTyped(); contact.ContactLogId = DBAccess.GDBAccessObj.GetNextSequenceValue("seq_contact", WriteTransaction); contact.ContactDate = new DateTime(AContactDate.Year, AContactDate.Month, AContactDate.Day); //contact.ContactTime = AContactDate.Hour * 60 + AContactDate.Minute; contact.ContactCode = AMethodOfContact; contact.ContactComment = AComment; contact.ModuleId = AModuleID; contact.Contactor = AContactor; contact.UserId = UserInfo.GUserInfo.UserID; contacts.Rows.Add(contact); if (AMailingCode.Length > 0) { contact.MailingCode = AMailingCode; } // TODO: restrictions implemented via p_restricted_l or s_user_id_c PPartnerContactTable partnerContacts = new PPartnerContactTable(); APartnerKeys.ForEach(partnerKey => { PPartnerContactRow partnerContact = partnerContacts.NewRowTyped(); partnerContact.ContactLogId = contact.ContactLogId; partnerContact.PartnerKey = partnerKey; partnerContacts.Rows.Add(partnerContact); }); PContactLogAccess.SubmitChanges(contacts, WriteTransaction); PPartnerContactAccess.SubmitChanges(partnerContacts, WriteTransaction); if (NewTransaction) { DBAccess.GDBAccessObj.CommitTransaction(); } } catch (Exception Exc) { TLogging.Log("An Exception occured during the adding of a Contact:" + Environment.NewLine + Exc.ToString()); if (NewTransaction) { DBAccess.GDBAccessObj.RollbackTransaction(); } throw; } }
private void ValidateDataDetailsManual(PContactLogRow ARow) { }
private void GetDetailDataFromControlsManual(PContactLogRow ARow) { ucoDetails.GetDetails(ARow); }
private bool DeleteRowManual(PContactLogRow ARowToDelete, ref String ACompletionMessage) { foreach (DataRowView ContactLogRow in grdDetails.SelectedDataRows) { DataView PartnerContactLogs = new DataView(FMainDS.PPartnerContact); PartnerContactLogs.RowFilter = String.Format("{0} = {1} AND {2} = {3}", PPartnerContactTable.GetPartnerKeyDBName(), FMainDS.PPartner[0].PartnerKey, PPartnerContactTable.GetContactLogIdDBName(), ContactLogRow.Row[PContactLogTable.ColumnContactLogIdId]); // Delete the PartnerContact records foreach (DataRowView row in PartnerContactLogs) { row.Delete(); } // Actually delete the ContactLog if it's the last if (!TRemote.MPartner.Partner.WebConnectors.IsContactLogAssociatedWithMoreThanOnePartner((long)ContactLogRow.Row[PContactLogTable. ColumnContactLogIdId ])) { ContactLogRow.Row.Delete(); } } grdDetails.Refresh(); return true; }
private bool PreDeleteManual(PContactLogRow pContactLogRow, ref string ADeletionQuestion) { ADeletionQuestion = Catalog.GetString("Are you sure you want to delete the current row?"); if (TRemote.MPartner.Partner.WebConnectors.IsContactLogAssociatedWithMoreThanOnePartner((long)pContactLogRow.ContactLogId)) { ADeletionQuestion = Catalog.GetString( Environment.NewLine + "Other Partners share this contact log." + Environment.NewLine + "Deleting this record will not affect other Partners" + Environment.NewLine + "To delete this contact for everyone, use \"Find and Delete Contacts\""); } ADeletionQuestion += String.Format("{0}{0}({1} {2})", Environment.NewLine, ucoDetails.ContactDate, ucoDetails.ContactCode); return true; }
/// <summary> /// /// </summary> /// <param name="AContext"></param> /// <param name="ARow"></param> /// <param name="VerificationResultCollection"></param> /// <param name="FValidationControlsDict"></param> public static void ValidateContactLogManual(object AContext, PContactLogRow ARow, ref TVerificationResultCollection VerificationResultCollection, TValidationControlsDict FValidationControlsDict) { DataColumn ValidationColumn; TVerificationResult VerificationResult = null; // Don't validate deleted DataRows if (ARow.RowState == DataRowState.Deleted) { return; } ValidationColumn = ARow.Table.Columns[PContactLogTable.ColumnContactCodeId]; VerificationResult = TGeneralChecks.ValueMustNotBeNullOrEmptyString(ARow.ContactCode, Catalog.GetString("Contact Code"), AContext, ValidationColumn); // Handle addition to/removal from TVerificationResultCollection VerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn); }
/// <summary> /// Called by the instantiator of this Dialog to retrieve the values of Fields /// on the screen. /// </summary> /// <param name="ARow"></param> /// <returns>Boolean</returns> public bool GetReturnedParameters(ref PContactLogRow ARow) { bool ReturnValue = true; DataUtilities.CopyAllColumnValues(FMainDS.PContactLog.Rows[0], ARow); return ReturnValue; }
/// <summary> /// Read data from controls into ARow parameter /// </summary> /// <param name="ARow"></param> public void GetDetails(PContactLogRow ARow) { ValidateAllData(TErrorProcessingMode.Epm_None); GetDataFromControls(ARow); }
/// <summary> /// /// </summary> /// <param name="ARow"></param> public void ValidateRowManual(PContactLogRow ARow) { }
public static PContactLogTable FindContacts(string AContactor, DateTime?AContactDate, string ACommentContains, string AMethodOfContact, string AModuleID, string AMailingCode) { Boolean NewTransaction; PContactLogTable contacts = new PContactLogTable(); TDBTransaction WriteTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.ReadCommitted, TEnforceIsolationLevel.eilMinimum, out NewTransaction); try { PContactLogTable TempTable = new PContactLogTable(); PContactLogRow TemplateRow = TempTable.NewRowTyped(false); if (AContactor.Length > 0) { TemplateRow.Contactor = AContactor; } if (AContactDate.HasValue) { TemplateRow.ContactDate = new DateTime(AContactDate.Value.Year, AContactDate.Value.Month, AContactDate.Value.Day); } if (AMethodOfContact.Length > 0) { TemplateRow.ContactCode = AMethodOfContact; } if (AModuleID.Length > 0) { TemplateRow.ModuleId = AModuleID; } if (AMailingCode.Length > 0) { TemplateRow.MailingCode = AMailingCode; } contacts = PContactLogAccess.LoadUsingTemplate(TemplateRow, WriteTransaction); Int32 Counter = 0; while (Counter < contacts.Rows.Count) { if ((ACommentContains.Length > 0) && !StringHelper.ContainsI(contacts[Counter].ContactComment, ACommentContains)) { contacts.Rows.RemoveAt(Counter); } else { Counter++; } } } catch (Exception e) { TLogging.Log(e.Message); TLogging.Log(e.StackTrace); } if (NewTransaction) { DBAccess.GDBAccessObj.RollbackTransaction(); } return(contacts); }