public async Task <IActionResult> Create([Bind("Id,PublishDateTime,Content")] WarningViewModel warningViewModel) { ApplicationUser usr = await GetCurrentUserAsync(); var currentUserGuid = Guid.Parse(usr.Id); if (currentUserGuid == null) { return(NotFound()); } if (!ModelState.IsValid) { return(View(warningViewModel)); } var warning = _mapper.Map <Warning>(warningViewModel); warning.ProfileId = currentUserGuid; warning.PublishDateTime = DateTime.Now; await _warningService.Create(warning); return(RedirectToAction(nameof(Index))); }
public ActionResult ChangePassword(string turnedGuid) { if (string.IsNullOrEmpty(turnedGuid)) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } User user = um.Get(x => x.ConfirmCode.ToString() == turnedGuid); if (user == null) { WarningViewModel warning = new WarningViewModel { Details = new List <string> { "Link Movcud Deyil Ve Ya Siz Evvelce Bu Link Ile Sifrenizi Deyisdirmisiniz.", "Tekrar Deyismek Ucun Sifreni Unutdum Bolmesine Daxil Olub Sifrenizi Yenileye Bilersiniz." }, RedirectSeconds = 15, RedirectingInfo = "Linke Tiklamadiginiz Muddetce Login Sehifesine Yonlendirileceksiniz", RedirectUrl = "/MyEvernoteHome/Login", Title = "Diqqet !", IsRedirecting = true, Todo = "Zehmet Olmasa Line Tiklayin Ve Yeniden Sifrenizi Deyisdirmek Ucun Email Alin" }; return(View("Warning", warning)); } ViewBag.TurnedUser = user; return(View()); }
private string GetDescription(WarningViewModel warning) { //jakie przedziały tu przyjąć? string description = ""; int i = 0; if (warning.Temperature > 25) { description += "jest wysoka temperatura \r\n"; i++; } if (warning.Pressure > 1013) { description += "panuje wysokie ciśnienie atmosferyczne \r\n"; i++; } if (warning.Quality != "dobra" || warning.Quality != "bardzo dobra" || warning.Quality != "") { description += "jakość powietrza jest " + warning.Quality + "\r\n"; i++; } //jakie komunikaty switch (i) { case 1: description += "uważaj na siebie"; break; case 2: description += "bardzo uważaj na siebie"; break; case 3: description += "zachowaj wszystkie środki ostrożności"; break; default: break; } return(description); }
public ActionResult EmployTesterForJob(SelectTestJobTesterViewModel tjt) { if (ModelState.IsValid) { TesterManager tm = new TesterManager(); if (tm == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Test_Job tj = testJobManager.Find(x => x.JobAdvId == tjt.Adv_Id); if (tj == null) { return(HttpNotFound()); } if (tj.job_testers.Count == tj.tester_limit) { WarningViewModel erv = new WarningViewModel() { Title = "HATA", RedirectingTimeout = 2000, RedirectingUrl = "/Test_Job/EmployTesterForJob/" + tj.JobAdvId }; erv.Items.Add("Görevin Tester Limiti Dolmuştur..!"); return(View("Warning", erv)); } else { Tester selectedTM = testerManager.GetTesterById(tjt.selectedTesterId).Result; selectedTM.isReady = false; tj.job_testers.Add(selectedTM); if (tj.job_testers.Count == tj.tester_limit) { tj.start_date = DateTime.Now; } if (testJobManager.Update(tj) > 0) { selectedTM.notifications.Add(new Notification() { notification = tj.test_job_title + " Görevine Atandınız.", link = "/Test_Job/Details/" + tj.JobAdvId, IsRead = false }); tm.Update(selectedTM); OkViewModel OkntfyObj = new OkViewModel() { Title = "Atama Başarılı..", RedirectingUrl = "/Job_Adv/Details/" + jobAdvManager.Find(y => y.JobAdvId == tjt.Adv_Id).JobAdvId, RedirectingTimeout = 3000 }; OkntfyObj.Items.Add("Tester " + selectedTM.user_name + " " + selectedTM.user_surname + " Başarılı bir şekilde " + tj.test_job_title + " görevine atandı..!"); return(View("Ok", OkntfyObj)); } } } return(View(tjt)); }
public void StopTimer() { IoCContainer.Kernel.Unbind <IStationRepository>(); IoCContainer.Kernel.Bind <IStationRepository>().To <StationRepository>().InSingletonScope(); var model = new WarningViewModel(); //Dispatcher.InvokeShutdown(); Assert.IsTrue(model._timer.IsEnabled); //model.MouseDownCommand.Execute(); //Assert.IsTrue(!model._timer.IsEnabled); }
public ActionResult EmployTesterForJob(int?id) { SelectTestJobTesterViewModel jobTester = new SelectTestJobTesterViewModel(); if (id == null) { WarningViewModel erv = new WarningViewModel() { Title = "HATA 404", RedirectingTimeout = 2000, RedirectingUrl = "/Job_Adv/Details/" + id }; erv.Items.Add("Hatalı Parametre..!"); return(View("Warning", erv)); } Test_Job tj = testJobManager.Find(x => x.JobAdvId == id.Value); if (tj != null && tj.job_testers != null) { Test_Job test_Job = testJobManager.Find(x => x.JobAdvId == id.Value); if (test_Job == null) { return(HttpNotFound()); } List <Tester> ts = new List <Tester>(); foreach (var item in testerManager.List(x => x.isReady)) { ts.Add(item); } jobTester.Adv_Id = id.Value; jobTester.Testers = ts; jobTester.Test_job = test_Job; jobTester.limit = test_Job.tester_limit; jobTester.jobtesters = test_Job.job_testers; jobTester.Remaining = test_Job.tester_limit - test_Job.job_testers.Count; return(View(jobTester)); } else { WarningViewModel erv = new WarningViewModel() { Title = "HATA", RedirectingTimeout = 2000, RedirectingUrl = "/Job_Adv/Details/" + id }; erv.Items.Add("Henüz bir kullanım senaryosu oluşturmadınız..!"); return(View("Warning", erv)); } }
public ActionResult TestNofity() { WarningViewModel model = new WarningViewModel(); { model.Items = new List <string>() { "yermisin", "yemezmisin" }; model.Header = "olur böyle"; model.RedirectingTimeout = 100000; }; return(View("Warning", model)); }
public WarningView(string warningMsg) { InitializeComponent(); this.MouseDown += (sender, e) => { if (e.LeftButton == MouseButtonState.Pressed) { this.DragMove(); } }; WarningViewModel warningViewModel = new WarningViewModel(warningMsg); this.DataContext = warningViewModel; }
public void UpdateCounter() { IoCContainer.Kernel.Unbind <IStationRepository>(); IoCContainer.Kernel.Bind <IStationRepository>().To <StationRepository>().InSingletonScope(); IoCContainer.Kernel.Get <IStationRepository>().AutoLogoutWindowLiveTimeInSec = 5; var model = new WarningViewModel(); var firedEvents = new List <string>(); model.PropertyChanged += ((sender, e) => firedEvents.Add(e.PropertyName)); model.UpdateCounter(null, null); Assert.IsTrue(firedEvents.Contains("Counter")); }
public IActionResult Delete(int deletingEntity, bool accept = false) { if (_context.Goals.Include(x => x.Payments).FirstOrDefault(x => x.GoalId == deletingEntity).Payments.Count == 0 || accept) { _context.Goals.Remove(_context.Goals.FirstOrDefault(x => x.GoalId == deletingEntity)); _context.SaveChanges(); return(RedirectToAction("MainAdmin", "Users")); } else { WarningViewModel wvm = new WarningViewModel { Controller = "Goals", Entity = deletingEntity, Message = "This goal used for some payments, are you sure that you want delete it? You will some information about pays." }; return(View("Warning", wvm)); } }
public IActionResult Delete(int deletingEntity, bool accept = false) { if (_context.Cards.Include(x => x.Account).FirstOrDefault(x => x.CardId == deletingEntity).Account == null || accept) { _context.Cards.Remove(_context.Cards.FirstOrDefault(x => x.CardId == deletingEntity)); _context.SaveChanges(); return(RedirectToAction("Main", "Users")); } else { WarningViewModel wvm = new WarningViewModel { Controller = "Cards", Entity = deletingEntity, Message = "Are you sure that you want delete this card? Information about accounts and payments linked with this card will be lost!" }; return(View("Warning", wvm)); } }
#pragma warning restore IDISP006 // Implement IDisposable. public ConfigureDeviceViewModel(UserViewModel userViewModel, SpinnerViewModel spinnerViewModel, WarningViewModel warningViewModel, PopupViewModel popupViewModel) { this.UserViewModel = userViewModel; this.SpinnerViewModel = spinnerViewModel; this.SpinnerViewModel.SpinnerHeight = 15; this.SpinnerViewModel.SpinnerWidth = 15; this.SpinnerViewModel.EllipseSize = 5; this.SpinnerViewModel.UpdateView(); this.PopupViewModel = popupViewModel; this.WarningViewModel = warningViewModel; RefreshComPortsCommand = new RefreshComPortsCommand(this); RefreshPatientsCommand = new RefreshPatientsCommand(this); ConfigureDeviceCommand = new ConfigureDeviceCommand(this); }
public ActionResult Index([Bind(Include = "Location")] WarningViewModel warning) { if (ModelState.IsValid) { Airly airly = new Airly(); NpgsqlConnection connection = new NpgsqlConnection( System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString); connection.Open(); connection.TypeMapper.UseNetTopologySuite(); using (var cmd = new NpgsqlCommand( "SELECT \"Airly_CAQI\", \"Temperature\", \"Pressure\" " + "FROM \"Airly\" JOIN \"AirlySensor\" " + "ON \"Airly\".\"SensorId\" = \"AirlySensor\".\"Id\" " + "WHERE \"Location\" IS NOT NULL " + "AND \"TimeStamp\" >= now() - interval '3h' " + "AND ST_Distance(\"Location\", ST_GeomFromText('POINT(" + warning.Location + ")', 4326)) < 1000 " + "ORDER BY ST_Distance(\"Location\", ST_GeomFromText('POINT(" + warning.Location + ")', 4326)), " + "\"TimeStamp\" DESC LIMIT 1;", connection)) using (var reader = cmd.ExecuteReader()) { try { reader.Read(); warning.AirlyCAQI = reader.GetFloat(0); warning.Temperature = reader.GetFloat(1); warning.Pressure = reader.GetFloat(2); warning.Quality = GetQuality(warning.AirlyCAQI); warning.Description = GetDescription(warning); reader.Close(); } catch (Exception ex) { warning.Description = "Wystąpiły problemy przy pobieraniu ostrzeżeń dla Twojej lokalizacji"; Console.WriteLine(ex); } } connection.Close(); return(RedirectToAction("Warning", "Warning", warning)); } warning.Description = "Wystąpił błąd i nie udało się pobrać Twojej lokalizacji"; return(RedirectToAction("Warning", "Warning", warning)); }
public ActionResult ActivationConfirming(string confirm) { BussinessProcessedType <User> bpResult = um.ConfirmUser(confirm); if (bpResult.ProcessedCount > 0) { CurrentCookieTester.SetCookie(CookieKeys.signedUserToken, bpResult.Entity.Token.ToString()); return(RedirectToAction("Index")); } if (bpResult.Status == InformingOrError.InformMailAlreadyConfirmed) { ViewBag.userName = bpResult.Entity.Username; WarningViewModel model = new WarningViewModel() { RedirectingInfo = "Esas Sehifeye Yonlendirilirsiniz...", RedirectSeconds = 8, RedirectUrl = "/MyEvernoteHome/Index", Todo = "Hesabiniz Tesdiqlenmisdir. Artiq Istediyiniz Zaman Login Sehifesinden Hesabiniza Daxil Ola bilersiniz." }; model.Details.Add("Hesabiniz Daha Once Tesdiqlenmisdir. Buna Gore Artiq Aktivlesdirme Linki Passivdir."); return(View("Warning", model)); } ViewBag.userName = null; ErrorViewModel modelUnknown = new ErrorViewModel() { RedirectingInfo = "Esas Sehifeye Yonlendirilirsiniz...", RedirectSeconds = 8, RedirectUrl = "/MyEvernoteHome/Index", Todo = "Zehmet Olmasa Biraz Gozledikden Sonra Tekrar Cehd Edin" }; modelUnknown.Details.Add(new BussinessError { ErrorCode = InformingOrError.ErrorRegisterFailedSendingConfirmEmail, Detail = "Hesabinizda Tesdiqlenme Emeliyyati Aparilarken Xeta Yarandi." }); return(View("Error", modelUnknown)); }
public void OnAuthorization(AuthorizationContext filterContext) { if (CurrentSession.User != null && CurrentSession.User.IsAdmin != false) { WarningViewModel warningNotifyObj = new WarningViewModel() { Title = "Yetkiniz Bulunmamaktadır!" , RedirectingTimeout = 100 }; warningNotifyObj.Items.Add("Bu sayfaya erişim yetkiniz bulunmamaktadır."); filterContext.Result = new ViewResult { ViewName = "Warning", ViewData = new ViewDataDictionary(filterContext.Controller.ViewData) { Model = warningNotifyObj } }; } }
public ActionResult Applicants(int?id) { SelectAdvTestMasterViewModel advtestmaster = new SelectAdvTestMasterViewModel(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (jobAdvManager.Find(x => x.JobAdvId == id.Value).SelectedTestMaster != null) { WarningViewModel erv = new WarningViewModel() { Title = "HATA", RedirectingTimeout = 2000, RedirectingUrl = "/Job_Adv/Details/" + id }; erv.Items.Add("Görevde atanmış bir Test Master bulunmaktadır..!"); return(View("Warning", erv)); } else { Job_Adv job_Adv = jobAdvManager.Find(x => x.JobAdvId == id.Value); if (job_Adv == null) { return(HttpNotFound()); } List <Test_Master> tms = new List <Test_Master>(); foreach (var item in jobAppManager.List(x => x.Job_Adv.JobAdvId == id.Value)) { tms.Add(item.Test_Master); } advtestmaster.Adv_Id = job_Adv.JobAdvId; advtestmaster.testMasters = tms; return(View(advtestmaster)); } }
public WarningController(IWarningService warningService, WarningViewModel warning) { this.WarningService = warningService; this.Warning = warning; }
public ActionResult Warning(WarningViewModel warning) { return(View(warning)); }
public WarningView(Window backView) { InitializeComponent(); DataContext = new WarningViewModel(this, backView); }
public ActionResult EditProfile(ShareBookUser model, HttpPostedFileBase file) { using (SharebookUserManager sharebookUserManager = new SharebookUserManager()) { if (file == null) { ModelState.Remove("ProfilPhoto"); } ModelState.Remove("Email"); ModelState.Remove("Password"); if (ModelState.IsValid) { string oldPhoto = string.Empty; if (file != null) { FileHelper fileHelper = new FileHelper(); var imgPath = Server.MapPath("~/Images/UserProfilePhoto"); model.ProfilPhoto = fileHelper.SaveImage(file, imgPath, "/Images/UserProfilePhoto"); } BusinessLayerResult <ShareBookUser> oldPhotoRes = sharebookUserManager.getUserById(model.Id); string defaultImage = oldPhotoRes.Result.ProfilPhoto.Split('/')[3]; if (defaultImage != "default1.png" && defaultImage != "default2.png" && defaultImage != "default3.png" && defaultImage != "default4.png" && defaultImage != "default5.png" && defaultImage != "default6.png") { oldPhoto = HttpContext.Server.MapPath("~" + oldPhotoRes.Result.ProfilPhoto); } BusinessLayerResult <ShareBookUser> res = sharebookUserManager.UpdateProfile(model); if (res.Errors.Count > 0) { ErrorViewModel errorObj = new ErrorViewModel() { Items = res.Errors, Tittle = "Profil Güncellenemedi...", RedirectingUrl = "/Home/ShowProfile", }; return(View("Error", errorObj)); } if (file != null) { if (System.IO.File.Exists(oldPhoto)) { System.IO.File.Delete(oldPhoto); } } CurrentSession.Set <ShareBookUser>("loginOk", res.Result); return(RedirectToAction("ShowProfile", "Home")); } else { WarningViewModel warningNotifyObj = new WarningViewModel() { RedirectingUrl = "/Home/ShowProfile", }; warningNotifyObj.Items.Add("Boş geçilmemesi gereken bir alanı boş geçtiniz..."); return(View("Warning", warningNotifyObj)); } } }
public WarningView(string warningText) { InitializeComponent(); BindingContext = new WarningViewModel(warningText); }