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; }); }
public static void AddContactLog(int ExtractId, ref PContactLogTable ContactLogTable) { Boolean NewTransaction; TDBTransaction WriteTransaction = DBAccess.GDBAccessObj.GetNewOrExistingTransaction(IsolationLevel.Serializable, TEnforceIsolationLevel.eilMinimum, out NewTransaction); try { var extractTable = MExtractAccess.LoadViaMExtractMaster(ExtractId, WriteTransaction).AsEnumerable(); var partnerKeys = extractTable.Select(e => e.ItemArray[MExtractTable.ColumnPartnerKeyId]); long ContactLogId = DBAccess.GDBAccessObj.GetNextSequenceValue("seq_contact", WriteTransaction); ContactLogTable.Rows[0][PContactLogTable.ColumnContactLogIdId] = ContactLogId; PPartnerContactTable partnerContacts = new PPartnerContactTable(); partnerKeys.ToList().ForEach(partnerKey => { PPartnerContactRow partnerContact = partnerContacts.NewRowTyped(); partnerContact.ContactLogId = ContactLogId; partnerContact.PartnerKey = (long)partnerKey; partnerContacts.Rows.Add(partnerContact); }); PContactLogAccess.SubmitChanges(ContactLogTable, WriteTransaction); PPartnerContactAccess.SubmitChanges(partnerContacts, WriteTransaction); if (NewTransaction) { DBAccess.GDBAccessObj.CommitTransaction(); } } catch (Exception e) { TLogging.Log( "An Exception occured during the adding of a Contact to Partners in an Extract:" + Environment.NewLine + e.ToString()); if (NewTransaction) { DBAccess.GDBAccessObj.RollbackTransaction(); } throw; } }
public static void AddContactLog(int AExtractId, PContactLogTable AContactLogTable, PPartnerContactAttributeTable APartnerContactAttributeTable) { TDBTransaction WriteTransaction = null; bool SubmissionOK = false; DBAccess.GDBAccessObj.GetNewOrExistingAutoTransaction(IsolationLevel.Serializable, TEnforceIsolationLevel.eilMinimum, ref WriteTransaction, ref SubmissionOK, delegate { var extractTable = MExtractAccess.LoadViaMExtractMaster(AExtractId, WriteTransaction).AsEnumerable(); var partnerKeys = extractTable.Select(e => e.ItemArray[MExtractTable.ColumnPartnerKeyId]); long ContactLogId = DBAccess.GDBAccessObj.GetNextSequenceValue("seq_contact", WriteTransaction); AContactLogTable.Rows[0][PContactLogTable.ColumnContactLogIdId] = ContactLogId; PPartnerContactTable partnerContacts = new PPartnerContactTable(); partnerKeys.ToList().ForEach(partnerKey => { PPartnerContactRow partnerContact = partnerContacts.NewRowTyped(); partnerContact.ContactLogId = ContactLogId; partnerContact.PartnerKey = (long)partnerKey; partnerContacts.Rows.Add(partnerContact); }); foreach (PPartnerContactAttributeRow Row in APartnerContactAttributeTable.Rows) { Row.ContactId = ContactLogId; } PContactLogAccess.SubmitChanges(AContactLogTable, WriteTransaction); PPartnerContactAccess.SubmitChanges(partnerContacts, WriteTransaction); PPartnerContactAttributeAccess.SubmitChanges(APartnerContactAttributeTable, WriteTransaction); SubmissionOK = true; }); }
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; } }
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; } }
public static void AddContactLog(List <Int64>APartnerKeys, DateTime AContactDate, string AContactor, string AMethodOfContact, string AComment, string AModuleID, string AMailingCode) { TDBTransaction Transaction = null; bool SubmissionOK = false; DBAccess.GDBAccessObj.GetNewOrExistingAutoTransaction(IsolationLevel.Serializable, ref Transaction, ref SubmissionOK, delegate { PContactLogTable contacts = new PContactLogTable(); PContactLogRow contact = contacts.NewRowTyped(); contact.ContactLogId = DBAccess.GDBAccessObj.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.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, Transaction); PPartnerContactAccess.SubmitChanges(partnerContacts, Transaction); SubmissionOK = true; }); }