public void LoadGridInMemory() { dtgGridCustomer.DataSource = null; IEnumerable <CustomerBase> custs = Idal.GetData(); //inmemory dtgGridCustomer.DataSource = custs; }
public ResponseModel <PolicyDTO> GetPolicyById(string id) { var result = new ResponseModel <PolicyDTO>(); if (string.IsNullOrEmpty(id)) { throw new ArgumentNullException(string.Empty, MessageValues.ARGUMENT_NULL); } var policies = _policiesRepository.GetData(); var policy = policies.Models.SingleOrDefault(p => string.Equals(p.IdPolicy, id, StringComparison.InvariantCultureIgnoreCase)); if (policy == null) { result.NotValidResponse(string.Format(MessageValues.POLICY_NOT_FOUND, nameof(id), id)); return(result); } result.IsValid = true; result.Model = (PolicyDTO) new PolicyDTO().InjectFrom(policy); return(result); }
public void WriteXmlFile(Stream fs, string nsString) { using (XmlWriter xmlWriter = XmlWriter.Create(fs, new XmlWriterSettings { Indent = true })) { xmlWriter.WriteStartElement("catalog", nsString); xmlWriter.WriteAttributeString("dounloadtime", DateTime.Today.ToString()); xmlWriter.WriteAttributeString("BooksCount", booksRepository.GetData().Count().ToString()); xmlWriter.WriteAttributeString("NewspapersCount", newsPapersRepository.GetData().Count().ToString()); xmlWriter.WriteAttributeString("PatentCount", patentsRepository.GetData().Count().ToString()); xmlWriter.Flush(); foreach (var book in GetBooks()) { WriteBookToXml(XNamespace.Get(nsString), book).WriteTo(xmlWriter); xmlWriter.Flush(); } foreach (var newsPaper in GetNewsPapers()) { WriteNewsPaperToXml(XNamespace.Get(nsString), newsPaper).WriteTo(xmlWriter); xmlWriter.Flush(); } foreach (var patent in GetPatents()) { WritePatentToXml(XNamespace.Get(nsString), patent).WriteTo(xmlWriter); xmlWriter.Flush(); } xmlWriter.WriteEndElement(); xmlWriter.Close(); } }
private async void getUsers() { List <User> users = await _jobRepository.GetData(); this.registeredUsers = users; Console.WriteLine("This is the GetUsers method and this the registered users", this.registeredUsers); }
public void parseData() { loger.AddLog("Data before parse:" + repository.GetData()); var result = repository.GetData().Split(new char[] { ',' }); Console.WriteLine("Separeted string:"); foreach (var r in result) { loger.AddLog(r); } }
public async Task ProcessPurchases() { try { _logHandler.LogInfo("Looking for purchases..."); var purchases = await _repo.GetData(); if (!purchases.List.Any()) { _logHandler.LogInfo("No purchases found!"); return; } else { _logHandler.LogInfo("Purchases found!"); } var generatedReceipts = new List <IReceipt>(); foreach (var purchase in purchases.List) { var receipt = await _calculator.Compute(purchase); generatedReceipts.Add(receipt); } await _notifier.Notify(new ReceiptContainer(generatedReceipts)); } catch (Exception e) { _logHandler.LogError(e.Message); } }
/// <summary> /// Call Sharepoint and do clean up for stored timeregs /// </summary> public virtual void SyncTimeregs(List <Timeregistration> timeregs) { //TODO: Add logging + give user feedback when timeregs are synchronised. _toolkitUser = _toolkitUser ?? _toolkitUserRepository.GetData(); _toolkits = _toolkits ?? _toolkitRepository.GetData(); var distinctTkDisplayNames = timeregs.Select(x => x.ToolkitDisplayName).Distinct(); foreach (var tkDisplayName in distinctTkDisplayNames) { var timeregsInTk = timeregs.Where(x => x.ToolkitDisplayName == tkDisplayName).ToList(); var tk = _toolkits.Single(x => x.DisplayName == tkDisplayName); _sharepointClient.MakeTimeregistrations(timeregsInTk, _toolkitUser, tk); } //Send to Sharepoint foreach (var timereg in timeregs.Where(tr => !tr.IsSynchronized)) { var toolkit = GetRelevantToolkit(timereg); var id = _sharepointClient.MakeTimeregistration(timereg, _toolkitUser, toolkit); timereg.IsSynchronized = id != -1; } _timeregistrationRepository.SaveData(timeregs); }
public ListOfArray GenerateData(string path) { ListOfArray lst = new ListOfArray(); lst.List = _repository.GetData(path); return(lst); }
public string GetData(string data) { if (string.IsNullOrWhiteSpace(data)) { throw new ArgumentException("data shouldn't be empty"); } return(_repo.GetData(data)); }
public async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest request, ILogger log) { log.LogInformation("C# HTTP Trigger Function processed a request"); var somedata = _repository.GetData() + ":" + _cci.GetCCI(); return(new OkObjectResult(somedata)); }
public void OnLoadInput_01(object sender, InputLoadEventArgs e) { // get data based on passed arguments (e.SomeProperty) // construct IModel myModel = _repository.GetData(e.SomeProperty); // pass data to IView_MainForm View.SetInput01Data(myModel.Input01Data); }
private Service() { escadronManager = new Repository<EscadronConfiguration>(WebApi.DEFAULT_FILE_PATH); recentFilesManager = new Repository<FichiersRecentsConfiguration>(WebApi.DEFAULT_RECENT_FILES_PATH); data = escadronManager.GetData(); recentFiles = recentFilesManager.GetData(); AddToRecentFiles(); }
public async Task <IActionResult> GetServices() { Console.WriteLine("This is the get All service method"); var model = await _repo.GetData(); // return Ok(_mapper.Map<IEnumerable<ServiceDto>>(model)); return(Ok(_mapper.Map <IEnumerable <ServiceDto> >(model))); // return Ok(model); }
public IEnumerable <Person> GetData() { try { return(_personRepo.GetData()); } catch (Exception) { throw new Exception(); } }
/// <summary> /// 根据查询条件获取数据 /// </summary> /// <param name="propertyExpr">查询条件</param> /// <returns></returns> public static IList <Tentity> GetData(Expression <Func <Tentity, bool> > propertyExpr = null) { try { IRepository <Tentity> adlServeice = CommonContainer.kernel.Resolve <IRepository <Tentity> >(); return(adlServeice.GetData(propertyExpr).ToList()); } catch (Exception ex) { Log4NetHepler.WriteLogToFile(ex); } return(null); }
public ResponseModel <ClientDTO> GetClientById(string id) { var result = new ResponseModel <ClientDTO>(); if (string.IsNullOrEmpty(id)) { throw new ArgumentNullException(string.Empty, MessageValues.ARGUMENT_NULL); } var clients = _clientsRepository.GetData(); var client = clients.Models.SingleOrDefault(c => string.Equals(c.IdClient, id, StringComparison.InvariantCultureIgnoreCase)); if (client == null) { result.NotValidResponse(string.Format(MessageValues.CLIENT_NOT_FOUND, nameof(id), id)); return(result); } result.IsValid = true; result.Model = (ClientDTO) new ClientDTO().InjectFrom(client); return(result); }
public List <MovieViewModel> GetData() { List <Movie> movList = MovieRepo.GetData(); var mov = movList.Select(x => new MovieViewModel { ID = x.ID, Title = x.Title, GrossRevenue = x.GrossRevenue, WeekendRevenue = x.WeekendRevenue, Release = x.Release, Recommended = x.Recommended }); return(mov.ToList()); }
//METODO MOSTRAR public IEnumerable <Ncargo> Getall() { using (var dt = cargo_repository.GetData(null)) { listacargo = new List <Ncargo>(); foreach (DataRow item in dt.Rows) { listacargo.Add(new Ncargo() { idcargo = Convert.ToInt32(item[0]), //IDCARGO nombre_cargo = Convert.ToString(item[1]), //NOMBRE CARGO descripcion = Convert.ToString(item[2]) //DESCRIPCION }); } } return(listacargo); }
public TimeManager(IRepository <ToolkitUser> tkUserRepo, IRepository <List <Toolkit> > tkRepo, IRepository <List <Timeregistration> > timeregRepo, ISharepointClient spClient, IEncryption encryptionManager) { _toolkitUserRepository = tkUserRepo; _toolkitRepository = tkRepo; _timeregistrationRepository = timeregRepo; _sharepointClient = spClient; UserInfo = _toolkitUserRepository.GetData(); if (UserInfo.Password?.Length > 0) { UserInfo.SecurePassword = new NetworkCredential("", encryptionManager.DecryptText(UserInfo.Password)) .SecurePassword; } _toolkits = _toolkitRepository.GetData(); }
public async Task <ActionResult> GetData() { if (!UserController.IsAdmin(HttpContext)) { return(Unauthorized("User: Not logged in")); } try { return(Ok(await _db.GetData())); } catch (Exception ex) { _log.LogError("Admin: Unable to get data from Database: " + ex); return(NotFound("Admin: Unable to get data from Database")); } }
public async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = "hello")] HttpRequest req, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); string name = req.Query["name"]; string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); dynamic data = JsonConvert.DeserializeObject(requestBody); name = name ?? data?.name; string responseMessage = string.IsNullOrEmpty(name) ? "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response." : $"Hello, {name}. DI Test: {_repository.GetData()}"; return(new OkObjectResult(responseMessage)); }
public List <Journal> GetData(eSource source) { try { if (source == eSource.DataBase) { return(repoJournal.GetData()); } else { string rootPath = System.Environment.CurrentDirectory.Replace(@"MagazineConsoleApp\bin\Debug", @"Magazine.Data\Uploads\"); string fileName = "UploadedEvents.csv"; string pathToFile = rootPath + fileName; List <Journal> lst = new List <Journal>(); using (CsvReader csvReader = new CsvReader(new StreamReader(pathToFile), hasHeaders: false)) { while (csvReader.ReadNextRecord()) { string mes = csvReader[0]; string dateStr = csvReader[1]; if (string.IsNullOrEmpty(mes) || string.IsNullOrEmpty(dateStr)) { continue; } DateTime datetime = Convert.ToDateTime(dateStr); lst.Add(new Journal { Message = mes, MessageDate = datetime }); } } return(lst); } } catch (Exception ex) { Console.WriteLine(ex.Message); return(default(List <Journal>)); } }
public void Init() { _toolkitUserRepository = new Repository <ToolkitUser>(); _toolkitUser = _toolkitUserRepository.GetData(); try { _toolkitUser.SecurePassword = new NetworkCredential("", _encryptionManager.DecryptText(_toolkitUser.Password)).SecurePassword; } catch (Exception) { _toolkitUser.SecurePassword = new NetworkCredential("", "").SecurePassword; } _toolkitUser.Password = ""; _sharepointClient = new SharepointClient(); _clientContext = new ClientContext("https://goto.netcompany.com/cases/GTO22/NCMOD") { Credentials = new NetworkCredential(_toolkitUser.Name, _toolkitUser.SecurePassword, _toolkitUser.Domain) }; }
/// <summary> /// 根据查询条件获取数据 /// </summary> /// <param name="propertyExpr">查询条件</param> /// <returns></returns> public IList <T_Code_ControlLevel> GetData(Expression <Func <T_Code_ControlLevel, bool> > propertyExpr = null) { return(_repository.GetData(propertyExpr)); }
public void GetData(IQueryable <Location> data, TableData result, PageReq pageRequest = null) { _app.GetData(data, result, pageRequest); }
/// <summary> /// 根据查询条件获取数据 /// </summary> /// <param name="propertyExpr">查询条件</param> /// <returns></returns> public IList <T_Bas_RainfallPointInfo> GetData(Expression <Func <T_Bas_RainfallPointInfo, bool> > propertyExpr = null) { return(_repository.GetData(propertyExpr)); }
/// <summary> /// 根据查询条件获取数据 /// </summary> /// <param name="propertyExpr">查询条件</param> /// <returns></returns> public IList <T_Bas_Module> GetData(Expression <Func <T_Bas_Module, bool> > propertyExpr = null) { return(_repository.GetData(propertyExpr)); }
/// <summary> /// 根据查询条件获取数据 /// </summary> /// <param name="propertyExpr">查询条件</param> /// <returns></returns> public IList <T_Code_NoiseSource> GetData(Expression <Func <T_Code_NoiseSource, bool> > propertyExpr = null) { return(_repository.GetData(propertyExpr)); }
/// <summary> /// 根据查询条件获取数据 /// </summary> /// <param name="propertyExpr">查询条件</param> /// <returns></returns> public IList <T_Bas_CalibrateParameter> GetData(Expression <Func <T_Bas_CalibrateParameter, bool> > propertyExpr = null) { return(_repository.GetData(propertyExpr)); }
public void GetData(IQueryable <PbomDetail> data, TableData result, PageReq pageRequest = null) { _app.GetData(data, result, pageRequest); }
public void FileOpen(string path) { if (!File.Exists(path)) throw new FileNotFoundException(); escadronManager.Dispose(); escadronManager = new Repository<EscadronConfiguration>(path); data = escadronManager.GetData(); AddToRecentFiles(); }
public void FileCreate(string path, string saveName = null) { escadronManager.Dispose(); if (File.Exists(path)) File.Delete(path); escadronManager = new Repository<EscadronConfiguration>(path, true); data = escadronManager.GetData(); if (saveName != null) { data.Nom = saveName; } InitializeGrades(); escadronManager.Save(); AddToRecentFiles(); }
public void GetData(IQueryable <Workshop> data, TableData result, PageReq pageRequest = null) { _app.GetData(data, result, pageRequest); }