public void Add(Academic entity) { string sql = "INSERT INTO academics " + "VALUES(@IdAcademic, @FirstName, @LastName, @Email, @Password, @Registration, @CreatedAt)"; _session.Connection.Execute(sql, entity, _session.Transaction); }
public async Task <IActionResult> Edit(long?id, [Bind("Id,Name,AcademicRecord,DateOfBirth")] Academic academic) { if (id != academic.Id) { return(NotFound()); } if (ModelState.IsValid) { try { await academicDAL.SaveAcademic(academic); } catch (DbUpdateConcurrencyException) { if (!await AcademicExists(academic.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(academic)); }
public Academic GetOne(Guid id) { string sql = $"SELECT * FROM academics WHERE IdAcademic = '{id}'"; Academic academic = _session.Connection.QueryFirstOrDefault <Academic>(sql); return(academic); }
public IActionResult AddAcademic(int id) { var appli = context_.Applicant; if (appli.Count() == 1) { foreach (var a in appli) { id = a.ApplicantId; } } else { return(Content("Applicant Not Found")); } HttpContext.Session.SetInt32(sessionId_, id); // this works too // TempData[sessionId_] = id; Applican app = context_.Applicant.Find(id); if (app == null) { return(StatusCode(StatusCodes.Status404NotFound)); } Academic act = new Academic(); return(View(act)); }
public IActionResult EditAcademic(int?id, Academic lct) { if (id == null) { return(StatusCode(StatusCodes.Status400BadRequest)); } var adp = context_.Academics.Find(id); if (adp != null) { adp.School_Of_Studying = lct.School_Of_Studying; adp.Degree = lct.Degree; adp.Major = lct.Major; adp.Graduation_Date = lct.Graduation_Date; adp.GPA = lct.GPA; adp.project_Links = lct.project_Links; adp.Description_About_Projects = lct.Description_About_Projects; try { context_.SaveChanges(); } catch (Exception) { // do nothing for now } } return(RedirectToAction("ReviewApplication")); }
private Academic SaveAcademic(Academic ae) { Academic acad; using (ProjectTrackerContainer db = new ProjectTrackerContainer()) { if (0 == ae.Id) { db.Academic.Add(ae); db.SaveChanges(); //ddlEvent.Items.Add(new ListItem(ae.Id + " " + ae.Title, ae.Id.ToString())); //ddlEvent.SelectedValue = ae.Id.ToString(); //ddlEvent.Items.Insert(1, new ListItem(ae.Id + " " + ae.Title, ae.Id.ToString())); //ddlEventHdn.Items.Insert(1, new ListItem(ae.Id + " " + ae.Title, ae.Id.ToString())); //ddlEvent.SelectedIndex = 1; } else if (ae.Id > 0) { var prevAcademic = db.Academic.FirstOrDefault(a => a.Id == ae.Id); if (prevAcademic != null) { db.Entry(prevAcademic).CurrentValues.SetValues(ae); db.SaveChanges(); } } acad = ae; } return(acad); }
//----< shows details for Applicant >---------------------- public ActionResult ApplicantDetails(int?id) { if (id == null) { return(StatusCode(StatusCodes.Status400BadRequest)); } Applican app = context_.Applicant.Find(id); if (app == null) { return(StatusCode(StatusCodes.Status404NotFound)); } var acads = context_.Academics.Where(a => a.applicant == app); app.academs = acads.OrderBy(a => a.School_Of_Studying).Select(a => a).ToList <Academic>(); if (app.academs == null) { app.academs = new List <Academic>(); Academic acd = new Academic(); acd.Degree = "none"; acd.School_Of_Studying = "none"; acd.Major = "none"; acd.Graduation_Date = "none"; app.academs.Add(acd); } return(View(app)); }
private void SaveAcademic(int academicTpyeId, int biostatBitSum) { Academic newAca = new Academic() { AcademicTypeId = academicTpyeId, BiostatBitSum = biostatBitSum, Title = "", Organization = "", Comments = txtComments.Value, Creator = Page.User.Identity.Name, CreationDate = DateTime.Now }; DateTime dt1, dt2; int intOutput; switch (academicTpyeId) { case 1: newAca.Organization = txtOrganization.Value; newAca.Title = txtTitle.Value; newAca.StartDate = DateTime.TryParse(txtStartDate.Text, out dt1) ? dt1 : (DateTime?)null; newAca.EndDate = DateTime.TryParse(txtEndDate.Text, out dt2) ? dt2 : (DateTime?)null; newAca.NumOfAttendees = Int32.TryParse(txtNumOfAttendees.Value, out intOutput) ? intOutput : (Int32?)null; newAca.CourseNum = txtCourseNum.Value; break; } using (ProjectTrackerContainer db = new ProjectTrackerContainer()) { db.Academic.Add(newAca); db.SaveChanges(); } }
public async Task <IActionResult> Edit(int id, [Bind("AcademicId,AcademicSection,Programs,AcademicInfo,AcademicAdmission")] Academic academic) { if (id != academic.AcademicId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(academic); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AcademicExists(academic.AcademicId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(academic)); }
void btn_Import_Click(object sender, RoutedEventArgs e) { //Please check before .exe version string filePath = string.Empty; string fileContent = string.Empty; OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.InitialDirectory = "c:\\"; openFileDialog.Filter = "BibTeX files (*.bib)|*.bib"; openFileDialog.FilterIndex = 2; openFileDialog.RestoreDirectory = true; if (openFileDialog.ShowDialog() == true) { filePath = openFileDialog.FileName; //Read the contents of the file into a stream var fileStream = openFileDialog.OpenFile(); using (StreamReader reader = new StreamReader(fileStream)) { fileContent = reader.ReadToEnd(); } } filePath.Replace("/", "\\"); MessageBox.Show("File Content at path: " + filePath); // If file not select if (filePath != "") { var parser = new BetterBibtexParser(new StreamReader(filePath, Encoding.Default)); var entries = parser.GetAllResult(); new Academic(); using (SQLiteConnection connection = new SQLiteConnection(App.databasePath)) { connection.CreateTable <Academic>(); foreach (var entry in entries) { //Use ToLower for protection Academic academic = new Academic() { EntryType = entry.Type, Author = entry.Author, Title = entry.Title, Year = entry.Year, Volume = entry.Volume, }; connection.Insert(academic); } } ReadDatabase(); } }
public async Task <IActionResult> Edit(int id, [Bind("StudyType,StudyName,School,ID,StartDate,EndDate,ResumeId")] Academic academic) { if (id != academic.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(academic); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AcademicExists(academic.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index", "Resumes", new { id = academic.ResumeId })); } return(View(academic)); }
public static async void SaveAcademic(int orphanID, Academic inAcademic) { try { // Replace this with the API code. using (var context = new SMSContext()) { var updatedAcademic = context.Academics.Single(c => c.AcademicID == inAcademic.AcademicID); updatedAcademic.AcademicID = inAcademic.AcademicID; updatedAcademic.OrphanID = orphanID; updatedAcademic.EntryDate = inAcademic.EntryDate; updatedAcademic.Grade = inAcademic.Grade; updatedAcademic.School = inAcademic.School; updatedAcademic.KCPE = inAcademic.KCPE; updatedAcademic.KCSE = inAcademic.KCSE; context.Academics.Update(updatedAcademic); await context.SaveChangesAsync(); } } catch (Exception eSql) { // Your code may benefit from more robust error handling or logging. // This logging is just a reminder that you should handle exceptions when connecting to remote data. System.Diagnostics.Debug.WriteLine($"Exception: {eSql.Message} {eSql.InnerException?.Message}"); } }
public IActionResult EditAcademic(int? id, Academic acad) { if (id == null) { return StatusCode(StatusCodes.Status400BadRequest); } var academics = context_.Academics.Find(id); if (academics != null) { academics.Degree = acad.Degree; academics.GPA = acad.GPA; academics.GraduationYear = acad.GraduationYear; academics.SchoolName = acad.SchoolName; try { context_.SaveChanges(); } catch (Exception) { // do nothing for now } } return RedirectToAction("Academic"); }
public Academic Login(string email, string password) { string sql = $"SELECT * FROM academics WHERE Email='{email}' AND Password='******'"; Academic academic = _session.Connection.QueryFirstOrDefault <Academic>(sql); return(academic); }
public ActionResult DeleteConfirmed(int id) { Academic academic = db.Academics.Find(id); db.Academics.Remove(academic); db.SaveChanges(); return(RedirectToAction("Index")); }
/// <summary> /// Delete a Academic verified /// </summary> /// <param name="academic"></param> public void DeleteAcademic(Academic academic) { if (academic == null) { throw new ArgumentNullException(nameof(academic)); } _context.Academics.Remove(academic); }
public async Task <Academic> RemoveAcademicById(long id) { Academic academic = await GetAcademicById(id); _context.Academics.Remove(academic); await _context.SaveChangesAsync(); return(academic); }
public Academic Edit(Academic entity) { string sql = "UPDATE academics SET FirstName = @FirstName, LastName = @LastName, " + $"Email = @Email, Password = @Password, Registration = @Registration WHERE IdAcademic = '{entity.IdAcademic}'"; _session.Connection.Execute(sql, entity, _session.Transaction); return(entity); }
/// <summary> /// Create a new Academic with parameter validate /// </summary> /// <param name="academic"></param> public void CreateAcademic(Academic academic) { if (academic == null) { throw new ArgumentNullException(nameof(academic)); } _context.Academics.Add(academic); }
public IActionResult CreateAcademic(int id, Academic acad) { if (ModelState.IsValid) { context_.Academics.Add(acad); context_.SaveChanges(); return RedirectToAction("Academic"); } return View(acad); }
public async Task <IActionResult> Create([Bind(Prefix = "Academic")] Academic obj) { if (ModelState.IsValid) { await _academicService.InsertAsync(obj); return(RedirectToRoute(new { controller = "Curriculums", action = "Details", id = obj.CurriculumId })); } return(RedirectToRoute(new { controller = "Curriculums", action = "Details", id = obj.CurriculumId })); }
public async Task <IActionResult> Create([Bind("AcademicId,AcademicSection,Programs,AcademicInfo,AcademicAdmission")] Academic academic) { if (ModelState.IsValid) { _context.Add(academic); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(academic)); }
public ActionResult Edit([Bind(Include = "id,degree,borad,total_marks,obtain_marks,passing_year,employee_id")] Academic academic) { if (ModelState.IsValid) { db.Entry(academic).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.employee_id = new SelectList(db.Employees, "id", "name", academic.employee_id); return(View(academic)); }
public ActionResult UploadImg(Academic Academic) { var file = Academic.file; if (file != null) { var filename = Path.GetFileName(file.FileName); var ext = Path.GetExtension(file.FileName); var filewithout = Path.GetFileNameWithoutExtension(file.FileName); file.SaveAs(Server.MapPath("/Assets/" + file.FileName)); } return View(); }
public async Task <IActionResult> CreateAcademic(int id, [Bind("StudyType,StudyName,School,StartDate,EndDate")] Academic academic) { if (ModelState.IsValid) { academic.ResumeId = id; _context.Add(academic); await _context.SaveChangesAsync(); return(RedirectToAction("Index", "Resumes", new { id = academic.ResumeId })); } return(View(academic)); }
public IActionResult EditAcademic(int? id) { if (id == null) { return StatusCode(Microsoft.AspNetCore.Http.StatusCodes.Status400BadRequest); } Academic acad = context_.Academics.Find(id); if (acad == null) { return StatusCode(StatusCodes.Status404NotFound); } return View(acad); }
// GET: Admin/Academics/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Academic academic = db.Academics.Find(id); if (academic == null) { return(HttpNotFound()); } return(View(academic)); }
public async Task <Academic> SaveAcademic(Academic academic) { if (academic.Id == null) { _context.Academics.Add(academic); } else { _context.Academics.Update(academic); } await _context.SaveChangesAsync(); return(academic); }
// GET: Admin/Academics/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Academic academic = db.Academics.Find(id); if (academic == null) { return(HttpNotFound()); } ViewBag.employee_id = new SelectList(db.Employees, "id", "name", academic.employee_id); return(View(academic)); }
public async Task <IActionResult> Edit(int id, Academic obj) { if (id != obj.Id) { return(NotFound()); } if (ModelState.IsValid) { await _academicService.UpdateAsync(obj); return(RedirectToRoute(new { controller = "Curriculums", action = "Details", id = TempData["id"] })); } return(View(obj)); }