예제 #1
0
        public override void Initialize(BinaryReader reader, RecordHeader header)
        {
            while (reader.BaseStream.Position < header.DataEndPos)
            {
                var type = (SubRecordType)reader.ReadInt32();
                var size = reader.ReadInt32();

                switch (type)
                {
                case SubRecordType.Id:
                    name = reader.ReadString(size);
                    break;

                case SubRecordType.Data:
                    dialogueType = (DialogType)reader.ReadByte();
                    break;
                }
            }

            // Add the dialog type to a cache so there are less items to iterate over
            switch (dialogueType)
            {
            case DialogType.Topic:
                TopicCache.Add(name, this);
                break;

            case DialogType.Voice:
                VoiceCache.Add(name, this);
                break;

            case DialogType.Greeting:
                GreetingCache.Add(name, this);
                break;

            case DialogType.Persuasion:
                PersuasionCache.Add(name, this);
                break;

            case DialogType.Journal:
                JournalCache.Add(name, this);
                break;
            }

            currentDialogueInfo = infoRecords;
        }
예제 #2
0
        private void GenerateJournalLines()
        {
            DirectDebitToJournal cwwin = new DirectDebitToJournal(api);

            cwwin.Closed += async delegate
            {
                if (cwwin.DialogResult == true && !string.IsNullOrEmpty(cwwin.Journal))
                {
                    ExpandCollapseAllGroups();

                    busyIndicator.IsBusy = true;
                    Uniconta.API.GeneralLedger.PostingAPI posApi = new Uniconta.API.GeneralLedger.PostingAPI(api);
                    long LineNumber = await posApi.MaxLineNumber(cwwin.Journal);

                    NumberSerieAPI numberserieApi    = new NumberSerieAPI(posApi);
                    int            nextVoucherNumber = 0;

                    var DJclient       = (Uniconta.DataModel.GLDailyJournal)JournalCache.Get(cwwin.Journal);
                    var listLineClient = new List <Uniconta.DataModel.GLDailyJournalLine>();

                    if (!DJclient._GenerateVoucher && !DJclient._ManualAllocation)
                    {
                        nextVoucherNumber = (int)await numberserieApi.ViewNextNumber(DJclient._NumberSerie);
                    }

                    List <DebtorTransDirectDebit> paymentListTransfer = null;
                    var dictPaymTransfer = new Dictionary <int, DebtorTransDirectDebit>();
                    DebtorTransDirectDebit mergePaymentRefId;

                    var netsBS = false;
                    int index  = 0;
                    foreach (var rec in (IEnumerable <DebtorTransDirectDebit>)dgDebtorTranOpenGrid.ItemsSource)
                    {
                        int rowHandle = dgDebtorTranOpenGrid.GetRowHandleByListIndex(index);
                        index++;
                        if (!dgDebtorTranOpenGrid.IsRowVisible(rowHandle) || rec._PaymentStatus == PaymentStatusLevel.OnHold) //TODO: Pt. tillades alle med undtagelse af OnHold
                        {
                            continue;
                        }

                        if (rec.PaymentFormat != null)
                        {
                            var paymFormatClient = (DebtorPaymentFormat)PaymentFormatCache.Get(rec.PaymentFormat);
                            netsBS = rec.PaymentFormat == paymFormatClient._Format;
                        }

                        var paymRefId = rec._PaymentRefId != 0 ? rec._PaymentRefId : -rec.PrimaryKeyId;

                        if (dictPaymTransfer.TryGetValue(paymRefId, out mergePaymentRefId))
                        {
                            mergePaymentRefId.MergedAmount += netsBS ? rec.Amount : rec.PaymentAmount;

                            mergePaymentRefId.settleTypeRowId = true;
                            mergePaymentRefId.rowNumbers.Append(';').Append(rec.PrimaryKeyId);

                            mergePaymentRefId.hasBeenMerged = true;
                        }
                        else
                        {
                            mergePaymentRefId = new DebtorTransDirectDebit();
                            StreamingManager.Copy(rec, mergePaymentRefId);
                            mergePaymentRefId._PaymentRefId = paymRefId;
                            mergePaymentRefId.MergedAmount  = netsBS ? rec.Amount : rec.PaymentAmount;

                            mergePaymentRefId.rowNumbers = new StringBuilder();
                            mergePaymentRefId.rowNumbers.Append(rec.PrimaryKeyId);
                            mergePaymentRefId.settleTypeRowId = true;

                            dictPaymTransfer.Add(paymRefId, mergePaymentRefId);
                        }
                        paymentListTransfer = dictPaymTransfer.Values.ToList();
                    }

                    foreach (var cTOpenClient in paymentListTransfer)
                    {
                        var lineclient = new GLDailyJournalLineClient();
                        lineclient.SetMaster(DJclient);
                        lineclient._DCPostType    = DCPostType.Payment;
                        lineclient._LineNumber    = ++LineNumber;
                        lineclient._Date          = cTOpenClient._PaymentDate != DateTime.MinValue ? cTOpenClient._PaymentDate : cTOpenClient._DueDate;
                        lineclient._TransType     = cwwin.TransType;
                        lineclient._AccountType   = (byte)GLJournalAccountType.Debtor;
                        lineclient._Account       = cTOpenClient.Account;
                        lineclient._OffsetAccount = cwwin.BankAccount;
                        lineclient._Invoice       = cTOpenClient.hasBeenMerged ? 0 : cTOpenClient.Invoice;

                        if (cTOpenClient.settleTypeRowId)
                        {
                            lineclient._SettleValue = SettleValueType.RowId;
                            lineclient._Settlements = cTOpenClient.rowNumbers.ToString();
                        }
                        else
                        {
                            lineclient._Settlements = null;
                        }

                        lineclient._DocumentRef = cTOpenClient.DocumentRef;
                        lineclient.Amount       = netsBS ? -cTOpenClient.Amount : -cTOpenClient.PaymentAmount;

                        if (nextVoucherNumber != 0)
                        {
                            lineclient._Voucher = nextVoucherNumber;
                            nextVoucherNumber++;
                        }

                        listLineClient.Add(lineclient);
                    }
                    if (listLineClient.Count > 0)
                    {
                        if (nextVoucherNumber != 0)
                        {
                            numberserieApi.SetNumber(DJclient._NumberSerie, nextVoucherNumber - 1);
                        }

                        ErrorCodes errorCode = await api.Insert(listLineClient);

                        busyIndicator.IsBusy = false;
                        if (errorCode != ErrorCodes.Succes)
                        {
                            UtilDisplay.ShowErrorCode(errorCode);
                        }
                        else
                        {
                            var text = string.Concat(Uniconta.ClientTools.Localization.lookup("TransferedToJournal"), ": ", DJclient._Journal,
                                                     Environment.NewLine, string.Format(Uniconta.ClientTools.Localization.lookup("GoTo"), Uniconta.ClientTools.Localization.lookup("Journallines")), " ?");
                            var select = UnicontaMessageBox.Show(text, Uniconta.ClientTools.Localization.lookup("Information"), MessageBoxButton.OKCancel);
                            if (select == MessageBoxResult.OK)
                            {
                                AddDockItem(TabControls.GL_DailyJournalLine, DJclient, null, null, true);
                            }
                        }
                    }
                    else
                    {
                        busyIndicator.IsBusy = false;
                        UtilDisplay.ShowErrorCode(ErrorCodes.NoLinesToUpdate);
                    }
                }
            };
            cwwin.Show();
        }
        /// <summary>
        /// Returns true if OrgApacheJackrabbitOakPluginsDocumentDocumentNodeStoreServiceProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of OrgApacheJackrabbitOakPluginsDocumentDocumentNodeStoreServiceProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrgApacheJackrabbitOakPluginsDocumentDocumentNodeStoreServiceProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Mongouri == other.Mongouri ||
                     Mongouri != null &&
                     Mongouri.Equals(other.Mongouri)
                     ) &&
                 (
                     Db == other.Db ||
                     Db != null &&
                     Db.Equals(other.Db)
                 ) &&
                 (
                     SocketKeepAlive == other.SocketKeepAlive ||
                     SocketKeepAlive != null &&
                     SocketKeepAlive.Equals(other.SocketKeepAlive)
                 ) &&
                 (
                     Cache == other.Cache ||
                     Cache != null &&
                     Cache.Equals(other.Cache)
                 ) &&
                 (
                     NodeCachePercentage == other.NodeCachePercentage ||
                     NodeCachePercentage != null &&
                     NodeCachePercentage.Equals(other.NodeCachePercentage)
                 ) &&
                 (
                     PrevDocCachePercentage == other.PrevDocCachePercentage ||
                     PrevDocCachePercentage != null &&
                     PrevDocCachePercentage.Equals(other.PrevDocCachePercentage)
                 ) &&
                 (
                     ChildrenCachePercentage == other.ChildrenCachePercentage ||
                     ChildrenCachePercentage != null &&
                     ChildrenCachePercentage.Equals(other.ChildrenCachePercentage)
                 ) &&
                 (
                     DiffCachePercentage == other.DiffCachePercentage ||
                     DiffCachePercentage != null &&
                     DiffCachePercentage.Equals(other.DiffCachePercentage)
                 ) &&
                 (
                     CacheSegmentCount == other.CacheSegmentCount ||
                     CacheSegmentCount != null &&
                     CacheSegmentCount.Equals(other.CacheSegmentCount)
                 ) &&
                 (
                     CacheStackMoveDistance == other.CacheStackMoveDistance ||
                     CacheStackMoveDistance != null &&
                     CacheStackMoveDistance.Equals(other.CacheStackMoveDistance)
                 ) &&
                 (
                     BlobCacheSize == other.BlobCacheSize ||
                     BlobCacheSize != null &&
                     BlobCacheSize.Equals(other.BlobCacheSize)
                 ) &&
                 (
                     PersistentCache == other.PersistentCache ||
                     PersistentCache != null &&
                     PersistentCache.Equals(other.PersistentCache)
                 ) &&
                 (
                     JournalCache == other.JournalCache ||
                     JournalCache != null &&
                     JournalCache.Equals(other.JournalCache)
                 ) &&
                 (
                     CustomBlobStore == other.CustomBlobStore ||
                     CustomBlobStore != null &&
                     CustomBlobStore.Equals(other.CustomBlobStore)
                 ) &&
                 (
                     JournalGCInterval == other.JournalGCInterval ||
                     JournalGCInterval != null &&
                     JournalGCInterval.Equals(other.JournalGCInterval)
                 ) &&
                 (
                     JournalGCMaxAge == other.JournalGCMaxAge ||
                     JournalGCMaxAge != null &&
                     JournalGCMaxAge.Equals(other.JournalGCMaxAge)
                 ) &&
                 (
                     PrefetchExternalChanges == other.PrefetchExternalChanges ||
                     PrefetchExternalChanges != null &&
                     PrefetchExternalChanges.Equals(other.PrefetchExternalChanges)
                 ) &&
                 (
                     Role == other.Role ||
                     Role != null &&
                     Role.Equals(other.Role)
                 ) &&
                 (
                     VersionGcMaxAgeInSecs == other.VersionGcMaxAgeInSecs ||
                     VersionGcMaxAgeInSecs != null &&
                     VersionGcMaxAgeInSecs.Equals(other.VersionGcMaxAgeInSecs)
                 ) &&
                 (
                     VersionGCExpression == other.VersionGCExpression ||
                     VersionGCExpression != null &&
                     VersionGCExpression.Equals(other.VersionGCExpression)
                 ) &&
                 (
                     VersionGCTimeLimitInSecs == other.VersionGCTimeLimitInSecs ||
                     VersionGCTimeLimitInSecs != null &&
                     VersionGCTimeLimitInSecs.Equals(other.VersionGCTimeLimitInSecs)
                 ) &&
                 (
                     BlobGcMaxAgeInSecs == other.BlobGcMaxAgeInSecs ||
                     BlobGcMaxAgeInSecs != null &&
                     BlobGcMaxAgeInSecs.Equals(other.BlobGcMaxAgeInSecs)
                 ) &&
                 (
                     BlobTrackSnapshotIntervalInSecs == other.BlobTrackSnapshotIntervalInSecs ||
                     BlobTrackSnapshotIntervalInSecs != null &&
                     BlobTrackSnapshotIntervalInSecs.Equals(other.BlobTrackSnapshotIntervalInSecs)
                 ) &&
                 (
                     RepositoryHome == other.RepositoryHome ||
                     RepositoryHome != null &&
                     RepositoryHome.Equals(other.RepositoryHome)
                 ) &&
                 (
                     MaxReplicationLagInSecs == other.MaxReplicationLagInSecs ||
                     MaxReplicationLagInSecs != null &&
                     MaxReplicationLagInSecs.Equals(other.MaxReplicationLagInSecs)
                 ) &&
                 (
                     DocumentStoreType == other.DocumentStoreType ||
                     DocumentStoreType != null &&
                     DocumentStoreType.Equals(other.DocumentStoreType)
                 ) &&
                 (
                     BundlingDisabled == other.BundlingDisabled ||
                     BundlingDisabled != null &&
                     BundlingDisabled.Equals(other.BundlingDisabled)
                 ) &&
                 (
                     UpdateLimit == other.UpdateLimit ||
                     UpdateLimit != null &&
                     UpdateLimit.Equals(other.UpdateLimit)
                 ) &&
                 (
                     PersistentCacheIncludes == other.PersistentCacheIncludes ||
                     PersistentCacheIncludes != null &&
                     PersistentCacheIncludes.Equals(other.PersistentCacheIncludes)
                 ) &&
                 (
                     LeaseCheckMode == other.LeaseCheckMode ||
                     LeaseCheckMode != null &&
                     LeaseCheckMode.Equals(other.LeaseCheckMode)
                 ));
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Mongouri != null)
         {
             hashCode = hashCode * 59 + Mongouri.GetHashCode();
         }
         if (Db != null)
         {
             hashCode = hashCode * 59 + Db.GetHashCode();
         }
         if (SocketKeepAlive != null)
         {
             hashCode = hashCode * 59 + SocketKeepAlive.GetHashCode();
         }
         if (Cache != null)
         {
             hashCode = hashCode * 59 + Cache.GetHashCode();
         }
         if (NodeCachePercentage != null)
         {
             hashCode = hashCode * 59 + NodeCachePercentage.GetHashCode();
         }
         if (PrevDocCachePercentage != null)
         {
             hashCode = hashCode * 59 + PrevDocCachePercentage.GetHashCode();
         }
         if (ChildrenCachePercentage != null)
         {
             hashCode = hashCode * 59 + ChildrenCachePercentage.GetHashCode();
         }
         if (DiffCachePercentage != null)
         {
             hashCode = hashCode * 59 + DiffCachePercentage.GetHashCode();
         }
         if (CacheSegmentCount != null)
         {
             hashCode = hashCode * 59 + CacheSegmentCount.GetHashCode();
         }
         if (CacheStackMoveDistance != null)
         {
             hashCode = hashCode * 59 + CacheStackMoveDistance.GetHashCode();
         }
         if (BlobCacheSize != null)
         {
             hashCode = hashCode * 59 + BlobCacheSize.GetHashCode();
         }
         if (PersistentCache != null)
         {
             hashCode = hashCode * 59 + PersistentCache.GetHashCode();
         }
         if (JournalCache != null)
         {
             hashCode = hashCode * 59 + JournalCache.GetHashCode();
         }
         if (CustomBlobStore != null)
         {
             hashCode = hashCode * 59 + CustomBlobStore.GetHashCode();
         }
         if (JournalGCInterval != null)
         {
             hashCode = hashCode * 59 + JournalGCInterval.GetHashCode();
         }
         if (JournalGCMaxAge != null)
         {
             hashCode = hashCode * 59 + JournalGCMaxAge.GetHashCode();
         }
         if (PrefetchExternalChanges != null)
         {
             hashCode = hashCode * 59 + PrefetchExternalChanges.GetHashCode();
         }
         if (Role != null)
         {
             hashCode = hashCode * 59 + Role.GetHashCode();
         }
         if (VersionGcMaxAgeInSecs != null)
         {
             hashCode = hashCode * 59 + VersionGcMaxAgeInSecs.GetHashCode();
         }
         if (VersionGCExpression != null)
         {
             hashCode = hashCode * 59 + VersionGCExpression.GetHashCode();
         }
         if (VersionGCTimeLimitInSecs != null)
         {
             hashCode = hashCode * 59 + VersionGCTimeLimitInSecs.GetHashCode();
         }
         if (BlobGcMaxAgeInSecs != null)
         {
             hashCode = hashCode * 59 + BlobGcMaxAgeInSecs.GetHashCode();
         }
         if (BlobTrackSnapshotIntervalInSecs != null)
         {
             hashCode = hashCode * 59 + BlobTrackSnapshotIntervalInSecs.GetHashCode();
         }
         if (RepositoryHome != null)
         {
             hashCode = hashCode * 59 + RepositoryHome.GetHashCode();
         }
         if (MaxReplicationLagInSecs != null)
         {
             hashCode = hashCode * 59 + MaxReplicationLagInSecs.GetHashCode();
         }
         if (DocumentStoreType != null)
         {
             hashCode = hashCode * 59 + DocumentStoreType.GetHashCode();
         }
         if (BundlingDisabled != null)
         {
             hashCode = hashCode * 59 + BundlingDisabled.GetHashCode();
         }
         if (UpdateLimit != null)
         {
             hashCode = hashCode * 59 + UpdateLimit.GetHashCode();
         }
         if (PersistentCacheIncludes != null)
         {
             hashCode = hashCode * 59 + PersistentCacheIncludes.GetHashCode();
         }
         if (LeaseCheckMode != null)
         {
             hashCode = hashCode * 59 + LeaseCheckMode.GetHashCode();
         }
         return(hashCode);
     }
 }
예제 #5
0
        /// <summary>
        /// Lecture des informations à ne pas relire à chaque contrôle d'une nouvelle ligne
        /// </summary>
        /// <param name="repository"></param>
        /// <returns>Objet Import contenant les informations</returns>
        private Import ReadParameters(APIRepository repository)
        {
            // Récupération des codes journaux, ces codes journaux seront accessibles en les recherchant directement par leurs indices (code).
            Dictionary <string, string> options = new Dictionary <string, string>();

            options.Add("$expand", "compte");
            options.Add("$select", "code,id,optContrepartie,compte");
            var result = repository.Get(repository.CompanyId, "journaux", options);

            if (!Tools.IsSuccess(result))
            {
                return new Import {
                           ErrorMessage = Tools.FormateErrorApi(result)
                }
            }
            ;

            var journaux = result.GetJSONResult()["value"];
            Dictionary <string, JournalCache> codes = new Dictionary <string, JournalCache>();

            foreach (var journal in journaux)
            {
                codes.Add(journal["code"].ToString(), JournalCache.Create(journal));
            }

            // Récupération des intitules de modes de réglements.
            options.Clear();
            options.Add("$select", "intitule,id");
            result = repository.Get(repository.CompanyId, "modesReglement", options);
            if (!Tools.IsSuccess(result))
            {
                return new Import {
                           ErrorMessage = Tools.FormateErrorApi(result)
                }
            }
            ;

            var modesReglement = result.GetJSONResult()["value"];
            Dictionary <string, string> intitulesModesReglement = new Dictionary <string, string>();

            foreach (var mode in modesReglement)
            {
                intitulesModesReglement.Add(mode["intitule"].ToString(), mode["id"].ToString());
            }

            // Récupération des informations de la société afin d'obtenir les dates d'exercices.
            options.Clear();
            options.Add("$select", "exercices($select=dateDebut,dateFin;$filter=cloture eq false;$orderby=dateDebut desc;$top=1)");
            result = repository.Get(repository.CompanyId, "company", options);
            if (!Tools.IsSuccess(result))
            {
                return new Import {
                           ErrorMessage = Tools.FormateErrorApi(result)
                }
            }
            ;

            var company           = result.GetJSONResult();
            var exerciceStartDate = (DateTime)company["exercices"][0]["dateDebut"];
            var exerciceEndDate   = (DateTime)company["exercices"][0]["dateFin"];

            //Structure pour tampon des comptes déjà lus, sera alimenté au fur et à mesure du parcours des lignes
            Dictionary <string, string> comptes        = new Dictionary <string, string>();
            Dictionary <string, string> inconnuComptes = new Dictionary <string, string>();

            return(new Import
            {
                Codes = codes,
                ExerciceStartDate = exerciceStartDate,
                ExerciceEndDate = exerciceEndDate,
                IntitulesModesReglement = intitulesModesReglement,
                Comptes = comptes,
                InconnuComptes = inconnuComptes,
                ErrorMessage = null
            });
        }
    }
}