本文整理汇总了C#中PartnerEditTDS.InitVars方法的典型用法代码示例。如果您正苦于以下问题:C# PartnerEditTDS.InitVars方法的具体用法?C# PartnerEditTDS.InitVars怎么用?C# PartnerEditTDS.InitVars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PartnerEditTDS
的用法示例。
在下文中一共展示了PartnerEditTDS.InitVars方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PrepareBankingDetailsForSaving
private void PrepareBankingDetailsForSaving(ref PartnerEditTDS AInspectDS, ref TVerificationResultCollection AVerificationResult,
TDBTransaction ATransaction)
{
if ((AInspectDS.PBankingDetails != null) && (AInspectDS.PBankingDetails.Rows.Count > 0))
{
AInspectDS.Merge(new PBankingDetailsUsageTable());
AInspectDS.InitVars();
PBankingDetailsUsageAccess.LoadViaPPartner(AInspectDS, FPartnerKey, ATransaction);
AInspectDS.PBankingDetailsUsage.AcceptChanges();
// make sure there is at least one main account, or no account at all
// make sure there are no multiple main accounts
PartnerEditTDS LocalDS = new PartnerEditTDS();
PBankingDetailsAccess.LoadViaPPartner(LocalDS, FPartnerKey, ATransaction);
// there are problems with Mono on merging deleted rows into the LocalDS, they become modified rows
// see https://tracker.openpetra.org/view.php?id=1871
LocalDS.Merge(AInspectDS.PBankingDetails);
// workaround for bug 1871
List <Int32>DeletedBankingDetails = new List <Int32>();
if (AInspectDS.PPartnerBankingDetails != null)
{
foreach (DataRow bdrow in AInspectDS.PPartnerBankingDetails.Rows)
{
if (bdrow.RowState == DataRowState.Deleted)
{
DeletedBankingDetails.Add(Convert.ToInt32(bdrow[AInspectDS.PPartnerBankingDetails.ColumnBankingDetailsKey,
DataRowVersion.Original]));
}
}
}
bool ThereIsAtLeastOneAccount = false;
// get the main account
Int32 MainAccountBankingDetails = Int32.MinValue;
foreach (PartnerEditTDSPBankingDetailsRow detailRow in LocalDS.PBankingDetails.Rows)
{
if ((detailRow.RowState != DataRowState.Deleted) && !DeletedBankingDetails.Contains(detailRow.BankingDetailsKey))
{
ThereIsAtLeastOneAccount = true;
if (!detailRow.IsMainAccountNull() && detailRow.MainAccount)
{
if ((MainAccountBankingDetails != Int32.MinValue) && (detailRow.BankingDetailsKey != MainAccountBankingDetails))
{
AVerificationResult.Add(new TVerificationResult(
String.Format("Banking Details"),
string.Format("there are multiple main accounts"),
TResultSeverity.Resv_Critical));
return;
}
else
{
// if the main account has been changed
MainAccountBankingDetails = detailRow.BankingDetailsKey;
}
}
}
}
bool alreadyExists = false;
foreach (PBankingDetailsUsageRow usageRow in AInspectDS.PBankingDetailsUsage.Rows)
{
if (usageRow.Type == MPartnerConstants.BANKINGUSAGETYPE_MAIN)
{
DataRow bdrow = LocalDS.PBankingDetails.Rows.Find(usageRow.BankingDetailsKey);
if ((bdrow == null) || (bdrow.RowState == DataRowState.Deleted)
|| DeletedBankingDetails.Contains(usageRow.BankingDetailsKey))
{
// deleting the account
usageRow.Delete();
}
else if (MainAccountBankingDetails == Int32.MinValue)
{
MainAccountBankingDetails = usageRow.BankingDetailsKey;
alreadyExists = true;
}
else if ((MainAccountBankingDetails != Int32.MinValue) && (usageRow.BankingDetailsKey != MainAccountBankingDetails))
{
usageRow.Delete();
}
else
{
alreadyExists = true;
}
}
}
if (!alreadyExists && ThereIsAtLeastOneAccount)
{
if (MainAccountBankingDetails == Int32.MinValue)
{
AVerificationResult.Add(new TVerificationResult(
//.........这里部分代码省略.........