public ActionResult Edit(int id, FormCollection collection) { try { var model = new PageModel(); UpdateModel(model); using (var repo = new PagesRepository()) { var entity = repo.GetById(model.Id); entity.Url = model.Url; entity.Monitor = model.Monitor; repo.SaveChanges(); } return(RedirectToAction("Index")); } catch { return(View()); } }
public void Render(RenderWindowLineEngine renderLineEngine, int lineNo, int width) { if (_activeNoteBook == null) { return; } var page = PagesRepository.Get(_activeNoteBook.Id, lineNo); if (page != null) { if (SelectedIndex == lineNo) { if (IsActive) { renderLineEngine.ChangeBackgroundColor(ConsoleColor.DarkMagenta); } renderLineEngine.Write("[" + page.Name + "]"); CursorY = lineNo; } else { renderLineEngine.Write(" " + page.Name + " "); } } }
public PagesServices() { if (pagesRepository == null) { pagesRepository = new PagesRepository(); } }
public HrUnitOfWork(IContextFactory <DbContext> contextFactory) // , int companyId, string culture : base(contextFactory) { // Initialize CompanyRepository = new CompanyRepository(Context); // , companyId, culture PagesRepository = new PagesRepository(Context); MenuRepository = new MenuRepository(Context); PageEditorRepository = new PageEditorRepository(Context); LookUpRepository = new LookUpRepoitory(Context); CompanyStructureRepository = new CompanyStructureRepository(Context); JobRepository = new JobRepository(Context); PeopleRepository = new PeopleRepository(Context); PositionRepository = new PositionRepository(Context); BudgetRepository = new BudgetRepository(Context); QualificationRepository = new QualificationRepository(Context); LeaveRepository = new LeaveRepository(Context); EmployeeRepository = new EmployeeRepository(Context); CustodyRepository = new CustodyRepository(Context); TrainingRepository = new TrainingRepository(Context); BenefitsRepository = new BenefitsRepository(Context); AudiTrialRepository = new AudiTrialRepository(Context); TerminationRepository = new TerminationRepository(Context); DisciplineRepository = new DisciplineRepository(Context); CheckListRepository = new CheckListRepository(Context); ComplaintRepository = new ComplaintRepository(Context); MessageRepository = new MessageRepository(Context); MedicalRepository = new MedicalRepository(Context); HrLettersRepository = new HRLettersRepository(Context); PayrollRepository = new PayrollRepository(Context); SalaryDesignRepository = new SalaryDesignRepository(Context); NotificationRepository = new NotificationRepository(Context); MissionRepository = new MissionRepository(Context); MeetingRepository = new MeetingRepository(Context); }
private static void LoadFromFile(SettingsModel settingsModel) { while (true) { Console.Write("Enter passphrase: "); var passPhrase = EnterPassword(); Encrypter.PassPhrase = Encoding.UTF8.GetBytes(passPhrase); try { var encryptedData = File.ReadAllBytes(settingsModel.File); var json = encryptedData.Decrypt(settingsModel); var stateModel = Newtonsoft.Json.JsonConvert.DeserializeObject <StateModel>(json); NotebooksRepository.Init(stateModel.Notebooks); PagesRepository.Init(stateModel.Pages); PageContentRepository.Init(stateModel.Content); return; } catch (Exception) { Console.WriteLine("Invalid passphrase. Please try again..."); } } }
private static async Task <IEnumerable <PageStatus> > HitPages() { var listPageStatus = new List <PageStatus>(); try { using (var repoPages = new PagesRepository()) { using (var repoPageStatus = new PageStatusRepository()) { //Get page with Monitor bit on. var pages = repoPages.GetAllMonitor(); //var pages = repoPages.GetAllProdMonitor(); //var pages = repoPages.GetAllStgMonitor(); var pageGetter = new PageGetter(); foreach (var page in pages) { var pageStats = new PageStats { Url = page.Url }; var stats = await pageGetter.HTTP_GET(pageStats); var pageStatus = new PageStatus { Url = stats.Url, ResponseTime = stats.ResponseTime, ContentLength = stats.ContentLength, ExceptionMessage = stats.ExceptionMessage, Status = stats.Status.ToString(), Created = DateTime.Now }; repoPageStatus.Add(pageStatus); repoPageStatus.SaveChanges(); listPageStatus.Add(pageStatus); } } } } catch (Exception ex) { // ReSharper disable once UnusedVariable var msg = ex.Message; } return(listPageStatus); }
// GET: PageAdmin/Edit/5 public ActionResult Edit(short id) { var model = new PageModel(); using (var repo = new PagesRepository()) { var entity = repo.GetById(id); model.Id = id; model.Url = entity.Url; model.Monitor = entity.Monitor; } return(View(model)); }
// GET: PageAdmin/Delete/5 public ActionResult Delete(short id) { var model = new PageModel(); using (var repo = new PagesRepository()) { var entity = repo.GetById(id); model.Id = id; model.Url = entity.Url; model.Monitor = entity.Monitor; } return View(model); }
public int Put(int id, [FromBody] PagesModel page) { var result = PagesRepository.Get(id); if (result != null) { var resultId = PagesRepository.NewPage(page.ListID, page.Title); return(resultId); } else { PagesRepository.UpdatePage(id, page.Title); } return(0); }
private static void DirectAccess() { var repoPages = new PagesRepository(); //var pages = repoPages.GetAllProdMonitor(); var pages = repoPages.GetAllStgMonitor(); var repoPageStatus = new PageStatusRepository(); var pageGetter = new PageGetter(); var counter = 1000; while (counter > 0) { foreach (var page in pages) { Console.WriteLine($"Page: {page.Url}"); var pageStats = new PageStats { Url = page.Url }; var result = pageGetter.HTTP_GET(pageStats); var stats = result.Result; var pageStatus = new PageStatus { Url = stats.Url, ResponseTime = stats.ResponseTime, ContentLength = stats.ContentLength, ExceptionMessage = stats.ExceptionMessage, Status = stats.Status.ToString(), Created = DateTime.Now }; repoPageStatus.Add(pageStatus); repoPageStatus.SaveChanges(); Console.WriteLine($"seconds: {stats.ResponseTime} length: {stats.ContentLength} time: {DateTime.Now}"); Console.WriteLine(); } Thread.Sleep(10000); counter--; } }
public ActionResult Delete(int id, FormCollection collection) { try { using (var repo = new PagesRepository()) { var entity = repo.GetById(id); repo.DbSet.Remove(entity); repo.SaveChanges(); } return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Delete(int id, FormCollection collection) { try { using (var repo = new PagesRepository()) { var entity = repo.GetById(id); repo.DbSet.Remove(entity); repo.SaveChanges(); } return(RedirectToAction("Index")); } catch { return(View()); } }
// GET: PageAdmin public ActionResult Index() { var models = new List <PageModel>(); using (var repo = new PagesRepository()) { var entities = repo.GetAll(); models.AddRange(entities.Select(page => new PageModel { Id = page.Id, Url = page.Url, Monitor = page.Monitor })); } return(View(models)); }
protected void Page_Load(object sender, EventArgs e) { var N = new PagesRepository(); int _ID; if (int.TryParse(Request.QueryString["ID"], out _ID)) { var SingleNews = N.ListPages(_ID).SingleOrDefault(); if (SingleNews != null) { if (!string.IsNullOrEmpty(SingleNews.FileUrl)) { ltrImgURL.Text = string.Format("<img src=\"/Uploads/{0}?w=400\" />", SingleNews.FileUrl); } ltrTitle.Text = SingleNews.Title; ltrFulltxt.Text = SingleNews.Description; } } }
static void Main() { //DirectAccess(); //const string url = "http://pagehitterweb.azurewebsites.net/api/Values"; //const string url = "http://localhost:9476/api/Values/?html=false&page=https://www.findlay.edu"; //const string url = "http://localhost:9476/api/Values/?html=false&page="; const string url = "http://pagehitterweb.azurewebsites.net/api/Values?html=false&page="; //const string url = "http://localhost:9476/api/Values/?json=true"; while (true) { using (var pagesRepository = new PagesRepository()) { using (var delayRepository = new DelayRepository()) { var delay = delayRepository.GetDelay(); var pages = pagesRepository.GetAllMonitor(); var interPageSleepTime = new TimeSpan(0, delay.PageHour, delay.PageMinute, delay.PageSecond); //Hit each page from web job. foreach (var page in pages) { var msg = WebServiceAccess(url + page.Url, interPageSleepTime).Result; //Console.WriteLine(msg); } //Sleep before hitting collection of pages again //Console.WriteLine($"Sleeping {delay.IterationMinute} minutes {delay.IterationSecond} seconds pageDelay: {delay.PageSecond}"); var sleepTime = new TimeSpan(0, delay.IterationHour, delay.IterationMinute, delay.IterationSecond); //1 min Thread.Sleep(sleepTime); } } } //Console.WriteLine("complete"); //Console.ReadLine(); }
public static void SaveState() { var stateModel = new StateModel { Notebooks = NotebooksRepository.Get(), Pages = PagesRepository.Get(), Content = PageContentRepository.GetAll() }; var json = Newtonsoft.Json.JsonConvert.SerializeObject(stateModel); var settingsModel = GetSettingsModel(); var dataToSave = json.Encrypt(settingsModel); File.WriteAllBytes(settingsModel.File, dataToSave); UiNotifications.Notify(ConsoleColor.Red, ConsoleColor.Black, "Saved to Disk...", 5); Task.Run(() => dataToSave.SaveToBlobAsync(settingsModel)); }
protected void Page_Load(object sender, EventArgs e) { int _ID; if (int.TryParse(Request.QueryString["ID"], out _ID)) { var N = new PagesRepository(); var F = new FilesRepository(); var SinglePage = N.ListPages(_ID).SingleOrDefault(); if (SinglePage != null) { ltrTitle.Text = SinglePage.Title; ltrFullText.Text = SinglePage.Description; ListFiles = F.ListGalleryFiles(SinglePage.GalleryID).Where(w => w.FileName != null && w.FileName.Length > 1).ToList(); rptFileGroups.DataSource = ListFiles.GroupBy(g => g.FileName).Select(s => new Files { FileName = s.Key }); rptFileGroups.DataBind(); } } }
public ActionResult Create(FormCollection collection) { try { var model = new PageModel(); UpdateModel(model); var entity = new Page {Monitor = model.Monitor, Url = model.Url}; using (var repo = new PagesRepository()) { repo.Add(entity); repo.SaveChanges(); } return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Create(FormCollection collection) { try { var model = new PageModel(); UpdateModel(model); var entity = new Page { Monitor = model.Monitor, Url = model.Url }; using (var repo = new PagesRepository()) { repo.Add(entity); repo.SaveChanges(); } return(RedirectToAction("Index")); } catch { return(View()); } }
protected void Page_Load(object sender, EventArgs e) { int _ID; if (int.TryParse(Request.QueryString["ID"], out _ID)) { var N = new PagesRepository(); var F = new FilesRepository(); var SinglePage = N.ListPages(_ID).SingleOrDefault(); if (SinglePage != null) { ltrTitle.Text = SinglePage.Title; ltrFullText.Text = SinglePage.Description; ListFiles = F.ListGalleryFiles(SinglePage.GalleryID).Where(w => w.FileName != null && w.FileName.Length > 1).ToList(); rptFileGroups.DataSource = ListFiles.GroupBy(g => g.FileName).Select(s => new Files { FileName = s.Key }); rptFileGroups.DataBind(); } } if (!IsPostBack) { if (Session["IsSent"] != null) { litScripts.Text = "<script> alert('მონაცემები გადაგზავნილია')</script>"; Session["IsSent"] = null; } } var ContactPage = new Core.CM.PagesRepository().ListPages(40).FirstOrDefault(); litContacinfo.Text = ContactPage.Description; initErrorMessages(); }
static void Main(string[] args) { // var client = new RestClient("http://localhost:9037"); // var request = new RestRequest("metroilinks/{id}", Method.GET); // request.AddUrlSegment("id", "907"); // var response = client.Execute<MetroiLinksResponse>(request); var client = new JsonServiceClient("http://dev.jetnett.com"); var repo = new PagesRepository(client); var obs = repo.GetById(8); obs.Subscribe(x => { Console.WriteLine(x.Title); }); obs.Wait(); Console.Read(); }
public bool AddPages(tb_Page pages) { _repository = new PagesRepository(); return _repository.AddPages(pages); }
public PagesSearchProvider(ISearcher searcher, ILogger <BaseSearchProvider <Page> > logger, PagesRepository pagesRepository) : base(searcher, logger) { _pagesRepository = pagesRepository; }
public PagesController(PagesRepository pagesRepository) { _pagesRepository = pagesRepository; }
// GET: PageAdmin public ActionResult Index() { var models = new List<PageModel>(); using (var repo = new PagesRepository()) { var entities = repo.GetAll(); models.AddRange(entities.Select(page => new PageModel { Id = page.Id, Url = page.Url, Monitor = page.Monitor })); } return View(models); }
public void UpdatePages(tb_Page pagesModel) { _repository = new PagesRepository(); _repository.UpdatePages(pagesModel); }
public List<usp_GetAllPages_SubPages_Result> GetAllPages_SubPages() { _repository = new PagesRepository(); return _repository.GelAllPages_SubPages(); }
public Page GetSelectedPage() { return(PagesRepository.Get(_activeNoteBook.Id, SelectedIndex)); }
public void KeyPressed(ConsoleKeyInfo key) { if (!IsActive) { return; } switch (key.Key) { case ConsoleKey.Escape: NavigateBack(); return; case ConsoleKey.Tab: if (key.Modifiers == ConsoleModifiers.Shift) { NavigateBack(); } else { NavigateForward(); } return; case ConsoleKey.Enter: NavigateForward(); return; case ConsoleKey.F7: new EnterNameWindow { Header = "Enter page name" } .SubscribeOnEnter((_, value) => { PagesRepository.Add(_activeNoteBook.Id, value); ActivePageChanged(); }) .ShowModalWindow(); return; case ConsoleKey.F2: StateKeeper.StateHasToBeSynced(); return; case ConsoleKey.F4: var selectedPage = GetSelectedPage(); if (selectedPage != null) { new EnterNameWindow { Context = selectedPage, Header = "Edit notebook name", } } .SetValue(selectedPage.Name) .SubscribeOnEnter((ctx, value) => { var page = (Page)ctx; PagesRepository.Update(_activeNoteBook.Id, page.Id, value); ActivePageChanged(); }) .ShowModalWindow(); return;
private static async Task<IEnumerable<PageStatus>> HitPages() { var listPageStatus = new List<PageStatus>(); try { using (var repoPages = new PagesRepository()) { using (var repoPageStatus = new PageStatusRepository()) { //Get page with Monitor bit on. var pages = repoPages.GetAllMonitor(); //var pages = repoPages.GetAllProdMonitor(); //var pages = repoPages.GetAllStgMonitor(); var pageGetter = new PageGetter(); foreach (var page in pages) { var pageStats = new PageStats { Url = page.Url }; var stats = await pageGetter.HTTP_GET(pageStats); var pageStatus = new PageStatus { Url = stats.Url, ResponseTime = stats.ResponseTime, ContentLength = stats.ContentLength, ExceptionMessage = stats.ExceptionMessage, Status = stats.Status.ToString(), Created = DateTime.Now }; repoPageStatus.Add(pageStatus); repoPageStatus.SaveChanges(); listPageStatus.Add(pageStatus); } } } } catch (Exception ex) { // ReSharper disable once UnusedVariable var msg = ex.Message; } return listPageStatus; }
public void Delete(int id) { PagesRepository.DeletePage(id); }
public ActionResult Edit(int id, FormCollection collection) { try { var model = new PageModel(); UpdateModel(model); using (var repo = new PagesRepository()) { var entity = repo.GetById(model.Id); entity.Url = model.Url; entity.Monitor = model.Monitor; repo.SaveChanges(); } return RedirectToAction("Index"); } catch { return View(); } }
public void DeletePages(int id) { _repository = new PagesRepository(); tb_Page dbPages= _repository.GetSingle(d => d.Page_Id == id); _repository.Delete(dbPages); }
public List<tb_Page> GetAllPages() { _repository = new PagesRepository(); return _repository.GetAllPages(); }
public PagesSearchProvider(ILogger <PagesSearchProvider> logger, PagesRepository pagesRepository, ISearcher searcher = null) : base(logger, searcher) { _pagesRepository = pagesRepository; }
public string GetPageContent(int pageId) { _repository = new PagesRepository(); return _repository.GetSingle(d => d.Page_Id == pageId).Page_Content; }
public PagesManager() { _pageRepo = new PagesRepository(); _pageModelRepo = new PageModelRepository(); }
public PagesModel Get(int pageID) { var page = PagesRepository.Get(pageID); return(page); }
public IEnumerable <PagesModel> GetByList(int listID) { var pages = PagesRepository.GetByList(listID); return(pages); }
public AboutUs(PagesRepository pagesRepository) { _pagesRepository = pagesRepository; }
public int Post([FromBody] PagesModel page) { var id = PagesRepository.NewPage(page.ListID, page.Title); return(id); }