private async void btnPickFile_Click(object sender, RoutedEventArgs e) { var picker = new Windows.Storage.Pickers.FileOpenPicker(); picker.ViewMode = Windows.Storage.Pickers.PickerViewMode.Thumbnail; picker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.DocumentsLibrary; picker.FileTypeFilter.Add(".json"); picker.FileTypeFilter.Add(".csv"); picker.FileTypeFilter.Add(".xml"); picker.FileTypeFilter.Add(".txt"); StorageFile file = await picker.PickSingleFileAsync(); if (file != null) { // Application now has read/write access to the picked file this.tbFilename.Text = "Picked file: " + file.Name; ReadService.ReadFromFile(file); } else { this.tbFilename.Text = "Operation cancelled."; } }
public void LaadArtikelen() { string pad = FolderPad + BestandsNaam; List <string[]> artikelLijst = ReadService.TxtFile_To_ListOfStringArrays(pad, Separator); Artikelen = ZetArtikelArraysOmNaarObjecten(artikelLijst, huidigDecimaalTeken); }
public ActionResult Delete(string id) { if (!Common.CheckUserSession()) { return(this.RedirectToAction("Index", "Login")); } var ids = id.Split(','); for (int i = 0; i < ids.Length; i++) { new ReadService(Common.GetConnectionString()).Delete(Convert.ToInt32(ids[i])); } var searchString = Request.Form["SearchString"]; var pageNumber = Convert.ToInt16(Request.Form["PageNumber"]); var pageSize = Convert.ToInt16(Request.Form["PageSize"]); var readList = new ReadService(Common.GetConnectionString()).GetAll().Where(x => x.Topic.Contains(searchString)).Skip((pageNumber - 1) * pageSize).Take(pageSize); //var articleList = new ArticleService(Common.GetConnectionString()).LoadArticles("Title", "ASC", pageNumber, pageSize); ViewBag.SearchText = searchString; ViewBag.PageNumber = pageNumber; ViewBag.PageSize = pageSize; return(View("_Partial", readList)); }
/* * Response: * Responses of type <nok> indicate a problem with the received Read Service request. * The response <ok> indicates the Read Service was accepted and the data is part of the response. * <read-r> ::= <nok> | <ok><table-data> * * */ protected virtual byte[] OnProcessReadService(ReadService service, byte[] data) { byte[] request = null; // verificar si el paquete recibido tiene un ACK if (service.ResponseCode.Value == ServiceResponseCode.Ok) { // Verificar si necesita mas paquetes if (!service.HasMorePackets) { OnServiceExecutionInvoke(service, ServiceExecutionCompleted); request = ExecuteNextService(); } else if (service.IsDuplicatePacket) { request = new byte[] { 0x06 }; // ACK } } else { OnServiceExecutionInvoke(service, ServiceExecutionError); StartCloseSession(true); } return(request); }
public void Read_ReadFromConfiguration_ReturnsHelloWorld() { var readService = new ReadService(); var message = readService.Read(); Assert.AreEqual(message.Message, "Hello World"); }
public LogHandler() { var logBookEntityModel = new LogBookEntityModel(); UpdateDatabase.Execute(); _writeService = new WriteService(logBookEntityModel); _readService = new ReadService(logBookEntityModel); }
private void btnOpenBestand_Click(object sender, RoutedEventArgs e) { ReadService gekozenBestand = new ReadService(); string bestandsPad = gekozenBestand.OpenBestand("Text documents (.txt)|*.txt|Comma seperated values (.csv)|*.csv"); personen2 = gekozenBestand.ToStringArray_List(bestandsPad, ';'); HaalInfoOp(bestandsPad); }
public void Initialise() { var connection = Effort.DbConnectionFactory.CreateTransient(); _mockContext = new LogBookEntityModel(connection); _mockContext.Database.CreateIfNotExists(); _writeService = new WriteService(_mockContext); _readService = new ReadService(_mockContext); }
public ActionResult Edit(Read read) { if (!Common.CheckUserSession()) { return(this.RedirectToAction("Index", "Login")); } var success = new ReadService(Common.GetConnectionString()).Save(read, true); return(RedirectToAction("Detail", new { id = read.GUID })); }
public ActionResult Detail(string id) { if (!Common.CheckUserSession()) { return(this.RedirectToAction("Index", "Login")); } var read = new ReadService(Common.GetConnectionString()).GetAll().Where(x => x.GUID == id).SingleOrDefault(); return(View(read)); }
public Sensors(IDataPublisher dataPublisher, IDataRepository iDataRepo, ReadService rdS) { sensorDataRepo = iDataRepo; sensorDataPublisher = dataPublisher; readService = rdS; sensorDataRepo.SetData(readService.ReadCSVFile("./Data.csv")); turnedOn = true; timeStep = 4; currentData = new LiveMetaData(sensorDataRepo.GetData().First().StationId, timeStep, DateTime.Now); cancelTokenSource = new CancellationTokenSource(); _httpClient = new HttpClient(); }
public async Task GetByMerchantId_When_MerchantId_Has_No_Payments_Return_Empty_List() { var mockContext = new Mock <PaymentsDbContext>(); mockContext.Setup(x => x.Payments).ReturnsDbSet(Payments); var service = new ReadService(mockContext.Object); var actual = await service.GetByMerchantId(123); actual.Should().HaveCount(0); }
static void Main(string[] args) { ReadService readService = new ReadService(); IWriteService writeService; var message = readService.Read(); writeService = GetWriteServiceFromConfiguration(); writeService.Write(message); Console.ReadKey(); }
// // GET: /Read/ public ActionResult Index() { if (!Common.CheckUserSession()) { return(this.RedirectToAction("Index", "Login")); } Session["ActiveMenu"] = "manageRead"; var readList = new ReadService(Common.GetConnectionString()).GetAll(); ViewBag.SearchText = ""; ViewBag.PageNumber = "1"; ViewBag.PageSize = "10"; ViewBag.OrderColumn = ""; ViewBag.OrderBy = ""; return(View(readList)); }
public IActionResult Index() { string res = ReadService.GetContent("choc test"); var res2 = ReadService.GetContents(); LogHelper.GetLogger().Debug(res + "debug"); LogHelper.GetLogger().Info(res + "info"); LogHelper.GetLogger().Error(res + "error"); LogRequest logRequest = new LogRequest { FName = "FName", FDetails = "FDetails", FIPAddress = "FIPAddress", FMessage = "FMessage", FParameters = "FParameters", FRequestTime = DateTime.Now, FRequestType = "FRequestType", FRequestUrl = "FRequestUrl", FRequestUser = "******" }; LogHelper.LogRequest(logRequest); var logRes = LogRequestRepository.GetAllList(); return(View()); }
public async Task GetByMerchantId_When_MerchantId_Has_Payments_Return_Payments_List() { var payment = new Payment { PaymentId = 321, MerchantId = 123, Amount = 234.23m, Currency = "USD" }; Payments.Add(payment); var mockContext = new Mock <PaymentsDbContext>(); mockContext.Setup(x => x.Payments).ReturnsDbSet(Payments); var service = new ReadService(mockContext.Object); var payments = await service.GetByMerchantId(123); payments.Should().HaveCount(1); }
public ReadServiceController() { _readService = new ReadService(); }
public HelloWorldController() { readService = new ReadService(); message = readService.Read(); }
private static void ReadCustomerData() { var read = new ReadService(); _customers = read.ReadAll(@"c:\tmp\test.txt").ToList(); }