// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseEndpoints(endpoints => { endpoints.MapBlazorHub(); endpoints.MapFallbackToPage("/_Host"); endpoints.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); }); OAData.OADB.Init(env.ContentRootPath + @"\wwwroot\"); OAData.Ontology.Init(env.ContentRootPath + @"\wwwroot\ontology_iis-v12-doc_ruen.xml"); FormatService.Load(env.ContentRootPath + @"\wwwroot\ApplicationProfile.xml"); }
/* * // Evento para setear el BoxNumber desde otro hilo * public void setNumberBoxText(int pElementIndex, string pText) * { * if (this.boxArray[pElementIndex].textbox.InvokeRequired) * { * SetNumberBoxTextCallback callBack = new SetNumberBoxTextCallback(setNumberBoxText); * this.Invoke(callBack, new object[] { pElementIndex, pText }); * } * else * { * this.boxArray[pElementIndex].textbox.Text = pText; * } * } * // Evento para obtener el SelectedGroup desde otro hilo * public int getSelectedGroup() * { * int selectedIndex = 0; * if (this.drawTypeBox.InvokeRequired) * { * GetSelectedGroupCallback callBack = new GetSelectedGroupCallback(getSelectedGroup); * selectedIndex = (int)this.Invoke(callBack, new object[] { }); * } * else * { * selectedIndex = this.drawTypeBox.SelectedIndex; * } * Console.WriteLine("selectedIndex: " + selectedIndex); * return selectedIndex; * } * // Evento para setear el SelectedGroup desde otro hilo * public void setSelectedGroup(int pGroupId) * { * if (this.drawTypeBox.InvokeRequired) * { * SetSelectedGroupCallback callBack = new SetSelectedGroupCallback(setSelectedGroup); * this.Invoke(callBack, new object[] { pGroupId }); * } * else * { * this.drawTypeBox.SelectedIndex = pGroupId; * } * } * // Evento para setear el TotalImport desde otro hilo * public void setTotalImport(string pText) * { * if (this.txbTotalImport.InvokeRequired) * { * SetTotalImportCallback callBack = new SetTotalImportCallback(setTotalImport); * this.Invoke(callBack, new object[] { pText }); * } * else * { * this.txbTotalImport.Text = pText; * } * } * // Evento para setear el SyncImport desde otro hilo * public void setSyncImport(string pText) * { * if (this.txbSyncImport.InvokeRequired) * { * SetSyncImportCallback callBack = new SetSyncImportCallback(setSyncImport); * this.Invoke(callBack, new object[] { pText }); * } * else * { * this.txbSyncImport.Text = pText; * } * } * // Evento para setear el PendingImport desde otro hilo * public void setPendingImport(string pText) * { * if (this.txbPendingImport.InvokeRequired) * { * SetPendingImportCallback callBack = new SetPendingImportCallback(setPendingImport); * this.Invoke(callBack, new object[] { pText }); * } * else * { * this.txbPendingImport.Text = pText; * } * } * // Evento para setear el MaxToReceive desde otro hilo * public void setMaxToReceive(string pText) * { * if (this.txbMaxToReceive.InvokeRequired) * { * SetMaxToReceiveCallback callBack = new SetMaxToReceiveCallback(setMaxToReceive); * this.Invoke(callBack, new object[] { pText }); * } * else * { * this.txbMaxToReceive.Text = pText; * } * } */ //--------------------------------------- Métodos de Actualización --------------------------------------// private void updateBoxArray(long pGroupId) { this.updateTotalBoxes(pGroupId); int totalImport = 0; //int pendingImport = 0; ListService listService = new ListService(); // Calcular importe sincronizado con el server int[] syncTotalImportArray = listService.getDrawTotals(this.datePickerList.Value.Date, pGroupId); for (int i = 0; i < syncTotalImportArray.Length; i++) { totalImport += syncTotalImportArray[i]; //this.boxArray[i].textbox.Text = FormatService.formatInt(syncTotalImportArray[i]); this.setNumberBoxText(i, FormatService.formatInt(syncTotalImportArray[i])); } this.setTotalImport(FormatService.formatInt(totalImport)); /* * // Calcular importe pendiente de sincronización * int[] pendingSyncImportArray = listService.getDrawPendingSyncTotals(this.datePickerList.Value.Date, pGroupId); * for (int i = 0; i < syncTotalImportArray.Length; i++) * { * pendingImport += pendingSyncImportArray[i]; * } * this.setSyncImport(FormatService.formatInt(totalImport - pendingImport)); * this.setPendingImport(FormatService.formatInt(pendingImport)); * int maxToReceive = (int) (totalImport * 0.03); * this.setMaxToReceive(maxToReceive == 0 ? "" : FormatService.formatInt(maxToReceive)); */ }
public long getDrawSaleImport(long posId, DateTime pDate, long pGroup) { long saleTotal = 0; string drawDate = FormatService.formatDrawDateToString(pDate); using (var context = new SILOEntities()) { string query = "SELECT IFNULL(SUM(N.LND_SaleImport), 0) AS totalImport " + "FROM LTL_LotteryList AS L " + "INNER JOIN LND_ListNumberDetail AS N ON N.LTL_LotteryList = L.LTL_Id " + "INNER JOIN LTD_LotteryDraw AS D ON D.LTD_Id = L.LTD_LotteryDraw " + "INNER JOIN LDT_LotteryDrawType AS T ON T.LDT_Id = D.LDT_LotteryDrawType " + "WHERE L.LPS_LotteryPointSale = " + posId + " " + "AND L.LLS_LotteryListStatus <> " + SystemConstants.LIST_STATUS_CANCELED + " " + "AND D.LTD_CreateDate = '" + drawDate + "' " + "AND D.LDT_LotteryDrawType = " + pGroup + " " + ";" ; var totalList = context.Database.SqlQuery <long>(query).ToList(); saleTotal = totalList.First(); //saleTotal = context.Database.SqlQuery<IEnumerable<long>>(query); } return(saleTotal); }
public static Task CreateInvalidFormat() { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new FormatRepository(context); var formatService = new FormatService(repository); var formatId = new FormatId(SequentialGuid.NewSequentialGuid()); var command = new Commands.Create { Id = formatId }; return formatService.Handle(command); }
static void Main(string[] args) { FormatService greeting = new FormatService(); Console.WriteLine("Enter First Name"); string firstName = Console.ReadLine(); Console.WriteLine("Enter Surname"); String lastName = Console.ReadLine(); Console.WriteLine(greeting.GetGreeting(firstName, lastName)); }
// DELETE public static Task RemoveFormat(FormatId id) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new FormatRepository(context); var formatService = new FormatService(repository); var command = new Commands.Delete { Id = id, }; return formatService.Handle(command); }
public FormatDetailViewModelTests() { var eventAggregatorMock = new Mock <IEventAggregator>(); var loggerMock = new Mock <ILogger>(); var formatLookupServiceMock = new Mock <IFormatLookupDataService>(); var formatRepoMock = new Mock <IRepository <Format> >(); var domainService = new FormatService(formatRepoMock.Object); var dialogService = new DialogService(); viewModel = new FormatDetailViewModel(eventAggregatorMock.Object, loggerMock.Object, domainService, formatLookupServiceMock.Object, dialogService); }
internal static Task UpdateFormat(Format sut) { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new FormatRepository(context); var formatService = new FormatService(repository); var command = new Commands.Update { Id = sut.Id, Name = sut.Name }; return formatService.Handle(command); }
/* * public void getListDetail() * { * //var listDetail = null; * using (var context = new SILOEntities()) * { * var listDetail = context.Database. * SqlQuery<LotteryTuple>("SELECT LNR_LotteryNumber AS number, CAST(LND_SaleImport AS INTEGER) AS import FROM LND_ListNumberDetail WHERE LTL_LotteryList = 1; ") * .ToList() * ; * foreach (var item in listDetail) * { * Console.WriteLine(item.ToString()); * Console.WriteLine(item.number + " " + item.import + " "); * } * } * } */ public int[] getDrawListTotals(long posId, DateTime pDate, long pGroup, long pSyncStatus = 0, bool pOnlyPendingTransactions = false) { int[] importArray = new int[100]; string drawDate = FormatService.formatDrawDateToString(pDate); string pendingFilter = " AND L.SYS_SynchronyStatus = " + SystemConstants.SYNC_STATUS_PENDING_TO_SERVER + " "; string synStatusFilter = " AND L.SYS_SynchronyStatus = " + pSyncStatus + " "; Dictionary <int, int> importCollection = new Dictionary <int, int>(); using (var context = new SILOEntities()) { string query = "SELECT N.LNR_LotteryNumber AS numberId, SUM(N.LND_SaleImport) AS totalImport " + "FROM LTL_LotteryList AS L " + "INNER JOIN LND_ListNumberDetail AS N ON N.LTL_LotteryList = L.LTL_Id " + "INNER JOIN LTD_LotteryDraw AS D ON D.LTD_Id = L.LTD_LotteryDraw " + "INNER JOIN LDT_LotteryDrawType AS T ON T.LDT_Id = D.LDT_LotteryDrawType " + "WHERE L.LPS_LotteryPointSale = " + posId + " " + "AND L.LLS_LotteryListStatus <> " + SystemConstants.LIST_STATUS_CANCELED + " " + "AND D.LTD_CreateDate = '" + drawDate + "' " + "AND D.LDT_LotteryDrawType = " + pGroup + " " + (pOnlyPendingTransactions ? pendingFilter : "") + (pSyncStatus != 0 ? synStatusFilter : "") + "GROUP BY N.LNR_LotteryNumber " + ";" ; var listDetail = context.Database.SqlQuery <ListTotalRecord>(query).ToList(); // Crear diccionario para realizar la conversión foreach (var item in listDetail) { importCollection.Add(item.numberId, item.totalImport); } } // Llenar el array for (int i = 0; i < importArray.Length; i++) { int importValue = 0; int numberId = (i == 0 ? 100 : i); if (importCollection.TryGetValue(numberId, out importValue)) { importArray[i] = importValue; } else { importArray[i] = 0; } } return(importArray); }
public SettingsPageViewModel(INavigationService navigationService, FormatService formatService, ConstantsPurchasingService purchasingService, IPageDialogService dialogService) : base(navigationService) { _navigationService = navigationService; _formatService = formatService; _purchasingService = purchasingService; _dialogService = dialogService; SetDefaultCommang = new DelegateCommand(SetDefaultExecute); SaveCommand = new DelegateCommand(SaveExecute); PurchaseCommand = new DelegateCommand(PurchaseExecute, PurchaseCanExecute); Sample = _formatService.FormatResult(sampleValue); }
public static async Task<Format> CreateValidFormat() { var connectionString = ConnectivityService.GetConnectionString("TEMP"); var context = new BookOrganizer2DbContext(connectionString); var repository = new FormatRepository(context); var formatService = new FormatService(repository); var command = new Commands.Create { Id = new FormatId(SequentialGuid.NewSequentialGuid()), Name = "paperback" }; await formatService.Handle(command); return await repository.GetAsync(command.Id); }
private void updateTotalBoxes(long pGroupId) { if (pGroupId != 0) { int totalImport = 0; int syncImport = 0; int qrImport = 0; int pendingImport = 0; ListService listService = new ListService(); // Calcular importe sincronizado con el server int[] syncTotalImportArray = listService.getDrawTotals(this.datePickerList.Value.Date, pGroupId); for (int i = 0; i < syncTotalImportArray.Length; i++) { totalImport += syncTotalImportArray[i]; } this.setTotalImport(FormatService.formatInt(totalImport)); // Calcular importe pendiente de sincronización //int[] pendingSyncImportArray = listService.getDrawPendingSyncTotals(this.datePickerList.Value.Date, pGroupId); int[] pendingSyncImportArray = listService.getTotalImportBySyncStatus(this.datePickerList.Value.Date, pGroupId, SystemConstants.SYNC_STATUS_PENDING_TO_SERVER); for (int i = 0; i < pendingSyncImportArray.Length; i++) { pendingImport += pendingSyncImportArray[i]; } // Calcular importe sincronizado vía web int[] syncImportArray = listService.getTotalImportBySyncStatus(this.datePickerList.Value.Date, pGroupId, SystemConstants.SYNC_STATUS_COMPLETED); for (int i = 0; i < syncImportArray.Length; i++) { syncImport += syncImportArray[i]; } // Calcular importe sincronizado vía Código QR int[] qrSyncImportArray = listService.getTotalImportBySyncStatus(this.datePickerList.Value.Date, pGroupId, SystemConstants.SYNC_STATUS_QRUPDATED); for (int i = 0; i < qrSyncImportArray.Length; i++) { qrImport += qrSyncImportArray[i]; } // Setear los controles //this.setSyncImport(FormatService.formatInt(totalImport - pendingImport)); this.setSyncImport(FormatService.formatInt(syncImport)); this.setSyncQRImport(FormatService.formatInt(qrImport)); this.setPendingImport(FormatService.formatInt(pendingImport)); int prohibitedFactor = Int32.Parse(ServerParameterService.getProhibitedFactor()); int maxToReceive = (int)(totalImport * ((double)prohibitedFactor / 100)); this.setMaxToReceive(maxToReceive == 0 ? "" : FormatService.formatInt(maxToReceive) + " "); } }
public List <ListData> getListCollection(DateTime pDate, long pGroup) { string drawDate = FormatService.formatDrawDateToString(pDate); List <ListData> listDataCollection = new List <ListData>(); using (var context = new SILOEntities()) { var query = "SELECT '0' || L.LPS_LotteryPointSale || '000' || L.LTL_Id AS global, '0' || L.LTL_Id AS id, L.LTL_CreateDate AS date, L.LTL_CustomerName AS name FROM LTL_LotteryList AS L INNER JOIN LTD_LotteryDraw AS D ON D.LTD_Id = L.LTD_LotteryDraw " + "WHERE D.LTD_CreateDate = '" + drawDate + "' " + "AND D.LDT_LotteryDrawType = " + pGroup + " " + "AND L.LLS_LotteryListStatus <> " + SystemConstants.LIST_STATUS_CANCELED + " " + " ;"; listDataCollection = context.Database. SqlQuery <ListData>(query) .ToList() ; } return(listDataCollection); }
// Updates all pins' remaining time. If 0, remove from list public void UpdatePinTimeRemaining() { // Changing a property doesn't fire INotifyPropertyChange (dev bug), replacing pin does for (int i = 0; i < PermanentCustomPinList.Count; i++) { CustomPin pin = PermanentCustomPinList[i]; string timeLeft = new FormatService().FormatTimeRemainingToString(pin.EndTime, DateTime.Now.TimeOfDay); if (timeLeft == "expired") { PermanentCustomPinList.RemoveAt(i); } else { pin.TimeRemaining = timeLeft; PermanentCustomPinList[i] = pin; } } }
private void closeDraw(long pDrawTypeToClose, DateTime pDateToClose) { DrawService drawService = new DrawService(); LTD_LotteryDraw existingDraw = drawService.getDraw(pDrawTypeToClose, pDateToClose); // Validar si el sorteo está cerrado if (existingDraw == null || existingDraw.LDS_LotteryDrawStatus == SystemConstants.DRAW_STATUS_CLOSED) { MessageService.displayInfoMessage( "El sorteo se encuentra cerrado\nNo es necesario realizar la operación.", "SORTEO CERRADO PREVIAMENTE" ); this.clearDrawTypeBox(); } else { List <LTD_LotteryDraw> otherUnclosedDrawList = drawService.getUnclosedDraw(pDrawTypeToClose, pDateToClose); if (otherUnclosedDrawList.Count > 0) { DrawTypeService drawType = new DrawTypeService(); LDT_LotteryDrawType type = drawType.getById(pDrawTypeToClose); string unclosedDateListString = "\n\n"; foreach (LTD_LotteryDraw drawItem in otherUnclosedDrawList) { if (drawItem.LTD_CreateDate != pDateToClose) { unclosedDateListString += type.LDT_DisplayName + "\t" + FormatService.formatDrawDateToSimpleString(drawItem.LTD_CreateDate) + "\n"; } } //Console.WriteLine(unclosedDateListString); MessageService.displayWarningMessage( "Existen sorteos de fechas anteriores pendientes de cierre.\nPor favor, proceda primero a realizar los cierres pendientes:" + unclosedDateListString, "SORTEOS ANTERIORES SIN CERRAR" ); //this.clearDrawTypeBox(); } else { this.confirmDrawClosing(pDrawTypeToClose, pDateToClose); } } }
private async void enviarAlServidorToolStripMenuItem_Click(object sender, EventArgs e) { DialogResult msgResult = MessageService.displayConfirmWarningMessage( "¿Está seguro desea realizar sincronización con el servidor?", "SINCRONIZANDO TRANSACCIONES AL SERVIDOR..." ); // Procesar el resultado de la confirmación switch (msgResult) { case DialogResult.Yes: // Procesar la sincronización //this.processLinearSynchronization(); await this.processParallelSynchronization(FormatService.formatDrawDate(DateTime.Today)); break; case DialogResult.No: break; default: break; } }
public CalcPageViewModel(INavigationService navigationService, IPageDialogService dialogService, IBinaryOperationService binaryOperationService, FormatService formatService, DedicationService dedicationService, ConstantsPurchasingService purchasingService) : base(navigationService) { _dialogService = dialogService; _binaryOperation = binaryOperationService; _formatService = formatService; _dedicationService = dedicationService; _purchasingService = purchasingService; //defaults Title = "Calculator for Life"; Display = "0"; canBackSpace = true; canChangeSign = true; mustClearDisplay = false; DecimalSeparator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator; ConstCommand = new DelegateCommand(ConstCommandExecute); OptionsCommand = new DelegateCommand(OptionsCommandExecute); EnterFiguresCommand = new DelegateCommand <string>(EnterFiguresExecute); BackSpaceCommand = new DelegateCommand(BackSpaceExecute); EnterOperatorCommand = new DelegateCommand <string>(EnterOperatorExecute); CalcCommand = new DelegateCommand(CalcExecute); SignCommand = new DelegateCommand(SignExecute); MemoryCommand = new DelegateCommand <string>(MemoryExecute); AddConstantCommand = new DelegateCommand(AddConstExecute); ClearCommand = new DelegateCommand(ClearExecute); NaigateToDedicationCommand = new DelegateCommand(NavigateToDedicationExecute); //подписываемся на событие изменения настроек калькулятора, для того чтобы отформатировать Display //на основе новых настроек MessagingCenter.Subscribe <SettingsPageViewModel>(this, AppConstants.SETTINGS_CHANGED_MESSAGE, (settingsVm) => UpdateDisplayText()); }
public void Setup() { _service = new FormatService(); }
private void setTimeToSyncLabel() { int syncTimerSeconds = (int) this.getSyncTimeSpam().TotalSeconds; int timeToSync = ParameterService.getPeriodSyncInterval() / 1000 - syncTimerSeconds; if (ParameterService.isPeriodSyncEnabled()) { //this.timeToSyncLabel.Text = syncTimerSeconds == 0 ? "" : "Sincronización en: " + timeToSync; this.timeToSyncLabel.Text = syncTimerSeconds == 0 ? "" : "Sincronización en: " + FormatService.formatSecondsToMinutes(timeToSync); } else { this.timeToSyncLabel.Text = "Sincronización desactivada"; } }
public string ToString(bool full) { return(FormatService.ToString(this, FormatOptions.Default)); }
private void syncTimer_Tick(object sender, EventArgs e) { //Console.WriteLine("Tick: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); this.lastSyncTick = DateTime.Now; this.processPeridicSynchronization(FormatService.formatDrawDate(DateTime.Today)); }
public BinaryOperationService(FormatService formatService) { _formatService = formatService; }
public CardRulingRestrictionService(AccioContext context, FormatService formatService) { _context = context; _formatService = formatService; }
public void SetUp() { _formatRepository = Substitute.For <IFormatRepository>(); _sut = new FormatService(_formatRepository); }