Example #1
0
        public ActionResult DetailEdu(int id)
        {
            DBmanager  manager   = new DBmanager();
            Educations education = manager.GetByEdu(id);

            return(View(education));
        }
Example #2
0
        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);
            }
        }
Example #3
0
        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();
        }
Example #4
0
        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();
        }
Example #5
0
        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));
        }
Example #7
0
 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);
     }
 }
Example #8
0
        public ActionResult CreateEducation(Educations BasicInformation)
        {
            DBmanager dB = new DBmanager();

            dB.CreateEducation(BasicInformation);
            return(RedirectToAction("CreateExperience"));
        }
Example #9
0
        public ActionResult EditEducations(Educations education)
        {
            DBmanager dBmanager = new DBmanager();

            dBmanager.UpdateEducations(education);
            return(RedirectToAction("EditExperiences"));
        }
Example #10
0
 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;
 }
Example #11
0
        // GET: EgitimDetay
        public ActionResult Index()
        {
            Educations egitim = (from p in islemler.Educations
                                 where p.ID == 1
                                 select p).FirstOrDefault();

            return(View(egitim));
        }
Example #12
0
        public ActionResult Sil(int id)
        {
            Educations egitimler = (from p in islemler.Educations
                                    where p.ID == id
                                    select p).FirstOrDefault();

            return(View(egitimler));
        }
Example #13
0
        public ActionResult Yeni(Educations egitimler)
        {
            islemler.Educations.Add(egitimler);
            islemler.SaveChanges();


            return(RedirectToAction("ListEducation"));
        }
Example #14
0
        public ActionResult DeleteConfirmed(int id)
        {
            Educations educations = db.Educations.Find(id);

            db.Educations.Remove(educations);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #15
0
 public ActionResult AddEducation(Educations p)
 {
     if (!ModelState.IsValid)
     {
         return(View("AddEducation"));
     }
     repos.TAdd(p);
     return(RedirectToAction("Index"));
 }
Example #16
0
        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));
        }
Example #17
0
        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));
        }
Example #18
0
        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"));
        }
Example #19
0
        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));
        }
Example #20
0
 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));
        }
Example #22
0
 private static Educations ToEducationDto(Educations education)
 {
     return(new Educations
     {
         University = education.University,
         Degree = education.Degree,
         StartDate = education.StartDate,
         EndDate = education.EndDate,
         AreaField = education.AreaField
     });
 }
Example #23
0
        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));
        }
Example #24
0
 public virtual void RemoveEducation(int Id)
 {
     foreach (Education ED in Educations)
     {
         if (ED.Id == Id)
         {
             Educations.Remove(ED);
             break;
         }
     }
 }
Example #25
0
        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);
            }
        }
Example #26
0
        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"));
        }
Example #27
0
        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));
        }
Example #29
0
        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"));
        }
Example #30
0
        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();
                }
            }
        }
Example #31
0
        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;
            }
        }