public ActionResult DetailEdu(int id) { DBmanager manager = new DBmanager(); Educations education = manager.GetByEdu(id); return(View(education)); }
public override void LoadFromStore(VMStore modelStore) { try { Profile = JsonConvert.DeserializeObject <ClientProfileDTO>(modelStore.Store); Downloaded = Profile.Downloaded; ClientId = Profile.ClientId; SelectedMaritalStatus = MaritalStatus.FirstOrDefault(x => x.Id == Profile.MaritalStatus); SelectedKeyPop = KeyPops.FirstOrDefault(x => x.Id == Profile.KeyPop); OtherKeyPop = Profile.OtherKeyPop; SelectedEducation = Educations.FirstOrDefault(x => x.ItemId == Profile.Education); SelectedCompletion = Completions.FirstOrDefault(x => x.ItemId == Profile.Completion); SelectedOccupation = Occupations.FirstOrDefault(x => x.ItemId == Profile.Occupation); if (null != Profile.RelTypeId && !string.IsNullOrWhiteSpace(Profile.RelTypeId)) { SelectedRelationshipType = RelationshipTypes.FirstOrDefault(x => x.Description.ToLower() == Profile.RelTypeId.ToLower()); } } catch (Exception e) { Mvx.Error(e.Message); } }
public void Add(Model.Model m) { switch (m.Table) { case "Educations": Educations.Add((Education)m); break; case "Students": Students.Add((Student)m); break; case "Exams": Exams.Add((Exam)m); break; case "Attempts": Attempts.Add((Attempt)m); break; } DataRow dr = dao.Data.Tables[m.Table].NewRow(); m.FillRow(dr); dao.Data.Tables[m.Table].Rows.Add(dr); dao.UpdateTable(m.Table); m.Data = dr; m.AfterCreate(); }
public void Remove(Model.Model m) { m.Delete(); switch (m.Table) { case "Educations": Educations.Remove((Education)m); break; case "Students": Students.Remove((Student)m); break; case "Exams": Exams.Remove((Exam)m); break; case "Attempts": Attempts.Remove((Attempt)m); break; } dao.UpdateData(); m.AfterDelete(); }
public ActionResult DeleteEdu(int id) { Educations tx = repos.Find(x => x.ID == id); repos.TDelete(tx); return(RedirectToAction("Index")); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Title,Explain1,Explain2")] Educations educations) { if (id != educations.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(educations); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EducationsExists(educations.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(educations)); }
public Human(string surname, string name, string middlename, DateTime dateOfBirth, Genders gender, Educations education, double weight = 0, double height = 0, string adress = null, Human mother = null, Human father = null) { Id = numberOfId++; Name = name; Surname = surname; Middlename = middlename; DateOfBirth = dateOfBirth; Gender = gender; Education = education; Weight = weight; Height = height; Adress = adress; Mother = mother; Father = father; IsHappy = true; Partner = null; if (Mother != null) { Mother.AddChild(this); } if (Father != null) { Father.AddChild(this); } }
public ActionResult CreateEducation(Educations BasicInformation) { DBmanager dB = new DBmanager(); dB.CreateEducation(BasicInformation); return(RedirectToAction("CreateExperience")); }
public ActionResult EditEducations(Educations education) { DBmanager dBmanager = new DBmanager(); dBmanager.UpdateEducations(education); return(RedirectToAction("EditExperiences")); }
public static void EducationMap(this Educations dbEducation, Educations education) { dbEducation.University = education.University; dbEducation.StartDate = education.StartDate; dbEducation.EndDate = education.EndDate; dbEducation.Degree = education.Degree; dbEducation.AreaField = education.AreaField; }
// GET: EgitimDetay public ActionResult Index() { Educations egitim = (from p in islemler.Educations where p.ID == 1 select p).FirstOrDefault(); return(View(egitim)); }
public ActionResult Sil(int id) { Educations egitimler = (from p in islemler.Educations where p.ID == id select p).FirstOrDefault(); return(View(egitimler)); }
public ActionResult Yeni(Educations egitimler) { islemler.Educations.Add(egitimler); islemler.SaveChanges(); return(RedirectToAction("ListEducation")); }
public ActionResult DeleteConfirmed(int id) { Educations educations = db.Educations.Find(id); db.Educations.Remove(educations); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult AddEducation(Educations p) { if (!ModelState.IsValid) { return(View("AddEducation")); } repos.TAdd(p); return(RedirectToAction("Index")); }
public ActionResult Guncelle(int id) { ViewBag.Id = 1; Educations egitimler = (from p in islemler.Educations where p.ID == id select p).FirstOrDefault(); return(View(egitimler)); }
public ActionResult Detay(int id) { Educations edu = (from p in islemler.Educations where p.ID == id select p).FirstOrDefault(); ViewBag.ID = 1; return(View(edu)); }
public AddUserViewModel(IScreen screen) : base(screen) { User = new User(); Age = 0; Username = ""; FullName = ""; Educations = EducationTypeLookup.Load(); Genders = GenderTypeLookup.Load(); MaritalStatus = MaritalStatusTypeLookup.Load(); SelectedEducation = Educations.FirstOrDefault(); SelectedGender = Genders.FirstOrDefault(); SelectedMarital = MaritalStatus.FirstOrDefault(); Insert = ReactiveCommand.Create(AddUser); this.WhenActivated(d => { this.WhenAnyValue(x => x.FullName) .WhereNotNull() .Where(x => x.HasValue()) .Where(x => this.Username.IsEmpty()) .Subscribe(x => { if (!x.HasSpecialCharacters()) { var i = 0; var suggestedUsername = x.Remove(" ", "\n"); while (UserManager.UserExists(suggestedUsername)) { i += 1; suggestedUsername = suggestedUsername + i; } Username = suggestedUsername; } }).DisposeWith(d); }); this.ValidationRule(vm => vm.FullName, name => name.HasValue() && name.Length > 2, LanguageHelper.GetString("MustProvideAge", "Text")); this.ValidationRule(vm => vm.Username, name => name.HasValue() && name.Length > 2, LanguageHelper.GetString("MustProvideUserName", "Text")); this.ValidationRule(vm => vm.Username, name => !name.HasSpecialCharacters() && !name.ContainsAny(' ', '\n'), LanguageHelper.GetString("UserNameHasInvalidChars", "Text")); this.ValidationRule(vm => vm.Username, name => !UserManager.UserExists(name), LanguageHelper.GetString("UserExists", "Text")); this.ValidationRule(vm => vm.Age, age => age > 4, LanguageHelper.GetString("MustProvideAge", "Text")); }
public ActionResult Education() { ViewData["AdditionHeader"] = "我的设置"; EducationModel model = new EducationModel(); model.CurUser = CurrentUser; model.CurUserConfig = CurrentUserConfig; model.Educations = Educations.GetEducationsByUID(model.CurUser.ID); return(View(model)); }
public ActionResult Edit([Bind(Include = "Id,Education,School,Duration,Avarage,Description")] Educations educations) { if (ModelState.IsValid) { db.Entry(educations).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(educations)); }
public async Task <IActionResult> Create([Bind("Id,Title,Explain1,Explain2")] Educations educations) { if (ModelState.IsValid) { _context.Add(educations); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(educations)); }
private static Educations ToEducationDto(Educations education) { return(new Educations { University = education.University, Degree = education.Degree, StartDate = education.StartDate, EndDate = education.EndDate, AreaField = education.AreaField }); }
public ActionResult Create([Bind(Include = "Id,Education,School,Duration,Avarage,Description")] Educations educations) { if (ModelState.IsValid) { db.Educations.Add(educations); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(educations)); }
public virtual void RemoveEducation(int Id) { foreach (Education ED in Educations) { if (ED.Id == Id) { Educations.Remove(ED); break; } } }
public async Task <EducationDto> SaveEducation(EducationDto input) { if ((!WorkScope.GetAll <User, long>().Any(u => u.Id == input.CvemployeeId) || (!input.CvemployeeId.HasValue))) { throw new UserFriendlyException(ErrorCodes.NotFound.UserNotExist); } if (AbpSession.UserId.Value != input.CvemployeeId) { throw new UserFriendlyException(ErrorCodes.Forbidden.AccessOtherProfile); } int startYear, endYear; if (!(int.TryParse(input.StartYear, out startYear) && int.TryParse(input.EndYear, out endYear))) { throw new UserFriendlyException(ErrorCodes.NotAcceptable.YearIsNotValid); } if (startYear > endYear) { throw new UserFriendlyException(ErrorCodes.NotAcceptable.YearOutOfRange); } if (input.Id <= 0) { var education = new Educations { CvemployeeId = input.CvemployeeId, SchoolOrCenterName = input.SchoolOrCenterName, DegreeType = input.DegreeType, Major = input.Major, StartYear = input.StartYear, EndYear = input.EndYear, Description = input.Description, Order = input.Order }; await WorkScope.GetRepo <Educations, long>().InsertAsync(education); return(input); } else { var education = await WorkScope.GetAsync <Educations>(input.Id); education.CvemployeeId = input.CvemployeeId; education.SchoolOrCenterName = input.SchoolOrCenterName; education.DegreeType = input.DegreeType; education.Major = input.Major; education.StartYear = input.StartYear; education.EndYear = input.EndYear; education.Description = input.Description; education.Order = input.Order; await WorkScope.GetRepo <Educations, long>().UpdateAsync(education); return(input); } }
public ActionResult EditEdu(Educations p) { Educations tx = repos.Find(x => x.ID == p.ID); tx.Title = p.Title; tx.Subtitle = p.Subtitle; tx.Date = p.Date; tx.GPA = p.GPA; tx.Subtitle2 = p.Subtitle2; repos.TUpdate(tx); return(RedirectToAction("Index")); }
public ActionResult SilmeIslemi(int id) { Educations silinecekEgitim = (from p in islemler.Educations where p.ID == id select p).FirstOrDefault(); int egitimId = silinecekEgitim.ID; islemler.Educations.Remove(silinecekEgitim); islemler.SaveChanges(); return(RedirectToAction("ListEducation")); }
public IActionResult PostEducations([FromForm] Educations educations) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Educations.Add(educations); _context.SaveChanges(); return(CreatedAtAction("GetEducations", new { id = educations.EducationId }, educations)); }
public ActionResult Guncelle(Educations egitimler) { Educations seciliEgitim = (from p in islemler.Educations where p.ID == egitimler.ID select p).FirstOrDefault(); seciliEgitim.Name = egitimler.Name; seciliEgitim.Price = egitimler.Price; seciliEgitim.Time = egitimler.Time; seciliEgitim.University = egitimler.University; islemler.SaveChanges(); return(RedirectToAction("ListEducation")); }
private async void SaveEducationsMethod() { if (IsEducationValid()) { using (var _database = new ITManagerEntities()) { var userEducations = (await _database.Users.Where(u => u.Id == User.Id) .Include(u => u.Educations) .FirstOrDefaultAsync()).Educations; // Removing and changing educations foreach (var userEducation in userEducations.ToList()) { var _userEducation = Educations.FirstOrDefault(l => l.Id == userEducation.Id); // If exists in local collection, change data if (_userEducation != null) { userEducation.StartDate = _userEducation.StartDate; userEducation.EndDate = _userEducation.EndDate; userEducation.Faculty = _userEducation.Faculty; userEducation.Speciality = _userEducation.Speciality; userEducation.University = _userEducation.University; } // If not exists in local collection - remove. else { _database.Educations.Remove(userEducation); } } // Adding new education foreach (var newEducation in Educations.Where(l => l.Id == 0)) { userEducations.Add(new Education { StartDate = newEducation.StartDate, EndDate = newEducation.EndDate, Faculty = newEducation.Faculty, Speciality = newEducation.Speciality, University = newEducation.University, UserId = User.Id }); } IsEducationsChecked = false; User.Educations = (await _database.Users.Where(u => u.Id == User.Id).FirstOrDefaultAsync())?.Educations; await _database.SaveChangesAsync(); } } }
private async Task<int> AddEdu() { try { int tmp = Convert.ToInt16(TxtbxYear.Text); using (var db = new CVDBContext()) { var query = from edu in db.Educations where edu.EDU_ID == IDtoshow select edu; if (query.Count() < 1) { eduToAdd = new Educations { Course = TxtbxCourse.Text, Degree = TxtbxDegree.Text, Year = Convert.ToInt16(TxtbxYear.Text), Notes = TxtbxNotes.Text, School = TxtbxSchool.Text }; db.Educations.Add(eduToAdd); db.Entry(eduToAdd).State = EntityState.Added; await db.SaveChangesAsync(); eduID = eduToAdd.GetEduID(); } else { eduToAdd = query.FirstOrDefault(); eduToAdd.Course = TxtbxCourse.Text; eduToAdd.Degree = TxtbxDegree.Text; eduToAdd.Year = Convert.ToInt16(TxtbxYear.Text); eduToAdd.Notes = TxtbxNotes.Text; eduToAdd.School = TxtbxSchool.Text; eduID = eduToAdd.EDU_ID; db.Entry(eduToAdd).State = EntityState.Modified; db.SaveChanges(); } } return eduID; } catch (Exception ex) { MessageBox.Show(ex.Message + ex.InnerException, "add education error"); return 0; } }