public IActionResult OnGet(int id) { applicant = id; Models.Application app = _unitOfWork.Application.GetFirstOrDefault(x => x.ApplicantId == applicant); string tempId = _unitOfWork.Applicant.GetFirstOrDefault(a => a.ApplicantId == id).ApplicationUserId; name = _unitOfWork.ApplicationUser.GetFirstOrDefault(b => b.Id == tempId).FullName; if (User.IsInRole(SD.AdministratorRole)) { mentors = _applicationDBContext.Users.Where(p => p.Id == _applicationDBContext.UserRoles.FirstOrDefault(a => a.UserId == p.Id && a.RoleId == "31b1a51e-4cfd-4728-b195-943dbe187246").UserId).ToList(); } if (User.IsInRole(SD.MentorRole)) { assignment = _unitOfWork.MentorAssignment.GetFirstOrDefault(y => y.ApplicationId == app.Id && y.ApplicationUserId == _applicationDBContext.Users.FirstOrDefault(p => p.Email == User.Identity.Name).Id); } ma = _unitOfWork.MentorAssignment.GetAll(a => a.ApplicationId == app.Id).ToList(); mentorAssignmentsNotesVM = new List <MentorAssignmentsNotesVM>(); foreach (var m in ma) { mentorAssignmentsNotesVM.Add(new MentorAssignmentsNotesVM { MentorAssignment = m, MentorNotes = _unitOfWork.MentorNotes.GetAll(b => b.MentorAssignmentId == m.MentorAssignmentId).ToList() }); } return(Page()); }
public Models.Application GetApplication() { if (!Context.Provider.SupportApplication) { return(null); } if (application != null) { return(application); } var myType = this.GetType(); var method = myType.GetMethod("Set", new Type[] { }).MakeGenericMethod(Context.ApplicationType); var obj = method.Invoke(this, null); var dbType = obj.GetType(); var Application = ((IEnumerable <Models.Application>)obj).FirstOrDefault(f => f.Name == Context.Provider.ApplicationName); if (Application == null) { Application = Activator.CreateInstance(Context.ApplicationType) as Models.Application; Application.Name = Context.Provider.ApplicationName; dbType.InvokeMember("Add", System.Reflection.BindingFlags.InvokeMethod, null, obj, new object[] { Application }); SaveChanges(); } application = Application; return(application); }
public async Task GetAsync_Test() { //Arrange const string id = "32"; var app = Fixture.Build <Application>().With(a => a.Id, id).Create(); var mappedApp = new Models.Application { Id = id, Name = app.Name }; Container.ReadItemAsync <Application>(Arg.Is(id), Arg.Any <PartitionKey>()) .Returns(CreateItemResponse(HttpStatusCode.OK, app)); Mapper.Map <Models.Application>(Arg.Any <Application>()).ReturnsForAnyArgs(mappedApp); //Act var result = await _sut.GetAsync(id).ConfigureAwait(false); //Assert result.Should().NotBeNull(); result.Should().BeOfType <OkObjectResult>(); var ok = result as OkObjectResult; ok.Should().NotBeNull(); var appResult = ok.Value as Models.Application; appResult.Should().NotBeNull(); Mapper.Received(1).Map <Models.Application>(Arg.Any <Application>()); await Container.Received(1) .ReadItemAsync <Application>(Arg.Is(id), Arg.Any <PartitionKey>()) .ConfigureAwait(false); }
public ActionResult MovieSearch(string searchName) { List <Tuple <string, string> > searchList = new List <Tuple <string, string> >(); var webClient = new WebClient(); if (!searchName.IsNullOrWhiteSpace()) { var json = webClient.DownloadString(@"https://swapi.dev/api/films/"); Models.Application <MoviesModel> objJson = JsonConvert.DeserializeObject <Models.Application <MoviesModel> >(json); foreach (var item in objJson.results) { string name = item.title; if (name.ToLower().Contains(searchName.ToLower())) { searchList.Add(new Tuple <string, string>(name, item.url.ToString())); } } } else { return(Redirect(Request.UrlReferrer.ToString())); } return(View(searchList)); }
public ActionResult CharacterSearch(string searchName) { int characterPages = 9; List <Tuple <string, string> > searchList = new List <Tuple <string, string> >(); var webClient = new WebClient(); if (!searchName.IsNullOrWhiteSpace()) { for (int i = 1; i <= characterPages; i++) { var json = webClient.DownloadString(@"https://swapi.dev/api/people/?page=" + i.ToString()); Models.Application <CharactersModel> objJson = JsonConvert.DeserializeObject <Models.Application <CharactersModel> >(json); foreach (var item in objJson.results) { string name = item.name; if (name.ToLower().Contains(searchName.ToLower())) { searchList.Add(new Tuple <string, string>(name, item.url.ToString())); } } } } else { return(Redirect(Request.UrlReferrer.ToString())); } return(View(searchList)); }
private async void SecurityRejectButton_Clicked(object sender, EventArgs e) { CommentsStack.IsVisible = true; if (string.IsNullOrEmpty(CommentsEditor.Text) || string.IsNullOrWhiteSpace(CommentsEditor.Text)) { await DisplayAlert("Comments Required", "Please enter a brief description of your reason for rejecting this application.", "OK"); } else { bool confirm = await DisplayAlert("Confirm", "Are you sure you want to reject this application?", "Yes", "No"); if (confirm) { Comment comment = new Comment { applicationid = applicationid, commenter = "NA", comment_by = "SECURITY", comment_time = DateTime.UtcNow, comment = CommentsEditor.Text }; //SEND COMMENTS TO API and Update app_status to REJECTED CommentController.AddComment(comment); Models.Application app = ApplicationController.GetApplication(int.Parse(applicationid)); } } }
public ActionResult Page4(ViewModels.vmPage4 vmPage4, string GUID) { string buttonValue = Request.Form["submit"]; if (ModelState.IsValid) { Models.Application application = db.Applications .Where(e => e.GUID == GUID) .FirstOrDefault(); application.HandwashFacilities = application.HandwashFacilities; db.SaveChanges(); if (buttonValue.ToLower().Contains("prev")) { return(RedirectToAction("Page3", new { GUID = GUID })); } return(RedirectToAction("Page5", new { GUID = GUID })); } if (buttonValue.ToLower().Contains("prev")) { return(RedirectToAction("Page3", new { GUID = GUID })); } return(View(vmPage4)); }
public ActionResult Page5(ViewModels.vmPage5 vmPage5, string GUID) { string buttonValue = Request.Form["submit"]; if (ModelState.IsValid) { Models.Application application = db.Applications .Where(e => e.GUID == GUID) .FirstOrDefault(); application.SubmittedDate = DateTime.Now; //The AppId becomes the next submitted AppId TempData["SendEmail"] = true; if (application.AppID == null) { application.AppID = db.Applications.Max(e => e.AppID) + 1; TempData["SendEmail"] = true; } else { TempData["SendEmail"] = false; } db.SaveChanges(); return(RedirectToAction("Confirm", new { id = application.AppID })); } return(View(vmPage5)); }
//GET: Page3 public ActionResult Page3(string GUID) { Models.Application application = new Models.Application(); if (!String.IsNullOrWhiteSpace(GUID)) { application = db.Applications .Where(e => e.GUID == GUID) .FirstOrDefault(); } //Attach TemperatureControl class ViewModels.vmPage3 vmPage3 = db.Applications .Where(e => e.GUID == GUID) .Select(e => new ViewModels.vmPage3() { TemperatureControl = new ViewModels.TemperatureControl() { HowFoodsKeptCold = e.HowFoodsKeptCold, HowFoodsKeptHot = e.HowFoodsKeptHot } }).FirstOrDefault(); return(View(vmPage3)); }
void OpenApplicationDetails(Models.Application application = null) { var applicationDetailsDialog = new ApplicationDetailsDialog(); var applicationDetailsController = new ApplicationDetailsController(applicationDetailsDialog, application); applicationDetailsDialog.Run(MessageDialog.RootWindow); }
public JsonResult CharacterListJson(string link) { //int characterPages = 9; Models.Application <CharactersModel> objJson = new Models.Application <CharactersModel>(); var webClient = new WebClient(); var json = ""; //for (int i = 1; i <= characterPages; i++) //{ if (link == null) { json = webClient.DownloadString(@"https://swapi.dev/api/people/?page="); } else { json = webClient.DownloadString(link); } objJson = JsonConvert.DeserializeObject <Models.Application <CharactersModel> >(json); //} return(Json(objJson, JsonRequestBehavior.AllowGet)); }
public PointOperationsWindow(MainWindow parentWindow, Models.Application app) { this.parentWindow = parentWindow; this.app = app; InitializeComponent(); foreach (string image in app.images.Keys) { Image1ComboBox.Items.Add(image); } foreach (string image in app.images.Keys) { Image2ComboBox.Items.Add(image); } if (app.images.Count > 1) { foreach (string key in operations.Keys) { OperationComboBox.Items.Add(key); } } else { OperationComboBox.Items.Add("NOT"); } }
public List <Models.Application> GetApplications() { con = new NpgsqlConnection(conFIG.ConnFor_PG_Admin); cmd = new NpgsqlCommand(@"select * from qadata.ref_structure where parent_idnumber = @NoParent order by name;", con); cmd.Parameters.Add("@NoParent", NpgsqlTypes.NpgsqlDbType.Uuid).Value = new Guid(); da = new NpgsqlDataAdapter(cmd); DataSet ds = new DataSet(); da.Fill(ds); List <Models.Application> LI = new List <Models.Application>(); foreach (DataRow I in ds.Tables[0].Rows) { Models.Application application = new Models.Application(); application.id = new Guid(Convert.ToString(I["row_idnumber"])); application.Name = Convert.ToString(I["name"]); application.ShortName = Convert.ToString(I["srtname"]); LI.Add(application); } return(LI); }
public ApplicationDetailsController(IApplicationsDetailsView view, Models.Application application = null) { _view = view; CurrentApplication = application; view.SetController(this); }
public ActionResult MovieList(string link) { var webClient = new WebClient(); var json = webClient.DownloadString(@"https://swapi.dev/api/films/"); Models.Application <MoviesModel> objJson = JsonConvert.DeserializeObject <Models.Application <MoviesModel> >(json); return(View(objJson)); }
public FolderTreeViewItemViewModel(string name, string path, Application app, ushort id) : base(null, true) { Messenger.Default.Send(new NotificationMessageAction <ICloudFoundryProvider>( Messages.GetCloudFoundryProvider, p => provider = p)); this.name = name; this.app = app; this.path = path; this.id = id; }
public async Task<Application> CreateApplication(string userAgent, string EndpointId, string Culture) { Application application = new Models.Application() { UserAgent = userAgent, EndpointId = EndpointId, Culture = Culture }; return await HttpService.Post<Application>(Links.applications, application); }
public FolderTreeViewItemViewModel(string name, string path, Application app, ushort id) : base(null, true) { Messenger.Default.Send(new NotificationMessageAction<ICloudFoundryProvider>( Messages.GetCloudFoundryProvider, p => provider = p)); this.name = name; this.app = app; this.path = path; this.id = id; }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { Models.Application application = (Models.Application)validationContext.ObjectInstance; if ((application.EducationExpenseTermType == ExpenseType.Per_Academic_Year) && (application.ExpenseTermSemesterSpecific != null)) { return(new ValidationResult(GetTermSemesterErrorMessage())); } return(ValidationResult.Success); }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { Models.Application application = validationContext.ObjectInstance as Models.Application; if (_hasCheckAttribute.Equals("HasPriorCollege")) { return(checkValidCheckboxAndValuesPresent(application.PriorCollege, application.HasPriorCollege)); } return(new ValidationResult(GetPriorCollegeCheckErrorMessage())); }
public Models.Application AdaptApplication(ServiceReference2.Application wcfApplication) { Models.Application app = new Models.Application(); app.Id = wcfApplication.id; app.name = wcfApplication.name; app.surname = wcfApplication.surname; app.monitorModel = wcfApplication.monitorModel; app.price = wcfApplication.price; return(app); }
public ImageWindow(MainWindow mainWindow, Models.Image img, Models.Application app) { InitializeComponent(); this.img = img; this.app = app; this.mainWindow = mainWindow; Title = img.filename; imageControl.Source = Utils.BitmapToImageSource(img.Bitmap); Height = Width * img.Height / img.Width + 45; Show(); }
public Task <Application> CreateApplication(string userAgent, string EndpointId, string Culture, CancellationToken cancellationToken) { Application application = new Models.Application() { UserAgent = userAgent, EndpointId = EndpointId, Culture = Culture }; return(HttpService.Post <Application>(Links.applications, application, cancellationToken)); }
protected void btnSubmit_Click(object sender, EventArgs e) { Models.Application a = new Models.Application(); //a.characteristics = Textchara.text; a.dorm = ddldorm.SelectedValue; a.faculty = ddlFaculty.SelectedValue; Session["Application"] = a; Response.Redirect("Display.aspx"); }
public IActionResult Update([FromBody] Models.Application model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var entity = _repository.GetById(model.Id); Mapper.Map <Models.Application, Entities.Application>(model, entity); _repository.Update(entity); return(Ok()); }
public string constructApplicationConfirmationEmailBody(Models.Application application) { var message = new StringBuilder(); message.Append("Hi " + application.StudentDetails.FirstNames + "\n\n"); message.Append("This is a confirmation email that we have recieved your application for course: " + application.Course.Name + "\n"); message.Append("The team wiil be in touch with you soon." + "\n\n"); message.Append("Kind Regards" + "\n" + "Client Support"); return(message.ToString()); }
public FileTreeViewItemViewModel(string name, string path, Application app, ushort id) : base(null, true) { Messenger.Default.Send(new NotificationMessageAction<ICloudFoundryProvider>( Messages.GetCloudFoundryProvider, p => provider = p)); this.name = name; this.app = app; this.path = path; this.id = id; fileExtension = Path.GetExtension(name).Trim(); OpenFileCommand = new RelayCommand<MouseButtonEventArgs>(OpenFile); OpenFileFromContextCommand = new RelayCommand(OpenFileFromContext); }
public FileTreeViewItemViewModel(string name, string path, Application app, ushort id) : base(null, true) { Messenger.Default.Send(new NotificationMessageAction <ICloudFoundryProvider>( Messages.GetCloudFoundryProvider, p => provider = p)); this.name = name; this.app = app; this.path = path; this.id = id; fileExtension = Path.GetExtension(name).Trim(); OpenFileCommand = new RelayCommand <MouseButtonEventArgs>(OpenFile); OpenFileFromContextCommand = new RelayCommand(OpenFileFromContext); }
private Models.Application ViewToLogic(ApplicationForm applicationForm) { var applicationLogic = new Models.Application(); if (applicationForm != null) { applicationLogic.Message = applicationForm.Message; applicationLogic.BandID = applicationForm.BandID; applicationLogic.UserID = applicationForm.UserID; return(applicationLogic); } return(null); }
private vmDisplayApplication RetrieveProperties_vmDisplayApplication(int applicationId) { Models.Application app = db.Applications.Where(e => e.AppID == applicationId) .FirstOrDefault(); if (app != null) { return(RetrieveProperties_vmDisplayApplication(app)); } else { return(null); } }
public ActionResult UpdateEventDetails(Models.EventDetails eventDetails) { if (ModelState.IsValid) { Models.Application application = db.Applications .Where(e => e.AppID == eventDetails.Id) .FirstOrDefault(); application.EventDetails = eventDetails; db.SaveChanges(); return(RedirectToAction("Edit", new { id = eventDetails.Id })); } return(View(eventDetails)); }
PostAsync(ViewModels.Applications.CreateViewModel viewModel) { try { // Check viewModel Validation! // Collection = Infrastructure.Utitily.CheckModel(viewModel) // Collection.Count -> 0 => No Error! // Loop Collection -> Result -> AddErrorMessage(item) var newEntity = new Models.Application { Name = viewModel.Name, Title = viewModel.Title, IsActive = viewModel.IsActive, Description = viewModel.Description, IsIPRestricted = viewModel.IsIPRestricted, IsUrlRestricted = viewModel.IsUrlRestricted, //IsVerified = true, //VerifierUserId = ..., //VerifyDateTime = Models.Utility.Now, }; //Logger.LogTrace(typeof(ApplicationsController), "یک شیء ایجاد میکنم"); await UnitOfWork.ApplicationRepository.InsertAsync(newEntity); //Logger.LogTrace(typeof(ApplicationsController), "شیء را به ریپوزیتوری اضافه میکنم"); await UnitOfWork.SaveAsync(); //Logger.LogTrace(typeof(ApplicationsController), "یونیت آو ورک را ذخیره میکنم"); return(Ok(value: newEntity)); } catch (System.Exception ex) { //Logger.LogError(typeof(ApplicationsController), ex.Message); // "خطای ناشناختهای صورت گرفته است لطفا با تیم پشتیبانی تماس حاصل فرمایید" return(Ok(value: null)); } }