public async Task <IActionResult> Edit(int id, [Bind("SchName,SchAmount,SchDetails,SchId")] Scholarship scholarship) { if (id != scholarship.SchId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(scholarship); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ScholarshipExists(scholarship.SchId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(scholarship)); }
public ActionResult _CreateScholarship(Scholarship scholarship) { scholarship.ValidationPeriod = db.WebSettings.FirstOrDefault().ValidationPeriod; db.Scholarships.Add(scholarship); db.SaveChanges(); return(RedirectToAction("Scholarships", "Admin")); }
public ActionResult _ReviewList(HttpPostedFileBase file) { List <PreValidatedStudent> scholars = new List <PreValidatedStudent>(); var excel = new ExcelPackage(file.InputStream); ExcelWorksheet worksheet = excel.Workbook.Worksheets[1]; //validation for (int i = 12; i <= worksheet.Dimension.End.Row; i++) { //validation //scholarhsip type, student id //loop all columns in a row string studentID = worksheet.Cells[i, 4].Value.ToString(); int scholarshipID = Convert.ToInt32(worksheet.Cells[i, 5].Value); Scholarship type = db.Scholarships.Where(e => e.ScholarshipID.Equals(scholarshipID)).FirstOrDefault(); ValidationPeriod period = db.WebSettings.FirstOrDefault().ValidationPeriod; AspNetUser user = db.AspNetUsers.Where(e => e.UserProfiles.FirstOrDefault().StudentProfile.StudentID.Equals(studentID)).FirstOrDefault(); PreValidatedStudent tempScholar = new PreValidatedStudent(); tempScholar.ScholarshipID = type.ScholarshipID; tempScholar.PeriodID = period.PeriodID; tempScholar.UserID = user.Id; tempScholar.Scholarship = type; tempScholar.ValidationPeriod = period; tempScholar.AspNetUser = user; scholars.Add(tempScholar); } TempData["Scholars"] = scholars; return(PartialView("_ReviewList", scholars)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Amount,StudentId")] Scholarship scholarship) { if (id != scholarship.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(scholarship); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ScholarshipExists(scholarship.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["StudentId"] = new SelectList(_context.StudentViewModel, "id", "FullName", scholarship.StudentId); return(View(scholarship)); }
public bool IsExcelFileValid(ExcelPackage excel) { if (excel.Workbook.Worksheets.ToList().Count != 1) { return(false); } ExcelWorksheet worksheet = excel.Workbook.Worksheets[1]; for (int i = worksheet.Dimension.Start.Row + 11; i <= worksheet.Dimension.End.Row; i++) { string studentID = worksheet.Cells[i, 4].Value.ToString(); AspNetUser user = db.AspNetUsers.Where(e => e.UserProfiles.First().StudentProfile.StudentID.Equals(studentID)).FirstOrDefault(); if (user == null) { return(false); } string excelScholarshipType = worksheet.Cells[i, 5].Value.ToString(); Scholarship type = db.Scholarships.Where(e => e.ScholarshipID.Equals(excelScholarshipType)).FirstOrDefault(); if (type == null) { return(false); } } return(true); }
public ActionResult EditScholarship(Scholarship type) { Scholarship scholarship = db.Scholarships.Where(e => e.ScholarshipID.Equals(type.ScholarshipID)).FirstOrDefault(); db.SaveChanges(); return(View(scholarship)); }
public async Task <IActionResult> PutScholarship([FromRoute] int id, [FromBody] Scholarship Scholarship) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != Scholarship.Id) { return(BadRequest()); } dbContext.Entry(Scholarship).State = EntityState.Modified; try { await dbContext.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ScholarshipExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Applications(int id) // id = ScholarshipId { Scholarship scholarship = await _context.Scholarship.FirstOrDefaultAsync(s => s.ScholarshipId == id); if (scholarship == null) { return(NotFound()); } List <Application> applications = await _context.Application.Include(ap => ap.Profile) .Where(s => s.ScholarshipId == id && s.Submitted) .OrderByDescending(s => s.ApplicantAwarded).ThenByDescending(s => s.ApplicantScore).ThenBy(s => s.Profile.LastName).ThenBy(s => s.Profile.FirstName) .ToListAsync(); ApplicationViewModel vm = new ApplicationViewModel { Scholarship = scholarship, Applications = applications }; if (!await CanAccessScholarship(vm.Scholarship.ScholarshipId)) { return(NotFound()); } return(View(vm)); }
public ActionResult UploadScholarshipDetails(Scholarship scholarship, string newDescription) { try { scholarship.ScholarshipDescription = scholarship.ScholarshipDescription + " " + newDescription; ModelState.Remove("newDescription"); if (ModelState.IsValid) { if (User.IsInRole("Administrator")) { websiteActions.UpdateScholarship(scholarship); return(RedirectToAction("ScholarshipSelection", "WebsiteContent")); } else { TempData["errorMessage"] = "Sorry you do not have access."; return(RedirectToAction("ScholarshipSelection", "WebsiteContent")); } } else { return(View(scholarship)); } } catch (Exception e) { TempData["errorMessage"] = "There was an error in updating the scholarship you wish to edit." + e.ToString(); return(RedirectToAction("ScholarshipSelection")); } }
private void delScholarshipBtn_Click(object sender, EventArgs e) { List <string> checkedScholarships = new List <string>(); int checkBoxColumn = scholarshipGridView.Columns.Count - 1; //List marked scholarships foreach (DataGridViewRow rw in this.scholarshipGridView.Rows) { if (rw.Cells[checkBoxColumn].Value != null && Convert.ToBoolean(rw.Cells[checkBoxColumn].Value) == true) { checkedScholarships.Add(rw.Cells[0].Value.ToString()); } } using (Entities context = new Entities()) { //Delete each marked scholarship foreach (string i in checkedScholarships) { Scholarship scholarship = context.Scholarships.FirstOrDefault(s => s.Scholership_Name == i); context.Scholarships.Remove(scholarship); } //Save changes and reload grid context.SaveChanges(); reloadDataGridView(context); } scholarshipGridView.Refresh(); }
public ActionResult DeleteScholarship(int id) { Scholarship scholarship = db.Scholarships.Where(e => e.ScholarshipID.Equals(id)).FirstOrDefault(); db.Scholarships.Remove(scholarship); db.SaveChanges(); return(RedirectToAction("Scholarships")); }
private void Select_Click(object sender, EventArgs e) { using (MazalEntities context = new MazalEntities()) { Scholarship scholarship = context.Scholarships.FirstOrDefault(s => s.Scholership_Name == "Hachvana"); MessageBox.Show(scholarship.Grant_Amount_shekel_.ToString()); } }
private void Update_Click(object sender, EventArgs e) { using (MazalEntities context = new MazalEntities()) { Scholarship scholarship = context.Scholarships.FirstOrDefault(s => s.Scholership_Name == "Perach"); scholarship.Volunteer_hours++; context.SaveChanges(); } }
private void Remove_Click(object sender, EventArgs e) { using (MazalEntities context = new MazalEntities()) { Scholarship scholarship = context.Scholarships.FirstOrDefault(s => s.Scholership_Name == "Nachshon"); context.Scholarships.Remove(scholarship); context.SaveChanges(); } }
public void TestarIdsNewGuild() { // Arrange var instance = new Scholarship(); instance.Id = default(Guid); // Assert Assert.AreEqual(Guid.Empty, instance.Id); }
/// <summary> /// To update Scholarship details /// </summary> /// <param name="id">scholarshipId</param> /// <param name="scholarshipObj">scholarship Object</param> public void Put(string id, Scholarship scholarshipObj) { try { scholarshipObj.JobSeekerId = SkillsmartUser.GuidStr(HttpContext.Current.User); scholarshipObj.Id = new Guid(id); scholarshipObj.Id = new Guid(id); ServiceFactory.GetJobSeekerScholarship().Update(scholarshipObj); } catch (Exception exp) {} }
public async Task <IActionResult> Create([Bind("SchName,SchAmount,SchDetails,SchId")] Scholarship scholarship) { if (ModelState.IsValid) { _context.Add(scholarship); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(scholarship)); }
public static bool IsAVoucher(Scholarship scholarship) { if (scholarship.ScholarshipType.ScholarshipTypeName.ToLower() == "voucher") { return(true); } else { return(false); } }
public async Task PersistScholarshipReddeUssdData(string requestString) { using (var scope = serviceFactory.CreateScope()) { dbContext = scope.ServiceProvider.GetRequiredService <NtoboaFundDbContext>(); //types : lkm,bus,sch var regex = new Regex(@"^(?<type>\w+)\*(?<amount>\d+)-(?<period>\w+)-(?<institution>[\w\s]+)-(?<program>[\w\s]+)-(?<studentid>[\w\s]+)-(?<playertype>\d+)-(?<momonumber>\d+)-(?<voucher>[\w\s]+)-(?<usernumber>\d+)$").Match(requestString); var type = regex.Groups["type"].ToString(); var amount = regex.Groups["amount"].ToString(); var period = regex.Groups["period"].ToString(); var institution = regex.Groups["institution"].ToString(); var program = regex.Groups["program"].ToString(); var studentId = regex.Groups["studentid"].ToString(); var playerType = regex.Groups["playertype"].ToString(); var voucher = regex.Groups["voucher"].ToString(); var mobileNumber = "0" + Misc.NormalizePhoneNumber(regex.Groups["usernumber"].ToString()); var momoNumber = "0" + Misc.NormalizePhoneNumber(regex.Groups["momonumber"].ToString()); var user = await getMatchedUser(dbContext, mobileNumber); var txRef = Misc.getTxRef(mobileNumber); var scholarship = new Scholarship { Amount = Convert.ToDecimal(amount), Date = DateTime.Now.ToLongDateString(), AmountToWin = Convert.ToDecimal(amount) * Constants.ScholarshipStakeOdds, Status = "pending", TxRef = txRef, Period = period, User = user, Institution = institution, Program = program, StudentId = studentId, PlayerType = Misc.getPlayerType(playerType) }; try { var transactionId = await Misc.GenerateAndSendReddeMomoInvoice(EntityTypes.Scholarship, scholarship, Settings.ReddeSettings, $"{Misc.FormatGhanaianPhoneNumberWp(momoNumber)}*{voucher}"); scholarship.TransferId = transactionId; dbContext.Scholarships.Add(scholarship); await dbContext.SaveChangesAsync(); } catch (Exception ex) { } } }
public async Task <IActionResult> Create([Bind("Id,Amount,StudentId")] Scholarship scholarship) { if (ModelState.IsValid) { _context.Add(scholarship); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["StudentId"] = new SelectList(_context.StudentViewModel, "id", "FullName", scholarship.StudentId); return(View(scholarship)); }
////edit post protected void SaveEdit_Click(object sender, EventArgs e) { if ((txtEditTitle.Text == "") || (txtEditREward.Value == "")) { StringBuilder builder = new StringBuilder(); builder.Append("<script language=JavaScript> ShowEdit(); </script>\n"); Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowEdit", builder.ToString()); lblEditError.Text = "Please enter all required values."; } else { Post post = new Post(1, "Scholarship", HttpUtility.HtmlEncode(txtEditTitle.Text), HttpUtility.HtmlEncode(txtEditDescription.Text)); localDB.Open(); System.Data.SqlClient.SqlCommand editPost = new System.Data.SqlClient.SqlCommand(); editPost.Connection = localDB; editPost.CommandText = "Execute EditPost @id, @title, @PostDate, @description, @lastUpdatedBy, @LastUpdated"; editPost.Parameters.Add("@id", SqlDbType.Int).Value = id.Text; editPost.Parameters.Add("@title", SqlDbType.VarChar, 100).Value = post.getTitle(); editPost.Parameters.Add("@PostDate", SqlDbType.VarChar, 30).Value = post.getPostDate(); editPost.Parameters.Add("@description", SqlDbType.VarChar, 500).Value = post.getDescription(); editPost.Parameters.Add("@lastUpdatedBy", SqlDbType.VarChar, 30).Value = post.getLastUpdatedBy(); editPost.Parameters.Add("@LastUpdated", SqlDbType.VarChar, 30).Value = post.getLastUpdated(); editPost.ExecuteNonQuery(); try { DateTime start = DateTime.Parse(txtEditDueDate.Value); txtEditDueDate.Value = start.ToString("MM/dd/yyyy"); } catch { } Scholarship sch = new Scholarship(id.Text, HttpUtility.HtmlEncode(txtEditRequirements.Text), HttpUtility.HtmlEncode(txtEditREward.Value), HttpUtility.HtmlEncode(txtEditDueDate.Value)); System.Data.SqlClient.SqlCommand editjob = new System.Data.SqlClient.SqlCommand(); editjob.Connection = localDB; editjob.CommandText = "Execute EditScholarship @id, @requirements, @reward, @duedate, @lastUpdatedBy, @lastUpdated"; editjob.Parameters.Add("@id", SqlDbType.Int).Value = sch.getpostID(); editjob.Parameters.Add("@requirements", SqlDbType.VarChar, 100).Value = sch.getReqs(); editjob.Parameters.Add("@reward", SqlDbType.VarChar, 30).Value = sch.getReward(); editjob.Parameters.Add("@duedate", SqlDbType.VarChar, 30).Value = sch.getDueDate(); editjob.Parameters.Add("@lastUpdatedBy", SqlDbType.VarChar, 30).Value = sch.getLastUpdatedBy(); editjob.Parameters.Add("@lastUpdated", SqlDbType.VarChar, 30).Value = sch.getLastUpdated(); editjob.ExecuteNonQuery(); localDB.Close(); showData(); } }
public void TestarOwnerNaoNull() { // Arrange var instance = new Scholarship(); instance.Owner = "NonEmptyString"; // Act instance.ToString(); // Assert Assert.AreNotEqual(instance.Owner, ""); }
private void gvScholarship_SelectionChanged(object sender, EventArgs e) { int selectedIndex = gvScholarship.CurrentRow.Index; if (selectedIndex >= 0) { string sID = gvScholarship.Rows[selectedIndex].Cells["ScholarshipCode"].Value.ToString(); List <Scholarship> item = new List <Scholarship>(); item = scholarshipList.FindAll(x => x.ScholarshipCode.ToString() == sID); scholarshipSelected = new Scholarship(); scholarshipSelected = (Scholarship)item[0]; } }
private void Save() { ScholarshipServiceClient scholarshipService = new ScholarshipServiceClient(); Boolean ret = false; string message = String.Empty; Scholarship scholarship = new Scholarship() { ScholarshipCode = txtScholarshipCode.Text.ToString(), Privilege = txtPrivilege.Text.ToString(), Condition = txtCondition.Text.ToString(), Description = txtDescription.Text.ToString() //StopRightHere }; }
private void Save() { ScholarshipServiceClient scholarshipService = new ScholarshipServiceClient(); Boolean ret = false; string message = String.Empty; Scholarship scholarship = new Scholarship() { ScholarshipCode = txtScholarshipCode.Text.ToString(), Privilege = txtPrivilege.Text.ToString(), Condition = txtCondition.Text.ToString(), Description = txtDescription.Text.ToString() //StopRightHere }; }
public ActionResult EditScholarship(Scholarship model) { Scholarship scholarship = db.Scholarships.Where(e => e.ScholarshipID.Equals(model.ScholarshipID)).FirstOrDefault(); scholarship.ScholarshipName = model.ScholarshipName; scholarship.ScholarshipDescription = model.ScholarshipDescription; scholarship.ApplicationForm = model.ApplicationForm; scholarship.ScholarshipTypeID = model.ScholarshipTypeID; db.SaveChanges(); TempData["Message"] = "Changes saved successfully"; TempData["MessageType"] = "success"; return(RedirectToAction("Scholarships", "Admin")); }
private void gvScholarship_SelectionChanged(object sender, EventArgs e) { int selectedIndex = gvScholarship.CurrentRow.Index; if (selectedIndex >= 0) { string sID = gvScholarship.Rows[selectedIndex].Cells["ScholarshipCode"].Value.ToString(); List<Scholarship> item = new List<Scholarship>(); item = scholarshipList.FindAll(x => x.ScholarshipCode.ToString() == sID); scholarshipSelected = new Scholarship(); scholarshipSelected = (Scholarship)item[0]; } }
public async Task <List <ScholarshipFieldStatus> > VerifyApplicationStatus(Scholarship scholarship) { List <ScholarshipFieldStatus> status = new List <ScholarshipFieldStatus>(); ICollection <ValidationResult> results = new List <ValidationResult>(); Profile profile = await GetProfileAsync(); ValidationContext vc = new ValidationContext(profile); bool isValid = Validator.TryValidateObject(profile, vc, results, true); foreach (var result in results) { List <string> MemberNames = result.MemberNames.ToList(); if (MemberNames.Count > 0) { string field = MemberNames[0]; ScholarshipProfileProperty prop = scholarship.ProfileProperties.FirstOrDefault(p => p.ProfileProperty.PropertyKey == field); if (prop != null) { status.Add(new ScholarshipFieldStatus { FieldName = prop.ProfileProperty.PropertyName, ErrorMessage = result.ErrorMessage.Replace(prop.ProfileProperty.PropertyKey, prop.ProfileProperty.PropertyName), Validated = false, FormURI = ProfileFieldToURI(MemberNames[0]) }); } } } var guardprop = scholarship.ProfileProperties.FirstOrDefault(gprop => gprop.ProfileProperty.PropertyKey == "Guardians"); if (guardprop != null) { if (profile.Guardians.Count == 0) { status.Add(new ScholarshipFieldStatus { FieldName = guardprop.ProfileProperty.PropertyName, ErrorMessage = "You must have at least one family member listed in the Family Income section of your profile", Validated = false, FormURI = ProfileFieldToURI("Guardians") }); } } return(status); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Scholarship = await _context.Scholarships.FirstOrDefaultAsync(m => m.ScholarshipID == id); if (Scholarship == null) { return(NotFound()); } return(Page()); }
public List <Scholarship> getScholarshipManual(string sql) { List <Scholarship> scholarshipData = new List <Scholarship>(); ConnectDB db = new ConnectDB(); SqlDataSource oracleObj = db.ConnectionOracle(); //oracleObj.SelectCommand = "Select * From SCHOLARSHIP Order By ACADEMIC_YEAR"; oracleObj.SelectCommand = sql; DataView allData = (DataView)oracleObj.Select(DataSourceSelectArguments.Empty); foreach (DataRowView rowData in allData) { Scholarship scholarship_data = new Scholarship(); scholarship_data.SCHOLARSHIP_ACADEMIC_YEAR = rowData["ACADEMIC_YEAR"].ToString(); scholarship_data.SCHOLARSHIP_SEMESTER = rowData["SEMESTER"].ToString(); scholarship_data.SCHOLARSHIP_SCHOLARSHIP_CODE = rowData["SCHOLARSHIP_CODE"].ToString(); scholarship_data.SCHOLARSHIP_SCHOLARSHIP_THAINAME = rowData["SCHOLARSHIP_THAINAME"].ToString(); scholarship_data.SCHOLARSHIP_SCHOLARSHIP_ENGNAME = rowData["SCHOLARSHIP_ENGNAME"].ToString(); scholarship_data.SCHOLARSHIP_SCHOLARSHIP_IN_OUT = rowData["SCHOLARSHIP_IN_OUT"].ToString(); scholarship_data.SCHOLARSHIP_SCHOLARSHIP_TYPE = rowData["SCHOLARSHIP_TYPE"].ToString(); scholarship_data.SCHOLARSHIP_SCHOLARSHIP_SOURCE = rowData["SCHOLARSHIP_SOURCE"].ToString(); scholarship_data.SCHOLARSHIP_NEW_REGIS_FEE = rowData["NEW_REGIS_FEE"].ToString(); scholarship_data.SCHOLARSHIP_PROPERTIES_FEE = rowData["PROPERTIES_FEE"].ToString(); scholarship_data.SCHOLARSHIP_STUDY_FACILITY_FEE = rowData["STUDY_FACILITY_FEE"].ToString(); scholarship_data.SCHOLARSHIP_IT_FEE = rowData["IT_FEE"].ToString(); scholarship_data.SCHOLARSHIP_LIBRARY_FEE = rowData["LIBRARY_FEE"].ToString(); scholarship_data.SCHOLARSHIP_HEALTH_FEE = rowData["HEALTH_FEE"].ToString(); scholarship_data.SCHOLARSHIP_ACTIVITY_FEE = rowData["ACTIVITY_FEE"].ToString(); scholarship_data.SCHOLARSHIP_CREDIT_3000 = rowData["CREDIT_3000"].ToString(); scholarship_data.SCHOLARSHIP_ACCIDENT_FEE = rowData["ACCIDENT_FEE"].ToString(); scholarship_data.SCHOLARSHIP_ACADEMIC_FEE_BACHELOR = rowData["ACADEMIC_FEE_BACHELOR"].ToString(); scholarship_data.SCHOLARSHIP_SPECIAL_PROJECT_FEE = rowData["SPECIAL_PROJECT_FEE"].ToString(); scholarship_data.SCHOLARSHIP_SCHOLAR_FEE_COMMENT = rowData["SCHOLAR_FEE_COMMENT"].ToString(); scholarship_data.SCHOLARSHIP_MULTIPLE_SCHOLARSHIP = rowData["MULTIPLE_SCHOLARSHIP"].ToString(); scholarship_data.SCHOLARSHIP_ACADEMIC_FEE_MASTER = rowData["ACADEMIC_FEE_MASTER"].ToString(); scholarship_data.SCHOLARSHIP_FINE_FEE = rowData["FINE_FEE"].ToString(); scholarship_data.SCHOLARSHIP_THEORY_PRACTICE_FEE = rowData["THEORY_PRACTICE_FEE"].ToString(); scholarship_data.SCHOLARSHIP_THESIS_FEE = rowData["THESIS_FEE"].ToString(); scholarship_data.SCHOLARSHIP_SCHOLARSHIP_STATUS = rowData["SCHOLARSHIP_STATUS"].ToString(); scholarshipData.Add(scholarship_data); } return(scholarshipData); }
public async Task<IActionResult> OnPostAsync(int? id) { if (id == null) { return NotFound(); } Scholarship = await _context.Scholarships.FindAsync(id); if (Scholarship != null) { _context.Scholarships.Remove(Scholarship); await _context.SaveChangesAsync(); } return RedirectToPage("./Index"); }
private void Insert_Click(object sender, EventArgs e) { using (MazalEntities context = new MazalEntities()) { Scholarship nachshon = new Scholarship { Scholership_ID = "4", Grant_Amount_shekel_ = 10000, Scholership_Name = "Nachshon", Intended_for = "Any", Duration_years_ = 1, Volunteer_hours = 150 }; context.Scholarships.Add(nachshon); context.SaveChanges(); } }