public JsonResult SaveRating(RatingModel Model) { JsonResult jsonResult = new JsonResult() { Success = false }; try { var username = User.Identity.Name; StudentProfile student = dbcontext.StudentProfiles.Where(x => x.EmailID.ToLower() == username).SingleOrDefault(); var StudentCourse = (from a in dbcontext.StudentProfiles.Where(x => x.EmailID == username) select a.Course).SingleOrDefault(); StudentCourseRating sc = new StudentCourseRating() { StudentID = student.Student_ID, CourseID = StudentCourse, Rating = Model.Rating, CreatedDate = DateTime.Now }; dbcontext.StudentCourseRatings.Add(sc); if (dbcontext.SaveChanges() > 0) { jsonResult.Success = true; } } catch (Exception ex) { // SystemLogManager.Add("Api|Notify|Get", ex.Message, ex.InnerException.Message ?? "-"); } return(jsonResult); }
public bool Execute() { bool result = false; try { var db = new StudentDB(); var studentProfile = new StudentProfile() { Id = "A111222333", Name = "test Trans", CreateDate = DateTime.Now }; var studentProfile2 = new StudentProfile() { Id = "A111222333", Name = "test Trans2", CreateDate = DateTime.Now }; db.StudentProfile.Add(studentProfile); db.StudentProfile.Add(studentProfile2); db.SaveChanges(); result = true; } catch (Exception e) { ErrMsg = Util.getDebugMsg(MethodBase.GetCurrentMethod(), e.InnerException.InnerException.Message); } return(result); }
public async Task <OperationDetails> Create(UserDTO userDto) { ApplicationUser user = await Database.UserManager.FindByNameAsync(userDto.UserName); if (user == null) { user = new ApplicationUser { Email = userDto.Email, UserName = userDto.UserName, LockoutEnabled = userDto.LockoutEnabled }; var result = await Database.UserManager.CreateAsync(user, userDto.Password); if (result.Errors.Count() > 0) { return(new OperationDetails(false, result.Errors.FirstOrDefault(), "")); } //Add new user. await Database.UserManager.AddToRoleAsync(user.Id, userDto.Role); // Add role to current user. StudentProfile clientProfile = new StudentProfile { Id = user.Id, FirstName = userDto.FirstName, SecondName = userDto.SecondName }; Database.StudentProfiles.Create(clientProfile); await Database.SaveAsync(); return(new OperationDetails(true, "Регистрация успешно пройдена", "")); } else { return(new OperationDetails(false, "Пользователь с таким логином уже существует", "Email")); } }
public ActionResult Details(int id) { Post post = _dbContext.Posts.Find(id); StudentProfile student = _dbContext.StudentProfiles.Find(post.StudentId); if (post == null || student == null) { return(HttpNotFound()); } PostDetailsViewModel model = new PostDetailsViewModel(); ApplicationUser user = UserManager.FindById(student.UserId); model.Id = post.Id; model.UserName = user.UserName; model.Class = student.Class; model.DaysPerWeek = post.DaysPerWeek; model.InstituteName = student.InstituteName; model.IsNegotiable = post.IsNegotiable; model.Name = student.Name; model.PresentAddress = student.PresentAddress; model.Salary = post.Salary; model.Subjects = post.Subjects; model.Version = student.Version; model.IsCompleted = post.IsCompleted; return(View(model)); }
public void Dispose() { mockRepo = null; mapper = null; configuration = null; realProfile = null; }
public List <StudentProfile> StudentProfiles() { List <StudentProfile> stp = new List <StudentProfile>(); var Record = (from stud in db.Students join chk in db.StudentCheckIns on stud.StudId equals chk.StudId select new { stud.StudentNumber, stud.PhoneNumber, stud.Name, stud.Surname, stud.IdNumber, stud.Email, chk.ResName, chk.RooNumber }).ToList(); StudentProfile stupp = new StudentProfile(); foreach (var item in Record) { stupp.StudentNumber = item.StudentNumber; stupp.PhoneNumber = item.PhoneNumber; stupp.IdNumber = item.IdNumber; stupp.ResName = item.ResName; stupp.Email = item.Email; stupp.InitialSurname = item.Surname.Substring(0, 1) + ". " + item.Surname; stp.Add(stupp); } return(stp); }
private void session_comboBox_SelectedIndexChanged(object sender, EventArgs e) { try { StudentResult sr = new StudentResult(); StudentProfile sp = new StudentProfile(); DataTable dt1 = sr.getAbsentStudents(session_comboBox.Text); int length = dt1.Rows.Count; DataTable dt = new DataTable(); dt.Columns.Add("ID"); dt.Columns.Add("Name"); dt.Columns.Add("StudentsMobileNo"); dt.Columns.Add("GuardianMobileNo"); dt.Columns.Add("AbsentDays"); DataRow dr; for (int i = 0; i < length; i++) { dr = dt.NewRow(); string id = dt1.Rows[i][0].ToString(); dr["ID"] = id; dr["Name"] = sp.getNameOfSelectedId(id); dr["StudentsMobileNo"] = sp.getStudentMblSelectedId(id); dr["GuardianMobileNo"] = sp.getGuardianMblSelectedId(id); dr["AbsentDays"] = dt1.Rows[i][1].ToString(); dt.Rows.Add(dr); } absentStudent_dataGridView.DataSource = dt; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public static StudentProfile ToStudentProfile(StudentProfileInputModel model) { StudentProfile profile = new StudentProfile(); profile.Description = model.Description; if (model.FacultyName != null) { profile.Faculty = ((App)App.Current).faculties.GetAll().First(f => f.Name == model.FacultyName); if (model.StudyProgramName != null) { profile.StudyProgram = profile.Faculty.StudyPrograms.Values.First(sp => sp.Name == model.StudyProgramName); if (model.StudyProgramSpecializationName != null) { profile.StudyProgramSpecialization = profile.StudyProgram.StudyProgramSpecializations.Values.First(sps => sps.Name == model.StudyProgramSpecializationName); } } } profile.StudyCycle = model.StudyCycle ?? null; profile.StudyYear = model.StudyYear ?? null; return(profile); }
public ActionResult DeleteConfirmed(int id) { StudentProfile studentProfile = db.StudentProfiles.Find(id); db.StudentProfiles.Remove(studentProfile); db.SaveChanges(); return(RedirectToAction("Index")); }
public LabControllerTests() { mockRepo = new Mock <ILabAPIRepo>(); realProfile = new StudentProfile(); configuration = new MapperConfiguration(cfg => cfg. AddProfile(realProfile)); mapper = new Mapper(configuration); }
private void replaceStudentProfileNull(StudentProfile studentProfile) { studentProfile.Id = studentProfile.Id.ReplaceNull(); studentProfile.Name = studentProfile.Name.ReplaceNull(); studentProfile.Gender = studentProfile.Gender.ReplaceNull(); studentProfile.Blood = studentProfile.Blood.ReplaceNull(); studentProfile.Coupon = studentProfile.Coupon.ReplaceNull(); }
// // GET: /StudentProfile/Delete/5 public ActionResult Delete(int id = 0) { StudentProfile studentprofile = db.StudentProfiles.Find(id); if (studentprofile == null) { return(HttpNotFound()); } return(View(studentprofile)); }
// // GET: /StudentProfile/EditRemarks/5 public ActionResult EditRemarks(string id = null) { StudentProfile studentprofile = db.StudentProfiles.Find(id); if (studentprofile == null) { return(HttpNotFound("Student Profile not found")); } return(View(studentprofile)); }
public ActionResult Edit(StudentProfile studentprofile) { if (ModelState.IsValid) { db.Entry(studentprofile).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(studentprofile)); }
private void studentProfilesToolStripMenuItem_Click(object sender, EventArgs e) { MainPanel.Controls.Clear(); if (studentPro != null) { studentPro.Close(); } studentPro = new StudentProfile(); FormSetUp(studentPro); }
private void DueAmount_Load(object sender, EventArgs e) { StudentProfile sp = new StudentProfile(); List <string> session = sp.getSession(); for (int i = 0; i < session.Count; i++) { session_comboBox.Items.Add(session[i]); } }
private void StudentNumberInUniv_Load(object sender, EventArgs e) { StudentProfile sp = new StudentProfile(); List <string> s = sp.getSession(); for (int i = 0; i < s.Count; i++) { session_comboBox.Items.Add(s[i]); } }
private void button2_Click(object sender, EventArgs e) { //go to Student Profile StudentProfile studentProfile = new StudentProfile(); studentProfile.Show(); //hide this interface this.Hide(); }
private void studentProfileToolStripMenuItem_Click(object sender, EventArgs e) { MainPanel.Controls.Clear(); if (profile != null) { profile.Close(); } profile = new StudentProfile(); FormSetUp(profile); }
private void bt_SaveStudentProfile_Click(object sender, EventArgs e) { try { using (cAaMISContext ctx = new cAaMISContext()) { var studentProfile = new StudentProfile { //Part 1 Name = tb_Name.Text, NickName = tb_NickName.Text, Course = tb_Course.Text, Year = tb_Year.Text, CellphoneNo = tb_CellphoneNo.Text, EmailAddress = tb_EmaillAddress.Text, BirthDate = dateTimePicker_BirthDate.Value.Date, Age = Convert.ToInt32(tb_Age.Text), HomeAddress = tb_HomeAddress.Text, CampusAddress = tb_CampusAddress.Text, //Part 2 HavePerformed = cb_HavePerformed.Checked, HaveTrainings = cb_HaveTraining.Checked, HaveExperience = cb_HaveTraining.Checked, CanAttend = cb_CanAttend.Checked, Commuter = cb_Commuter.Checked, Skills = tb_Skills.Text, Finance = tb_Finance.Text, //Part 3 FolkDance = cb_FolkDance.Checked, HipHop = cb_HipHop.Checked, Contemporary = cb_Contemporary.Checked, Theater = cb_Theater.Checked, LiteraryArts = cb_LiteraryArts.Checked, RadioTalents = cb_RadioTalents.Checked, ManagementTechnical = cb_ManagementTechnical.Checked, Chorale = cb_Chorale.Checked, LiveBand = cb_LiveBand.Checked, RondallaBand = cb_RondallaBand.Checked, PaintingDrawing = cb_PaintingDrawing.Checked, MakeUp = cb_MakeUp.Checked, Photography = cb_Photography.Checked, Multimedia = cb_Multimedia.Checked, }; ctx.StudentProfile.Add(studentProfile); ctx.SaveChanges(); MessageBox.Show("Student Profile Save Successfully"); ClearText(); } } catch (Exception) { } }
public ActionResult Create(StudentProfile studentprofile) { if (ModelState.IsValid) { db.StudentProfiles.Add(studentprofile); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(studentprofile)); }
private void session_comboBox_SelectedIndexChanged(object sender, EventArgs e) { try { StudentProfile sp = new StudentProfile(); univInfo_dataGridView.DataSource = sp.getUniversityInfo(session_comboBox.SelectedItem.ToString()); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public ActionResult Create(StudentProfile studentProfile, HttpPostedFileBase profileimage) { var userId = User.Identity.GetUserId(); var profile = db.StudentProfiles.Where(x => x.UserId == userId).FirstOrDefault(); var checkphone = db.StudentProfiles.Where(x => x.PhoneNumber == studentProfile.PhoneNumber).SingleOrDefault(); string validation = "الرقم الذ ادخلته مسجل بحساب خر"; if (ModelState.IsValid) { string profileImagePath = Server.MapPath("~/Uploads/Student/ProfileImage/"); if (!Directory.Exists(profileImagePath)) { Directory.CreateDirectory(profileImagePath); } if (profileimage != null && profileimage.ContentLength > 0) { var ImageName = Path.GetFileName(profileimage.FileName); var extention = Path.GetExtension(profileimage.FileName); string path = Path.Combine(profileImagePath + ImageName); profileimage.SaveAs(path); studentProfile.ProfileImage = ImageName; } studentProfile.IsActive = true; studentProfile.UserId = userId; studentProfile.CreateDateTime = DateTime.Now; if (profile == null) { if (checkphone == null) { db.StudentProfiles.Add(studentProfile); } else { ViewBag.message = validation; } } else { db.StudentProfiles.Attach(studentProfile); } db.SaveChanges(); return(RedirectToAction("StudentHome", "StudentHome", new { area = "StudentArea" })); } ViewBag.CityId = new SelectList(ddb.Cities, "Id", "Name", studentProfile.CityId); ViewBag.CountryId = new SelectList(ddb.Countries, "Id", "Name", studentProfile.CountryId); ViewBag.TermId = new SelectList(db.CurrentTerms, "Id", "Name", studentProfile.TermId); ViewBag.EstateId = new SelectList(ddb.Estates, "Id", "Name", studentProfile.EstateId); ViewBag.SchooleId = new SelectList(ddb.Schooles, "Id", "Name", studentProfile.SchooleId); ViewBag.StudyYearId = new SelectList(db.StudyYears, "Id", "Name", studentProfile.StudyYearId); return(View(studentProfile)); }
public void cleartextStudent() { //arrange StudentProfile sp = new StudentProfile(); //act Boolean t = sp.clearText(); //assert Assert.AreEqual(true, t); }
private void IndividualPayment_Load(object sender, EventArgs e) { StudentProfile sp = new StudentProfile(); List <string> id = sp.getID(); for (int i = 0; i < id.Count; i++) { Id_comboBox.Items.Add(id[i]); } Id_comboBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend; Id_comboBox.AutoCompleteSource = AutoCompleteSource.ListItems; }
public ActionResult EditRemarks(StudentProfile studentprofile) { StudentProfile student = db.StudentProfiles.Find(studentprofile.id); if (studentprofile == null) { return(HttpNotFound("Student Profile not found")); } student.remarks = studentprofile.remarks; db.SaveChanges(); return(Content(student.remarks)); }
public bool hasStudentProfile(Guid userId) { StudentProfile studentProfile = GetStudentProfileById(userId); if (!(studentProfile == null)) { return(true); } else { return(false); } }
public void deleteStudent() { //arrange StudentProfile sp = new StudentProfile(); //act String name = "Jihad"; Boolean t = sp.delete(name); //assert Assert.AreEqual(true, t); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["AdminNo"] != null) { LblAdminNo.Text = Session["AdminNo"].ToString(); StudentProfile selTD = new StudentProfile(); StudentProfileDAO updTD = new StudentProfileDAO(); selTD = updTD.getStudentById(LblAdminNo.Text); } } }
public void InsertOrUpdate(StudentProfile studentProfile) { if (studentProfile.StudentProfileId == default(int)) { // New entity context.StudentProfiles.Add(studentProfile); } else { // Existing entity context.Entry(studentProfile).State = EntityState.Modified; } }
public HomeController(ILogger <HomeController> logger) { _logger = logger; //inheritence from PersonalDetails to DoctorProfile DoctorProfile Vicran = new DoctorProfile() { FirstName = "Vikrant Shrestha", Address = "Kathmnandu", Age = 21, Occupation = "Doctor", //DoctorProfile specific property HospitalClinic = "Grande Hospital", Qualification = "MD", Speciality = "NeuroSurgeon" }; detailList.Add(Vicran); //inheritence from PersonalDetails to TeacherProfile TeacherProfile Sinke = new TeacherProfile() { FirstName = "Aman Butthe", Address = "Darjeeling", Age = 20, Occupation = "Teacher", //TeacherProfile specific property Qualification = "B.Ed.", Institute = "JMC", AssociatedSubjects = "Mathematics" }; detailList.Add(Sinke); //inheritence from PersonalDetails to StudentProfile StudentProfile Sallu = new StudentProfile() { FirstName = "Salina Awal", Address = "Bhaktapur", Age = 23, Occupation = "Student", //StudentProfile specific property Faculty = "Architecture", College_School = "Pulchowk", Rollno = 15162 }; detailList.Add(Sallu); }
/// <summary> /// Loads the DOT classes. /// </summary> /// <returns></returns> public static List<DOTClass> LoadDOTClasses() { List<DOTClass> classes = new List<DOTClass>(); XmlDocument doc = new XmlDocument(); doc.Load(HttpContext.Current.Server.MapPath("StudentProfiles.xml")); const string xpath = "studentprofiles"; XmlNode node = doc.SelectSingleNode(xpath); if (node != null) { foreach(XmlNode classNode in node.ChildNodes) { DOTClass dotClass = new DOTClass(); List<StudentProfile> profiles = new List<StudentProfile>(); dotClass.Period = classNode.Attributes.GetNamedItem("period").Value; XmlNode dayNode = classNode.SelectSingleNode("day"); if (dayNode != null) { dotClass.DayClassImage = dayNode.Attributes.GetNamedItem("image").Value; foreach (XmlNode childNode in dayNode.ChildNodes) { StudentProfile profile = new StudentProfile { ClassTime = "Day", Name = childNode.Attributes.GetNamedItem("name").Value, Image = childNode.Attributes.GetNamedItem("image").Value, Hometown = childNode.Attributes.GetNamedItem("hometown").Value, Testimonial = childNode.Attributes.GetNamedItem("testimonial").Value }; profiles.Add(profile); } } XmlNode eveningNode = classNode.SelectSingleNode("evening"); if (eveningNode != null) { dotClass.EveningClassImage = eveningNode.Attributes.GetNamedItem("image").Value; foreach (XmlNode childNode in eveningNode.ChildNodes) { StudentProfile profile = new StudentProfile { ClassTime = "Evening", Name = childNode.Attributes.GetNamedItem("name").Value, Image = childNode.Attributes.GetNamedItem("image").Value, Hometown = childNode.Attributes.GetNamedItem("hometown").Value, Testimonial = childNode.Attributes.GetNamedItem("testimonial").Value }; profiles.Add(profile); } } dotClass.Students = profiles; classes.Add(dotClass); } } return classes; }