예제 #1
0
        public CountResult RecordCount(ISpecification <T> whereConditions)
        {
            var result = new CountResult();

            result.ResultCount = _baseRepository.RecordCount(whereConditions);
            return(result);
        }
예제 #2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Ok != false)
            {
                hash ^= Ok.GetHashCode();
            }
            if (request_ != null)
            {
                hash ^= Request.GetHashCode();
            }
            if (Output.Length != 0)
            {
                hash ^= Output.GetHashCode();
            }
            if (CountResult != 0)
            {
                hash ^= CountResult.GetHashCode();
            }
            if (TotalItems != 0)
            {
                hash ^= TotalItems.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
예제 #3
0
        public async Task <CountResult> CancelPublishAsync(long[] BillingInputIds, CancellationToken token = default(CancellationToken))
        {
            using (var scope = transactionScopeBuilder.Create())
            {
                var result = new CountResult()
                {
                    ProcessResult = new ProcessResult(), Count = 0
                };

                await billingProcessor.UpdateForResetInvoiceCodeAsync(BillingInputIds, token);

                await billingProcessor.UpdateForResetInputIdAsync(BillingInputIds, token);

                var deleteCount = await billingInputProcessor.DeleteForCancelPublishAsync(BillingInputIds, token);

                var resetCount = await billingInputProcessor.UpdateForCancelPublishAsync(BillingInputIds, token);

                result.Count = (deleteCount + resetCount);
                result.ProcessResult.Result = (result.Count == BillingInputIds.Count());
                if (result.ProcessResult.Result)
                {
                    scope.Complete();
                }

                return(result);
            }
        }
예제 #4
0
        public async Task <CountResult> UpdatePublishAtAsync(long[] BillingInputIds,
                                                             CancellationToken token = default(CancellationToken))
        {
            using (var scope = transactionScopeBuilder.Create())
            {
                var result = new CountResult()
                {
                    ProcessResult = new ProcessResult(), Count = 0
                };

                await Task.Run(() => {
                    foreach (var id in BillingInputIds)
                    {
                        var billingInputSource = new BillingInputSource()
                        {
                            Id             = id,
                            IsFirstPublish = false
                        };
                        var billingInput = billingInputProcessor.UpdateForPublishAsync(billingInputSource);
                        if (billingInput != null)
                        {
                            result.Count++;
                        }
                    }
                    result.ProcessResult.Result = (result.Count == BillingInputIds.Count());
                });

                if (result.ProcessResult.Result)
                {
                    scope.Complete();
                }

                return(result);
            }
        }
예제 #5
0
        private async Task <bool> DeleteSectionInfo()
        {
            var sectionResult = new CountResult();
            var newList       = new List <Section>();
            var success       = false;

            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var service   = factory.Create <SectionMasterClient>();
                sectionResult = await service.DeleteAsync(SessionKey, SectionId);
                success       = (sectionResult?.ProcessResult.Result ?? false) &&
                                sectionResult?.Count > 0;
                if (success)
                {
                    newList = await LoadGridAsync();
                }
            });

            if (success)
            {
                SectionList = newList;
                grdSectionMaster.DataSource = new BindingSource(SectionList, null);
            }

            return(success);
        }
예제 #6
0
 private async Task <CountResult> DeleteStatusAsync(int Id)
 => await ServiceProxyFactory.DoAsync(async (StatusMasterClient client) =>
 {
     CountResult result = null;
     result             = await client.DeleteAsync(SessionKey, Id);
     return(result);
 });
        protected override object Present(object countObj, NameSwitcher nameSwitcher)
        {
            var         countResult        = countObj as ICountResult;
            CountResult defaultCountResult = new CountResult();

            defaultCountResult.Platform  = countResult.Platform;
            defaultCountResult.Series    = countResult.Series;
            defaultCountResult.CountList = countResult.CountList;

            Assembly assembly = null;

            foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
            {
                if (asm.GetName().Name == "Present")
                {
                    assembly = asm;
                }
            }
            Type   helperType     = assembly.GetType("Present.TextPresentHelper");
            object helperInstance = helperType.GetMethod("GetInstance").Invoke(null, null);

            return((bool)helperType.GetMethod("GetPresent").Invoke(helperInstance, new object[2] {
                defaultCountResult, nameSwitcher
            }));
        }
예제 #8
0
        private async Task <bool> DeleteStaffInfo()
        {
            bool success = true;
            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var service = factory.Create <StaffMasterClient>();

                StaffsResult staffResult = null;
                CountResult deleteResult = null;
                if (DeletePostProcessor != null)
                {
                    staffResult = await service.GetAsync(SessionKey, new int[] { StaffId });
                }

                deleteResult = await service.DeleteAsync(SessionKey, StaffId);
                success      = (deleteResult?.ProcessResult.Result ?? false) &&
                               deleteResult?.Count > 0;

                var syncResult = true;
                if (DeletePostProcessor != null && success)
                {
                    syncResult = DeletePostProcessor.Invoke(staffResult
                                                            .Staffs.AsEnumerable().Select(x => x as IMasterData));
                }
                success &= syncResult;
                if (success)
                {
                    await LoadStaffGrid();
                }
            });

            return(success);
        }
예제 #9
0
        public CountResult GetStatistics()
        {
            CountResult stats = new CountResult();

            stats.SelectedCount = 0;
            stats.SelectedSize  = 0;
            stats.TotalCount    = 0;
            stats.TotalSize     = 0;

            foreach (var game in gameLibrary)
            {
                if (game is NesMiniApplication)
                {
                    long size = game.Size();
                    stats.TotalSize += size;
                    stats.TotalCount++;
                    if (game.Selected)
                    {
                        stats.SelectedCount++;
                        stats.SelectedSize += size;
                    }
                }
            }
            return(stats);
        }
예제 #10
0
        public async Task <CountResult> RecordCountAsync(Infrastructure.Specifications.ISpecification <T> whereConditions)
        {
            var result = new CountResult();

            result.ResultCount = await _baseRepository.RecordCountAsync(whereConditions);

            return(result);
        }
예제 #11
0
    public static void FillRow(object countResultObj, out SqlString Name, out SqlByte WQty, out SqlByte SQty)
    {
        CountResult tmp = (CountResult)countResultObj;

        Name = tmp.Model_Name;
        WQty = tmp.Wagons_Qty;
        SQty = tmp.Seats_Qty;
    }
예제 #12
0
        /// <summary>削除データ</summary>
        private void DeleteKanaHistory()
        {
            var         companyId    = Login.CompanyId;
            var         sessionKey   = Login.SessionKey;
            CountResult deleteResult = null;
            var         target       = grdKanaHistoryCustomer.Rows.Where(x => IsChecked(x));

            ProgressDialog.Start(ParentForm, async(cancel, progress) =>
            {
                if (IsCustomer)
                {
                    var items = target.Select(x => x.DataBoundItem as KanaHistoryCustomer);
                    await ServiceProxyFactory.LifeTime(async factory =>
                    {
                        var client = factory.Create <KanaHistoryCustomerMasterClient>();
                        foreach (var item in items)
                        {
                            deleteResult = await client.DeleteAsync(sessionKey, companyId,
                                                                    item.PayerName, item.SourceBankName, item.SourceBranchName, item.CustomerId);
                            if (!deleteResult.ProcessResult.Result ||
                                deleteResult.Count == 0)
                            {
                                break;
                            }
                        }
                    });
                }
                else
                {
                    var items = target.Select(x => x.DataBoundItem as KanaHistoryPaymentAgency);
                    await ServiceProxyFactory.LifeTime(async factory =>
                    {
                        var client = factory.Create <KanaHistoryPaymentAgencyMasterClient>();
                        foreach (var item in items)
                        {
                            deleteResult = await client.DeleteAsync(sessionKey, companyId,
                                                                    item.PayerName, item.SourceBankName, item.SourceBranchName, item.PaymentAgencyId);
                            if (!deleteResult.ProcessResult.Result ||
                                deleteResult.Count == 0)
                            {
                                break;
                            }
                        }
                    });
                }
            }, false, SessionKey);

            if (deleteResult.Count > 0)
            {
                Clear();
                DispStatusMessage(MsgInfDeleteSuccess);
                txtPayerName.Focus();
            }
            else
            {
                ShowWarningDialog(MsgErrDeleteError);
            }
        }
예제 #13
0
        private void DeleteDiscounts(long billing_id)
        {
            var task = ServiceProxyFactory.LifeTime(async factory =>
            {
                var billingService       = factory.Create <BillingServiceClient>();
                CountResult deleteResult = await billingService.DeleteDiscountAsync(SessionKey, billing_id);
            });

            ProgressDialog.Start(ParentForm, task, false, SessionKey);
        }
예제 #14
0
        public void DataToStringIsCorrect()
        {
            Fixture fixture = new Fixture();
            int     count   = fixture.Create <int>();

            CountResult result = new CountResult(count);

            Assert.IsTrue(result.IsOk);
            Assert.AreEqual(count.ToString(CultureInfo.InvariantCulture), result.DataToString());
        }
예제 #15
0
        private void SaveDiscount(BillingDiscount bDiscount)
        {
            var task = ServiceProxyFactory.LifeTime(async factory =>
            {
                var billingService     = factory.Create <BillingServiceClient>();
                CountResult saveResult = await billingService.SaveDiscountAsync(SessionKey, bDiscount);
            });

            ProgressDialog.Start(ParentForm, task, false, SessionKey);
        }
예제 #16
0
        private async Task <CountResult> SaveOutputAtReminderSummaryAsync(ReminderOutputed[] reminderOutputed, ReminderSummary[] reminderSummary)
        {
            CountResult countResult = null;
            await ServiceProxyFactory.DoAsync <ReminderServiceClient>(async client =>
            {
                countResult = await client.UpdateReminderSummaryOutputedAsync(SessionKey, Login.UserId, reminderOutputed, reminderSummary);
            });

            return(countResult);
        }
예제 #17
0
        public IActionResult GetActiveCount()
        {
            xServer.Stats.IncrementPublicRequest();
            CountResult topResult = new CountResult()
            {
                Count = xServer.GetActiveServerCount()
            };

            return(Json(topResult));
        }
예제 #18
0
 public DataView()
 {
     for (int i = 0; i < Labels.classLabels.Length; ++i)
     {
         matchedCount[i] = new CountResult {
             Count = 0, ClassName = Labels.classLabels[i]
         };
         matchedResult[i] = new List <MatchResult>();
     }
 }
예제 #19
0
 public string AnalyseLogs(IEnumerable <LogEntry> logEntries)
 {
     if (string.IsNullOrWhiteSpace(_searchTerm))
     {
         return("Aucun terme sélectionné");
     }
     else
     {
         return(CountResult.FormatResult(logEntries.GroupBy(l => l.DateTime.Date).OrderBy(g => g.Key).Select(CountResult.FromGrouping).ToList()));
     }
 }
예제 #20
0
        public virtual async Task <CountResult> Count(string query)
        {
            var result = new CountResult
            {
                NumberOfItem = string.IsNullOrWhiteSpace(query)
                    ? await this.UnitOfWork.GetRepository <T>().GetQueryable().CountAsync()
                    : await Task.Run(() => this.UnitOfWork.GetRepository <T>().GetQueryable().Count(query))
            };

            return(result);
        }
예제 #21
0
        private async Task <bool> Delete()
        {
            CountResult deletePayment = null;
            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var service   = factory.Create <PaymentAgencyMasterClient>();
                deletePayment = await service.DeleteAsync(SessionKey, PaymentAgencyId);
            });

            return(deletePayment.ProcessResult.Result && deletePayment.Count > 0);
        }
예제 #22
0
        private void DeleteTemplateSetting()
        {
            if (string.IsNullOrWhiteSpace(txtTemplatePatternNo.Text))
            {
                ShowWarningDialog(MsgWngInputRequired, lblTemplatePatternNo.Text);
                txtTemplatePatternNo.Focus();
                return;
            }
            if (!ShowConfirmDialog(MsgQstConfirmDelete))
            {
                DispStatusMessage(MsgInfProcessCanceled);
                return;
            }

            try
            {
                CountResult result = null;
                var         exist  = false;
                Task        task   = ExistTemplateAtLevelAsync(TemplateId)
                                     .ContinueWith(async t =>
                {
                    exist = t.Result;
                    if (!exist)
                    {
                        result = await DeleteTemplateSettingAsync(TemplateId);
                    }
                }, TaskScheduler.FromCurrentSynchronizationContext())
                                     .Unwrap();
                ProgressDialog.Start(ParentForm, task, false, SessionKey);

                if (exist)
                {
                    ShowWarningDialog(MsgWngDeleteConstraint, new string[] { "レベル設定", "パターンNo" });
                    return;
                }
                if (result.Count > 0)
                {
                    ClearTabs(tbcReminderSetting.TabPages.IndexOf(tbpTemplateSetting));
                    DispStatusMessage(MsgInfDeleteSuccess);
                }
                else
                {
                    ShowWarningDialog(MsgErrDeleteError);
                }
            }
            catch (Exception ex)
            {
                Debug.Fail(ex.ToString());
                NLogHandler.WriteErrorLog(this, ex, SessionKey);
            }
        }
        public static async Task Run()
        {
            ICommandDispatcher     dispatcher = Configure();
            OutputToConsoleCommand command    = new OutputToConsoleCommand
            {
                Message = "Hello"
            };
            CountResult result = await dispatcher.DispatchAsync(command);

            Console.WriteLine($"{result.Count} actors called");
            await dispatcher.DispatchAsync(command);

            Console.WriteLine("\nPress a key to continue...");
        }
        public virtual async Task <CountResult> CountAsync(IRepositoryQuery query, ICommandOptions options = null)
        {
            options = ConfigureOptions(options.As <T>());

            CountResult result;

            if (IsCacheEnabled && options.ShouldReadCache())
            {
                result = await GetCachedQueryResultAsync <CountResult>(options, "count").AnyContext();

                if (result != null)
                {
                    return(result);
                }
            }

            await OnBeforeQueryAsync(query, options, typeof(T)).AnyContext();

            await RefreshForConsistency(query, options).AnyContext();

            var searchDescriptor = await CreateSearchDescriptorAsync(query, options).AnyContext();

            searchDescriptor.Size(0);

            var response = await _client.SearchAsync <T>(searchDescriptor).AnyContext();

            if (response.IsValid)
            {
                _logger.LogRequest(response, options.GetQueryLogLevel());
            }
            else
            {
                if (response.ApiCall.HttpStatusCode.GetValueOrDefault() == 404)
                {
                    return(new CountResult());
                }

                _logger.LogErrorRequest(response, "Error getting document count");
                throw new ApplicationException(response.GetErrorMessage(), response.OriginalException);
            }

            result = new CountResult(response.Total, response.ToAggregations());
            if (IsCacheEnabled && options.ShouldUseCache())
            {
                await SetCachedQueryResultAsync(options, result, "count").AnyContext();
            }

            return(result);
        }
예제 #25
0
        private void Delete()
        {
            if (!ValidateChildren())
            {
                return;
            }

            List <IgnoreKana> reloaded = null;

            try
            {
                if (!ShowConfirmDialog(MsgQstConfirmDelete))
                {
                    DispStatusMessage(MsgInfProcessCanceled);
                    return;
                }

                CountResult deleteResult = null;
                Task        task         = ServiceProxyFactory.LifeTime(async factory =>
                {
                    var service  = factory.Create <IgnoreKanaMasterClient>();
                    deleteResult = await service.DeleteAsync(SessionKey, CompanyId, CurrentEntry.Kana);

                    if ((deleteResult?.ProcessResult.Result ?? false) && deleteResult.Count > 0)
                    {
                        reloaded = await GetListAsync();
                        IgnoreKanaList.Clear();
                        Clear(true, withStatus: false);
                        IgnoreKanaList.AddRange(reloaded);

                        grdExcludeKanaList.DataSource = new BindingSource(IgnoreKanaList, null);
                        DispStatusMessage(MsgInfDeleteSuccess);
                    }
                    else
                    {
                        ShowWarningDialog(MsgErrDeleteError);
                    }
                });
                ProgressDialog.Start(ParentForm, task, false, SessionKey);
            }
            catch (Exception ex)
            {
                Debug.Fail(ex.ToString());
                ShowWarningDialog(MsgErrDeleteError);
                NLogHandler.WriteErrorLog(this, ex, SessionKey);
            }
        }
예제 #26
0
            public void Merge(string outputPath)
            {
                Console.WriteLine("Non-existent IDs:");
                var nonexistent = new HashSet <long>();

                nonexistent.AddRange(ReadContainersWithLogging(NonexistentIdsFiles.Select(fi => new MatchIdContainer(fi.FullName))));
                Console.WriteLine($"  Total unique IDs: {nonexistent.Count:#,0}");
                var nonexistentNew = new MatchIdContainer(Path.Combine(outputPath, $"{Region}-match-id-nonexistent.losmid"), Region);

                nonexistentNew.AppendItems(nonexistent.Order(), LosChunkFormat.LZ4HC);
                NonexistentCount = nonexistent.Count;

                Console.WriteLine();
                Console.WriteLine("Matches:");
                var existingHave = new HashSet <long>();

                foreach (var group in MatchFiles.GroupBy(x => x.queueId).OrderBy(grp => grp.Key))
                {
                    var queueId = group.Key;
                    Console.WriteLine($"  Queue {queueId}");
                    var newMatches = new JsonContainer(Path.Combine(outputPath, $"{Region}-matches-{queueId}.losjs"));
                    var count      = new CountResult();
                    newMatches.AppendItems(
                        ReadContainersWithLogging(group.Select(x => new JsonContainer(x.fi.FullName)))
                        .Where(js => existingHave.Add(js["gameId"].GetLong()))
                        .PassthroughCount(count),
                        LosChunkFormat.LZ4HC);
                    Console.WriteLine($"    Total unique: {count.Count:#,0}");
                    HaveCounts.Add(queueId, count.Count);
                }

                Console.WriteLine();
                Console.WriteLine("Existing IDs:");
                var existing = new HashSet <long>();

                existing.AddRange(ReadContainersWithLogging(ExistingIdsFiles.Select(fi => new MatchIdContainer(fi.FullName))));
                var existingWasCount = existing.Count;

                existing.AddRange(existingHave);
                Console.WriteLine($"  IDs which were only in match files and not in match-id files: {existing.Count - existingWasCount:#,0}");
                Console.WriteLine($"  Total unique IDs: {existing.Count:#,0}");
                var existingNew = new MatchIdContainer(Path.Combine(outputPath, $"{Region}-match-id-existing.losmid"), Region);

                existingNew.AppendItems(existing.Order(), LosChunkFormat.LZ4HC);
                RedownloadIds = existing.Except(existingHave).Order().ToList();
                Console.WriteLine($"  Known IDs we don't have; re-download: {RedownloadIds.Count:#,0}");
            }
예제 #27
0
        /// <summary>
        /// 指定日以前の不要な請求・入金データを削除する。<para/>
        /// </summary>
        /// <param name="date">削除対象日</param>
        /// <returns>int: 削除件数,null: エラー</returns>
        private static async Task <int?> DeleteDataBeforeAsync(string SessionKey, DateTime date)
        {
            CountResult result = null;

            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var client = factory.Create <DataMaintenanceService.DataMaintenanceServiceClient>();
                result     = await client.DeleteDataAsync(SessionKey, date);
            });

            if (result == null || result.ProcessResult.Result == false)
            {
                return(null);
            }

            return(result.Count);
        }
        private static async Task <int?> DeleteEBExcludeAccountSettingListAsync(string sessionKey, EBExcludeAccountSetting target)
        {
            CountResult result = null;

            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var client = factory.Create <EBExcludeAccountSettingMasterService.EBExcludeAccountSettingMasterClient>();
                result     = await client.DeleteAsync(sessionKey, target);
            });

            if (result == null || result.ProcessResult.Result == false)
            {
                return(null);
            }

            return(result.Count);
        }
예제 #29
0
        /// <summary>
        /// 全ログ検索処理(TaskScheduleHistoryService.svc:Delete)を呼び出して結果を取得する。
        /// </summary>
        private static async Task <int?> DeleteAllTaskScheduleHistoryAsync(string sessionKey, int companyId)
        {
            CountResult result = null;

            await ServiceProxyFactory.LifeTime(async factory =>
            {
                var client = factory.Create <TaskScheduleHistoryService.TaskScheduleHistoryServiceClient>();
                result     = await client.DeleteAsync(sessionKey, companyId);
            });

            if (result == null || result.ProcessResult.Result == false)
            {
                return(null);
            }

            return(result.Count);
        }
예제 #30
0
        private static void PrintCountResults(CountResult countResult, string countCommand, string query, OperationResult results)
        {
            Console.WriteLine("Executed: \r\nPOST {0} \r\n{1} \r\n".F(countCommand, query));

            Console.WriteLine("Count Result: \r\n {0} \r\n".F(results));

            Console.WriteLine("Parsed Count Results");
            Console.WriteLine(" count: " + countResult.count);
            Console.WriteLine(" status: " + countResult.status);
            Console.WriteLine(" error: " + countResult.error);
            Console.WriteLine(" _shards:");
            Console.WriteLine("     total: " + countResult._shards.total);
            Console.WriteLine("     successful: " + countResult._shards.successful);
            Console.WriteLine("     failed: " + countResult._shards.failed);

            Console.WriteLine();
        }
예제 #31
0
        public void GetDaySummaryTest()
        {
            // Arrange
            int[] expectedResult = new int[96];

            CountResult[] countResult = new CountResult[]
            {
                new CountResult() {TimeSlice = 2, FieldValue = "user1", Count = 2},
                new CountResult() {TimeSlice = 2, FieldValue = "user2", Count = 4},
                new CountResult() {TimeSlice = 3, FieldValue = "user1", Count = 2},
                new CountResult() {TimeSlice = 3, FieldValue = "user3", Count = 2},
                new CountResult() {TimeSlice = 3, FieldValue = "user2", Count = 2},
                new CountResult() {TimeSlice = 4, FieldValue = "user2", Count = 2},
                new CountResult() {TimeSlice = 5, FieldValue = "user3", Count = 2},
                new CountResult() {TimeSlice = 5, FieldValue = "user1", Count = 2},
            };

            expectedResult[2] = 2;
            expectedResult[3] = 3;
            expectedResult[4] = 1;
            expectedResult[5] = 2;

            SessionsSummary expected = new SessionsSummary();
            expected.data = expectedResult;

            string applicationName = "awebapp";
            DateTime day = DateTime.Now;

            var eaepClient = new Mock<IEAEPMonitorClient>();
            eaepClient
                .Setup(x => x.Count("app:awebapp", day.Date, day.Date.AddDays(1), expectedResult.Length, EAEPMessage.PARAM_USER))
                .Returns(countResult);

            SessionsService target = new SessionsService(eaepClient.Object);

            // Act
            SessionsSummary actual = target.GetDaySummary(applicationName, day, expectedResult.Length);

            // Assert
            object[] actualResult = (object[])actual.data;
            Assert.AreEqual(expectedResult.Length, actualResult.Length);
            for (int i = 0; i < expectedResult.Length; i++)
            {
                Assert.AreEqual(expectedResult[i], ((int[])actualResult[i])[1]);
            }
        }