当前位置: 首页>>代码示例>>C#>>正文


C# GiftBatchTDS.GetChangesTyped方法代码示例

本文整理汇总了C#中GiftBatchTDS.GetChangesTyped方法的典型用法代码示例。如果您正苦于以下问题:C# GiftBatchTDS.GetChangesTyped方法的具体用法?C# GiftBatchTDS.GetChangesTyped怎么用?C# GiftBatchTDS.GetChangesTyped使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GiftBatchTDS的用法示例。


在下文中一共展示了GiftBatchTDS.GetChangesTyped方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SaveGiftBatchTDS

        public static TSubmitChangesResult SaveGiftBatchTDS(ref GiftBatchTDS AInspectDS,
            out TVerificationResultCollection AVerificationResult)
        {
            AVerificationResult = new TVerificationResultCollection();
            TSubmitChangesResult SubmissionResult = TSubmitChangesResult.scrError;

            // make sure that empty tables are removed !! This can return NULL!
            AInspectDS = AInspectDS.GetChangesTyped(true);

            if (AInspectDS == null)
            {
                AVerificationResult.Add(new TVerificationResult(
                        Catalog.GetString("Save Gift Batch"),
                        Catalog.GetString("No changes - nothing to do"),
                        TResultSeverity.Resv_Info));
                return TSubmitChangesResult.scrNothingToBeSaved;
            }

            bool AllValidationsOK = true;

            bool GiftBatchTableInDataSet = (AInspectDS.AGiftBatch != null && AInspectDS.AGiftBatch.Count > 0);
            bool GiftTableInDataSet = (AInspectDS.AGift != null && AInspectDS.AGift.Count > 0);
            bool GiftDetailTableInDataSet = (AInspectDS.AGiftDetail != null && AInspectDS.AGiftDetail.Count > 0);

            //Not needed at present
            //int GiftBatchCount = GiftBatchTableInDataSet ? AInspectDS.AGiftBatch.Count : 0;
            int GiftCount = GiftTableInDataSet ? AInspectDS.AGift.Count : 0;
            int GiftDetailCount = GiftDetailTableInDataSet ? AInspectDS.AGiftDetail.Count : 0;

            bool RecurrGiftBatchTableInDataSet = (AInspectDS.ARecurringGiftBatch != null && AInspectDS.ARecurringGiftBatch.Count > 0);
            bool RecurrGiftTableInDataSet = (AInspectDS.ARecurringGift != null && AInspectDS.ARecurringGift.Count > 0);
            bool RecurrGiftDetailTableInDataSet = (AInspectDS.ARecurringGiftDetail != null && AInspectDS.ARecurringGiftDetail.Count > 0);

            if (RecurrGiftBatchTableInDataSet || RecurrGiftTableInDataSet || RecurrGiftDetailTableInDataSet)
            {
                if (GiftBatchTableInDataSet || GiftTableInDataSet || GiftDetailTableInDataSet)
                {
                    throw new Exception(String.Format("Function:{0} - Recurring and normal gift data found in same changes batch!",
                            Utilities.GetMethodName(true)));
                }

                return SaveRecurringGiftBatchTDS(ref AInspectDS,
                    ref AVerificationResult,
                    RecurrGiftBatchTableInDataSet,
                    RecurrGiftTableInDataSet,
                    RecurrGiftDetailTableInDataSet);
            }
            else
            {
                if (!(GiftBatchTableInDataSet || GiftTableInDataSet || GiftDetailTableInDataSet))
                {
                    throw new Exception(String.Format("Function:{0} - No gift data changes to save!", Utilities.GetMethodName(true)));
                }
            }

            //Get a list of all batches involved
            List <Int32>ListAllGiftBatchesToProcess = new List <int>();

            //Get batch numbers involved
            if (GiftDetailTableInDataSet)
            {
                DataView AllBatchesToProcess = new DataView(AInspectDS.AGiftDetail);
                AllBatchesToProcess.RowStateFilter = DataViewRowState.OriginalRows | DataViewRowState.Added;

                foreach (DataRowView drv in AllBatchesToProcess)
                {
                    AGiftDetailRow gdr = (AGiftDetailRow)drv.Row;
                    int batchNumber;

                    if (gdr.RowState != DataRowState.Deleted)
                    {
                        batchNumber = gdr.BatchNumber;
                    }
                    else
                    {
                        batchNumber = (Int32)gdr[AGiftDetailTable.ColumnBatchNumberId, DataRowVersion.Original];
                    }

                    if (!ListAllGiftBatchesToProcess.Contains(batchNumber))
                    {
                        ListAllGiftBatchesToProcess.Add(batchNumber);
                    }
                }

                ValidateGiftDetail(ref AVerificationResult, AInspectDS.AGiftDetail);
                ValidateGiftDetailManual(ref AVerificationResult, AInspectDS.AGiftDetail);

                if (!TVerificationHelper.IsNullOrOnlyNonCritical(AVerificationResult))
                {
                    AllValidationsOK = false;
                }
            }

            //Get batch numbers involved
            if (GiftTableInDataSet)
            {
                DataView AllBatchesToProcess = new DataView(AInspectDS.AGift);
                AllBatchesToProcess.RowStateFilter = DataViewRowState.OriginalRows | DataViewRowState.Added;

                foreach (DataRowView drv in AllBatchesToProcess)
//.........这里部分代码省略.........
开发者ID:Davincier,项目名称:openpetra,代码行数:101,代码来源:Gift.Transactions.cs


注:本文中的GiftBatchTDS.GetChangesTyped方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。