public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Rollno,SClass,Year,Studentid")] StudentAccount StudentAccount) { if (id != StudentAccount.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(StudentAccount); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentAccountExists(StudentAccount.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(StudentAccount)); }
public async Task <ActionResult <StudentAccount> > PostStudentAccount([FromForm] StudentAccount studentAccount) { _context.studentAccounts.Add(studentAccount); await _context.SaveChangesAsync(); return(CreatedAtAction("GetStudentAccount", new { id = studentAccount.StudentAccountID }, studentAccount)); }
public ActionResult Create(StudentAccount model) { model.ID = Guid.NewGuid(); students.Add(model); students.Save(); return(RedirectToAction("Index")); }
static private void LoginAdmin(Window window, StudentAccount student) { StudentPage w = new StudentPage(student); w.Show(); window.Close(); }
public async Task <IActionResult> PutStudentAccount(int id, [FromForm] StudentAccount studentAccount) { if (id != studentAccount.StudentAccountID) { return(BadRequest()); } _context.Entry(studentAccount).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentAccountExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
static async Task Main(string[] args) { IAccount account = new StudentAccount() { Status = Status.Student, Subjects = new List <ISubject>() { new Subject { Key = "SortedSet", Name = "Teacher" } }, Key = "tt", Password = "******", ToDos = new List <IToDo>() { }, User = new User() { Age = 10 }, UserName = "******" }; LoginUserHelperManager.LoginUser(account); var user = LoginUserHelperManager.GetCurrentUser(); var Type = user.GetType(); Console.WriteLine("heelo"); }
public void SaveDimension(string user, string dimension, string value, string misc) { StudentAccountClient sac = new StudentAccountClient(); StudentAccount student = sac.GetByPartitionAndRowKey(StudentAccountClient.GetPartitionKeyForEmail(user), user); if (student != null) { AssessmentDimensionClient adc = new AssessmentDimensionClient(); AssessmentDimension dimensionRating = adc.GetByPartitionAndRowKey(student.School, user + student.Year + student.Grade + dimension); if (dimensionRating == null) { student.RatedDimensions++; sac.Update(student); adc.AddNewItem(new AssessmentDimension { PartitionKey = student.School, RowKey = user + student.Year + student.Grade + dimension, Value = value, Misc = misc, Counselor = student.Counselor, Student = user, Grade = student.Grade, GroupName = student.GroupName, Dimension = dimension, Year = student.Year }); //adrc.AddNewItem(new AssessmentDimensionsRating { PartitionKey = student.School, RowKey = user + dimension, Dimension = dimension, Value = value, Misc = misc, GradYear = student.GradYear, Student = student.RowKey, Teacher = student.Teacher, Group = student.Group }); } else { dimensionRating.Value = value; dimensionRating.Misc = misc; adc.Update(dimensionRating); } } //StudentProfileClient spc = new StudentProfileClient(); //StudentProfile student = spc.GetByPartitionAndRowKey(StudentProfileClient.GetPartitionKeyForEmail(user), user); //AssessmentDimensionsRatingClient adrc = new AssessmentDimensionsRatingClient(); //AssessmentDimensionsRating dimensionRating = adrc.GetByPartitionAndRowKey(student.School, user + dimension); }
public HttpResponse StudentStatus(string user) { string response; if (AuthTokens[0] != "demo") { StudentAccountClient sac = new StudentAccountClient(); StudentAccount account = sac.GetByPartitionAndRowKey(StudentAccountClient.GetPartitionKeyForEmail(user), user); if (account != null) { account.Active = !account.Active; sac.Update(account); response = "{\"result\": \"done\"}"; } else { response = "{\"result\": \"error\"}"; } } else { response = "{\"result\": \"done\"}"; } Response.ContentType = "application/json"; Response.Write(response); Response.End(); return(null); }
public void SaveInterest(string user, string interest, string rating) { StudentAccountClient sac = new StudentAccountClient(); StudentAccount student = sac.GetByPartitionAndRowKey(StudentAccountClient.GetPartitionKeyForEmail(user), user); if (student != null) { AssessmentInterestClient aic = new AssessmentInterestClient(); AssessmentInterest interestRating = aic.GetByPartitionAndRowKey(student.School, user + student.Year + student.Grade + interest); if (interestRating == null) { aic.AddNewItem(new AssessmentInterest { PartitionKey = student.School, RowKey = user + student.Year + student.Grade + interest, Value = rating, Counselor = student.Counselor, Student = user, Grade = student.Grade, GroupName = student.GroupName, Interest = interest, Year = student.Year }); //airc.AddNewItem(new AssessmentInterestRating { PartitionKey = student.School, RowKey = user + interest, Rating = rating, GradYear = student.GradYear, Student = user, Teacher = student.Teacher, Group = student.Group }); } else { interestRating.Value = rating; aic.Update(interestRating); } } //StudentProfileClient spc = new StudentProfileClient(); //StudentProfile student = spc.GetByPartitionAndRowKey(StudentProfileClient.GetPartitionKeyForEmail(user), user); //AssessmentInterestRatingClient airc = new AssessmentInterestRatingClient(); //AssessmentInterestRating interestRating = airc.GetByPartitionAndRowKey(student.School, user + interest); }
public HttpResponse GetCareerRatings(string user) { JavaScriptSerializer jss = new JavaScriptSerializer(); StudentAccountClient sac = new StudentAccountClient(); StudentAccount student = sac.GetByPartitionAndRowKey(StudentAccountClient.GetPartitionKeyForEmail(user), user); AssessmentCareerClient acc = new AssessmentCareerClient(); List <AssessmentCareer> careerRatings = new List <AssessmentCareer>(acc.GetAllCurrentByStudent(student.School, user, student.Year, student.Grade)); //StudentProfileClient spc = new StudentProfileClient(); //StudentProfile student = spc.GetByPartitionAndRowKey(StudentProfileClient.GetPartitionKeyForEmail(user), user); //AssessmentCareerRatingClient acrc = new AssessmentCareerRatingClient(); //List<AssessmentCareerRating> careerRatings = new List<AssessmentCareerRating>(acrc.GetAllBySchoolAndStudent(student.School, user)); List <CareerRating> results = new List <CareerRating>(); string response; if (careerRatings.Count != 0) { foreach (AssessmentCareer careerRating in careerRatings) { results.Add(new CareerRating { dolcode = careerRating.DolCode, rating = careerRating.Value }); } response = "{\"result\": \"ok\", \"results\":" + jss.Serialize(results) + "}"; } else { response = "{\"result\": \"ok\", \"results\":[]}"; } Response.ContentType = "application/json"; Response.Write(response); Response.End(); return(null); }
public ActionResult Report(string id) { if (id != null && id != "") { StudentAccountClient sac = new StudentAccountClient(); StudentAccount student = sac.GetByPartitionAndRowKey(StudentAccountClient.GetPartitionKeyForEmail(id), id); //StudentProfileClient spc = new StudentProfileClient(); //StudentProfile student = spc.GetByPartitionAndRowKey(StudentProfileClient.GetPartitionKeyForEmail(id), id); if (student != null && AuthTokens[3] == "administrator" && student.Counselor == AuthTokens[1]) { UserAccountClient uac = new UserAccountClient(); UserAccount account = uac.GetByPartitionAndRowKey(UserAccountClient.GetPartitionKeyForEmail(id), id); // ViewBag.StudentName = account.FirstName + " " + account.LastName; ViewBag.StudentFirstName = account.FirstName; ViewBag.StudentLastName = account.LastName; ViewBag.StudentToShow = id; } } else if (AuthTokens[3] == "administrator") { return(RedirectToAction("Assessment", "Index")); } return(View()); }
public StudentAccount studentLogin(string username, string password) { StudentAccount theAccount = null; using (SqlConnection conn = DBUltiity.getConnection) { string query = "SELECT * FROM StudentAccount WHERE username=@username AND password=@password"; SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.Text; cmd.CommandText = query; cmd.Parameters.AddWithValue("@username", username); cmd.Parameters.AddWithValue("@password", password); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { // query successfully string studentID = reader.GetString(2); // string phone = reader.GetString(3); Console.WriteLine(reader.GetString(2)); theAccount = new StudentAccount(username, password, studentID); } reader.Close(); // return student return(theAccount); } } // end studentLogin
/// <summary> /// Retrieve an "Account" entity for a specified email and password combination. /// </summary> /// <param name="email">The email address associated with the account.</param> /// <param name="password">The hashed password associated with the account.</param> /// <returns>The "Account" entity that was requested.</returns> public Account GetAccount(string email, string password) { this.dbConnection.Open(); Account account = new Account(); string query = @"SELECT email, password, type FROM Account WHERE email = @email AND password = @password"; SQLiteCommand command = new SQLiteCommand(query, this.dbConnection); command.Parameters.AddWithValue("@email", email); command.Parameters.AddWithValue("@password", password); SQLiteDataReader reader = command.ExecuteReader(); if (reader.HasRows) { reader.Read(); string type = reader.GetString(2); if (type == "Administrator") { account = new AdministratorAccount(reader); } else if (type == "Student") { StudentAccount studentAccount = new StudentAccount(reader); studentAccount.Classes = this.GetClasses(studentAccount); account = studentAccount; } else { account = new Account(reader); } } reader.Close(); this.dbConnection.Close(); return(account); }
public ActionResult DeleteConfirmed(string id) { StudentAccount studentAccount = db.StudentAccounts.Find(id); db.StudentAccounts.Remove(studentAccount); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult ConfirmEmail(string id) { if (id != null) { SimpleAES aes = new SimpleAES(); string email = aes.DecryptString(id); UserAccountClient uac = new UserAccountClient(); UserAccount account = uac.GetByPartitionAndRowKey(UserAccountClient.GetPartitionKeyForEmail(email), email); if (account != null) { account.EmailConfirmed = true; uac.Update(account); if (account.ProfileType == "student") { StudentAccountClient sac = new StudentAccountClient(); StudentAccount student = sac.GetByPartitionAndRowKey(StudentAccountClient.GetPartitionKeyForEmail(account.Email), account.Email); //StudentProfileClient spc = new StudentProfileClient(); //StudentProfile student = spc.GetByPartitionAndRowKey(UserAccountClient.GetPartitionKeyForEmail(account.Email), account.Email); string sessionkey = ClientSession.GetClientSessionKey("user", account.Email, account.FirstName + " " + account.LastName, "student"); Response.Cookies["sessionkey"].Value = sessionkey; Response.Cookies["sessionkey"].Expires = DateTime.UtcNow.AddDays(7); Response.Cookies["sessionusername"].Value = account.Email; Response.Cookies["sessionusername"].Expires = DateTime.UtcNow.AddDays(7); Response.Cookies["firstname"].Value = account.FirstName; Response.Cookies["firstname"].Expires = DateTime.UtcNow.AddDays(7); Response.Cookies["lastname"].Value = account.LastName; Response.Cookies["lastname"].Expires = DateTime.UtcNow.AddDays(7); Response.Cookies["email"].Value = account.Email; Response.Cookies["email"].Expires = DateTime.UtcNow.AddDays(7); Response.Cookies["gender"].Value = student.Gender; Response.Cookies["gender"].Expires = DateTime.UtcNow.AddDays(7); Response.Cookies["cbnvm"].Value = "1"; Response.Cookies["cbnvm"].Expires = DateTime.UtcNow.AddDays(7); SendCongratulationsEmailToStudent(account.Email, account.FirstName); return(RedirectToAction("Index", "StudentPortal")); } else if (account.ProfileType == "administrator") { string sessionkey = ClientSession.GetClientSessionKey("user", account.Email, account.FirstName + " " + account.LastName, "administrator"); Response.Cookies["sessionkey"].Value = sessionkey; Response.Cookies["sessionkey"].Expires = DateTime.UtcNow.AddDays(7); Response.Cookies["sessionusername"].Value = account.Email; Response.Cookies["sessionusername"].Expires = DateTime.UtcNow.AddDays(7); Response.Cookies["cbnvm"].Value = "1"; Response.Cookies["cbnvm"].Expires = DateTime.UtcNow.AddDays(7); SendCongratulationsEmailToAdmin(account.Email, account.FirstName + " " + account.LastName); return(RedirectToAction("AddSchool", "AdminPortal")); } return(View()); } else { ViewBag.ErrorMessage = "No account found"; } } return(RedirectToAction("LogIn")); }
/// <summary> /// Save a "Student" entity to the database. /// </summary> /// <param name="student">A "Student" entity to be saved to the database.</param> public void SaveAccount(StudentAccount student) { this.SaveAccount((Account)student); foreach (Class classRecord in student.Classes) { this.SaveAccountClass(student, classRecord); } }
public ActionResult Update(StudentAccount model) { if (ModelState.IsValid) { students.Update(model); return(RedirectToAction("Index")); } return(View()); }
public ActionResult Student(StudentAccount account) { if (ModelState.IsValid) { db.Add(account); db.Save(); return(RedirectToAction("Index", "MudurStudent", new { Areas = "Mudur" })); } return(View()); }
private void PopulateComboBox1(StudentAccount student) { foreach (Class classRecord in this.classes) { if (!student.IsRegistered(classRecord)) { this.listBox1.Items.Add(classRecord); } } }
public async Task <IActionResult> Create([Bind("Id,Name,Rollno,SClass,Year,Studentid")] StudentAccount StudentAccount) { if (ModelState.IsValid) { _context.Add(StudentAccount); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(StudentAccount)); }
/// <summary> /// Register a student to a class. /// </summary> /// <param name="fullCourseId">The full course id for a class. Example: courseNo-section.</param> /// <param name="student">The "Student" entity for which to register a class.</param> /// <returns></returns> public StudentAccount Register(string fullCourseId, StudentAccount student) { Class classRecord = GetClass(fullCourseId); if (classRecord != null) { student.Classes.Add(classRecord); } this.SaveAccount(student); return(student); }
public IActionResult CreateStudentAccount(StudentAccount sa) { if (ModelState.IsValid) { StudentAccount t = new StudentAccount(); t.StudentId = sa.StudentId; t.StudentName = sa.StudentName; db.StudentAccount.Add(t); db.SaveChanges(); } return(Redirect("ViewStudentAccountList")); }
public IActionResult EditStudentAccount(StudentAccount sa) { if (ModelState.IsValid) { StudentAccount t = new StudentAccount(); t.StudentId = sa.StudentId; t.StudentName = sa.StudentName; t.PaymentStatus = sa.PaymentStatus; db.StudentAccount.Update(t); db.SaveChanges(); } return(RedirectToAction("ViewStudentAccountList")); }
/// <summary> /// Save a "AccountClass" relationship to the database. /// </summary> /// <param name="student">The "Student" entity for which to save the relationship.</param> /// <param name="classRecord">The "Class" entity for which to save the relationship.</param> public void SaveAccountClass(StudentAccount student, Class classRecord) { this.dbConnection.Open(); string query = @"INSERT OR REPLACE INTO AccountClass (email, courseNo, section) VALUES (@email, @courseNo, @section)"; SQLiteCommand command = new SQLiteCommand(query, this.dbConnection); command.Parameters.AddWithValue("@email", student.Email); command.Parameters.AddWithValue("@courseNo", classRecord.CourseNo); command.Parameters.AddWithValue("@section", classRecord.Section); command.ExecuteNonQuery(); this.dbConnection.Close(); }
// # --------------- END OF DB ACTIONS -------------------------- // #EVENT LISTENER private void tbSearch_TextChanged(object sender, EventArgs e) { string searchTerm = tbSearch.Text; if (string.IsNullOrEmpty(searchTerm) || Helper.strIsEmpty(searchTerm)) { RefreshData(""); } else { RefreshData(StudentAccount.searchAccount(searchTerm)); } }
// # --------------- END OF DB ACTIONS -------------------------- // #EVENT LISTENER private void tbSearch_TextChanged(object sender, EventArgs e) { string searchTerm = tbSearch.Text; if (string.IsNullOrEmpty(searchTerm) || Helper.strIsEmpty(searchTerm)) { new clsDB().Con().FillLvw(lvManageRecord, sql); } else { new clsDB().Con().FillLvw(lvManageRecord, StudentAccount.searchAccount(searchTerm)); } }
public ActionResult Edit([Bind(Include = "AccountId,ClassOrYearId,ClassRollNo,GuardianNid,GroupId,Shift,Section,FamilyIncome,StudentConfirmId,ConfirmDate,ConfirmedBy,ExamPermissionId,PassingYear,UserName,Password,NidOrBirtgRegNo,EmailAddress,MobileNumber,FirstName,LasttName,OccupationId,FathersName,FathersOccupation,MothersName,MothersOccupation,DateOfBirth,PresentAddress,PermanentAddress,MaritarialStatus,Gender,Religion,BloodGroup,Nationality,RegDateTime,LastLoginDateTime")] StudentAccount studentAccount) { if (ModelState.IsValid) { db.Entry(studentAccount).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ClassOrYearId = new SelectList(db.ClassOrYears, "Code", "Name", studentAccount.ClassOrYearId); ViewBag.GroupId = new SelectList(db.Groups, "GroupCode", "Name", studentAccount.GroupId); ViewBag.StudentConfirmId = new SelectList(db.ConfirmationCatagories, "Code", "Name", studentAccount.StudentConfirmId); return(View(studentAccount)); }
public void SaveCareerRating(string user, string career, string rating) { StudentAccountClient sac = new StudentAccountClient(); StudentAccount student = sac.GetByPartitionAndRowKey(StudentAccountClient.GetPartitionKeyForEmail(user), user); if (student != null) { AssessmentCareerClient acc = new AssessmentCareerClient(); AssessmentCareer careerRating = acc.GetByPartitionAndRowKey(student.School, user + student.Year + student.Grade + career); if (careerRating == null) { acc.AddNewItem(new AssessmentCareer { PartitionKey = student.School, RowKey = user + student.Year + student.Grade + career, Value = rating, Counselor = student.Counselor, Student = user, Grade = student.Grade, GroupName = student.GroupName, DolCode = career, Year = student.Year }); //acrc.AddNewItem(new AssessmentCareerRating { PartitionKey = student.School, RowKey = user + career, DolCode = career, Rating = rating, GradYear = student.GradYear, Student = user, Teacher = student.Teacher, Group = student.Group }); if (rating == "1") { student.RatedCareers++; } else { student.DislikeCareers++; } sac.Update(student); } else { if (careerRating.Value != rating) { if (rating == "1") { student.DislikeCareers--; student.RatedCareers++; } else { student.DislikeCareers++; student.RatedCareers--; } sac.Update(student); } careerRating.Value = rating; acc.Update(careerRating); } } //StudentProfileClient spc = new StudentProfileClient(); //StudentProfile student = spc.GetByPartitionAndRowKey(StudentProfileClient.GetPartitionKeyForEmail(user), user); //AssessmentCareerRatingClient acrc = new AssessmentCareerRatingClient(); //AssessmentCareerRating careerRating = acrc.GetByPartitionAndRowKey(student.School, user + career); }
// GET: StudentAccount/Details/5 public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StudentAccount studentAccount = db.StudentAccounts.Find(id); if (studentAccount == null) { return(HttpNotFound()); } return(View(studentAccount)); }
public static bool ValidateTestDefinition(TestDefinition testDefinition, StudentAccount student, int time, DateTime finalDate) { testDefinition.TestDefinitionState = TestDefinitionState.Validated; Repository <TestDefinition> .Instance.Update(testDefinition); Repository <TestForm> .Instance.Add(new TestForm { TimeLimit = time, FinalDate = finalDate, TestDefinitionId = testDefinition.Id, StudentAccountId = student.Id }); return(true); }