Esempio n. 1
0
 public EmployeeEducation VHasInstitute(EmployeeEducation employeeEducation)
 {
     if (String.IsNullOrEmpty(employeeEducation.Institute) || employeeEducation.Institute.Trim() == "")
     {
         //  employeeEducation.Errors.Add("Institute", "Tidak boleh kosong");
     }
     return(employeeEducation);
 }
        public void UpdateEmployeeEducation(EmployeeEducationViewModel evm)
        {
            var               config = new MapperConfiguration(cfg => { cfg.CreateMap <EmployeeEducationViewModel, EmployeeEducation>(); cfg.IgnoreUnmapped(); });
            IMapper           mapper = config.CreateMapper();
            EmployeeEducation e      = mapper.Map <EmployeeEducationViewModel, EmployeeEducation>(evm);

            er.UpdateEmployeeEducation(e);
        }
Esempio n. 3
0
        public EmployeeInfoViewModel ViewEmployeeEducation(int eid)
        {
            EmployeeEducation e       = _employeeRepository.ViewEmployeeEducation(eid);
            var     config            = new MapperConfiguration(cfg => { cfg.CreateMap <EmployeeEducation, EmployeeInfoViewModel>(); cfg.IgnoreUnmapped(); });
            IMapper mapper            = config.CreateMapper();
            EmployeeInfoViewModel evm = mapper.Map <EmployeeEducation, EmployeeInfoViewModel>(e);

            return(evm);
        }
        public EmployeeEducation VHasEmployee(EmployeeEducation employeeEducation, IEmployeeService _employeeService)
        {
            Employee employee = _employeeService.GetObjectById(employeeEducation.EmployeeId);

            if (employee == null)
            {
                employeeEducation.Errors.Add("Employee", "Tidak valid");
            }
            return(employeeEducation);
        }
 public EmployeeEducation VHasGraduationDate(EmployeeEducation employeeEducation)
 {
     if (employeeEducation.GraduationDate == null || employeeEducation.GraduationDate.Equals(DateTime.FromBinary(0)))
     {
         employeeEducation.Errors.Add("GraduationDate", "Tidak valid");
     }
     else if (employeeEducation.GraduationDate.GetValueOrDefault().Date < employeeEducation.EnrollmentDate.Date)
     {
         employeeEducation.Errors.Add("GraduationDate", "Harus lebih besar atau sama dengan Enrollment Date");
     }
     return(employeeEducation);
 }
Esempio n. 6
0
 public ActionResult Edit(EmployeeEducation employeeEducation)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employeeEducation).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Details", "Employe", new { Id = employeeEducation.EmployeeId }));
     }
     ViewBag.EducationLevelId = new SelectList(db.EducationLevel, "Id", "EducationLevelNaame", employeeEducation.EducationLevelId);
     ViewBag.EmployeeId       = new SelectList(db.Employee, "Id", "Name", employeeEducation.EmployeeId);
     ViewBag.ExamTitleId      = new SelectList(db.ExamTitle, "Id", "TitleName", employeeEducation.ExamTitleId);
     return(View(employeeEducation));
 }
Esempio n. 7
0
        public EmployeeEducation CreateObject(string Institute, string Major, string Level, DateTime EnrollmentDate, Nullable <DateTime> GraduationDate, EmployeeService _employeeService)
        {
            EmployeeEducation employeeEducation = new EmployeeEducation
            {
                Institute      = Institute,
                Major          = Major,
                Level          = Level,
                EnrollmentDate = EnrollmentDate,
                GraduationDate = GraduationDate,
            };

            return(this.CreateObject(employeeEducation, _employeeService));
        }
        public async Task <EmployeeEducation> CreateNewEmployeeEducation(EmployeeEducation employeeEducation)
        {
            try
            {
                var res = await _repository.CreateNewEmployeeEducation(employeeEducation);

                return(res);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public string PrintError(EmployeeEducation obj)
        {
            string erroroutput = "";
            KeyValuePair <string, string> first = obj.Errors.ElementAt(0);

            erroroutput += first.Key + "," + first.Value;
            foreach (KeyValuePair <string, string> pair in obj.Errors.Skip(1))
            {
                erroroutput += Environment.NewLine;
                erroroutput += pair.Key + "," + pair.Value;
            }
            return(erroroutput);
        }
        public async Task <string> UpdateEmployeeEducation(int id, EmployeeEducation employeeEducation)
        {
            try
            {
                var res = await _repository.UpdateEmployeeEducation(id, employeeEducation);

                return(res);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 11
0
        // GET: EmployeeEducations/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EmployeeEducation employeeEducation = db.EmployeeEducation.Find(id);

            if (employeeEducation == null)
            {
                return(HttpNotFound());
            }
            return(View(employeeEducation));
        }
Esempio n. 12
0
        public ActionResult Create([Bind(Include = "Id,EducationLevelId,ExamTitleId,Major,InstituteName,ResultType,CGPA,Scale,PassingYear,Duration,Achievement,EmployeeId")] EmployeeEducation employeeEducation)
        {
            if (ModelState.IsValid)
            {
                db.EmployeeEducation.Add(employeeEducation);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.EducationLevelId = new SelectList(db.EducationLevel, "Id", "EducationLevelNaame", employeeEducation.EducationLevelId);
            ViewBag.EmployeeId       = new SelectList(db.Employee, "Id", "Name", employeeEducation.EmployeeId);
            ViewBag.ExamTitleId      = new SelectList(db.ExamTitle, "Id", "TitleName", employeeEducation.ExamTitleId);
            return(View(employeeEducation));
        }
Esempio n. 13
0
        public async Task <EmployeeEducation> CreateNewEmployeeEducation(EmployeeEducation employeeEducation)
        {
            try
            {
                _context.EmployeeEducations.Add(employeeEducation);
                await _context.SaveChangesAsync();

                return(employeeEducation);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void UpdateEmployeeEducation(EmployeeEducation e)
        {
            EmployeeEducation ee;

            ee = db.EmployeeEducations.Where(temp => (temp.EmployeeID == e.ID)).FirstOrDefault();
            if (ee != null)
            {
                ee.Qualification     = e.Qualification;
                ee.TenthGradeMark    = e.TenthGradeMark;
                ee.TwelfthGradeMark  = e.TwelfthGradeMark;
                ee.TwelfthSchoolName = e.TwelfthSchoolName;
                db.SaveChanges();
            }
        }
Esempio n. 15
0
        public async Task <IActionResult> Update([FromBody] EmployeeEducation employeeEducation)
        {
            int result = 0;

            try
            {
                context.Update(employeeEducation);
                result = await context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                logger.LogError(ex.ToString());
            }
            return(Ok(result));
        }
Esempio n. 16
0
        public async Task <IActionResult> Save([FromBody] EmployeeEducation employeeEducation)
        {
            int result = 0;

            try
            {
                employeeEducation.EmployeeEducationId = Guid.NewGuid();
                context.Add(employeeEducation);
                result = await context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                logger.LogError(ex.ToString());
            }
            return(Ok(result));
        }
Esempio n. 17
0
        // GET: EmployeeEducations/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EmployeeEducation employeeEducation = db.EmployeeEducation.Find(id);
            var emId = employeeEducation.EmployeeId;

            if (employeeEducation == null)
            {
                return(HttpNotFound());
            }
            db.EmployeeEducation.Remove(employeeEducation);
            db.SaveChanges();
            return(RedirectToAction("Details", "Employe", new { Id = emId }));
        }
Esempio n. 18
0
        // GET: EmployeeEducations/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EmployeeEducation employeeEducation = db.EmployeeEducation.Find(id);

            if (employeeEducation == null)
            {
                return(HttpNotFound());
            }
            ViewBag.EducationLevelId = new SelectList(db.EducationLevel, "Id", "EducationLevelNaame", employeeEducation.EducationLevelId);
            ViewBag.EmployeeId       = new SelectList(db.Employee, "Id", "Name", employeeEducation.EmployeeId);
            ViewBag.ExamTitleId      = new SelectList(db.ExamTitle, "Id", "TitleName", employeeEducation.ExamTitleId);
            return(View(employeeEducation));
        }
Esempio n. 19
0
        public async Task <IActionResult> CreateEmployeeEducation(EmployeeEducation employeeEducation)
        {
            try
            {
                var response = await _service.CreateNewEmployeeEducation(employeeEducation);

                if (response != null)
                {
                    return(Ok(response));
                }
                return(StatusCode(StatusCodes.Status204NoContent));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 20
0
        public bool UpdateEmployeeEducation(EmployeeEducation employeeEducation)
        {
            bool isSuccess = true;

            try
            {
                employeeEducationRepository.Update(employeeEducation);
                this.SaveRecord();
                ServiceUtil <EmployeeEducation> .WriteActionLog(employeeEducation.Id, ENUMOperation.UPDATE, employeeEducation);
            }
            catch (Exception ex)
            {
                isSuccess = false;
                logger.Error("Error in updating EmployeeEducation", ex);
            }
            return(isSuccess);
        }
        private bool SaveEmployeeEducation()
        {
            if (SaveEmployee())
            {
                var employeeEducation = new EmployeeEducation(SelectedEmployee);
                employeeEducation.ShowDialog();

                bool?dialogueResult = employeeEducation.DialogResult;
                if (dialogueResult == null || !(bool)dialogueResult)
                {
                    return(false);
                }
                SaveEmployee();

                return(true);
            }
            return(false);
        }
Esempio n. 22
0
        public async Task <string> UpdateEmployeeEducation(int id, EmployeeEducation employeeEducation)
        {
            try
            {
                var res = await _context.EmployeeEducations.FirstOrDefaultAsync(m => m.EmployeeEducationId == id);

                res.EmployeeName = employeeEducation.EmployeeName;
                res.Institute    = employeeEducation.Institute;
                res.StartDate    = employeeEducation.StartDate;
                res.CompletedOn  = employeeEducation.CompletedOn;
                _context.Update(res);
                await _context.SaveChangesAsync();

                return("Updated Record");
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 23
0
 public static EmployeeEducationModel EditEmployeeEducation(EmployeeEducationModel model)
 {
     using (var context = new MakeMyJobsEntities())
     {
         EmployeeEducation employeeEducation = context.EmployeeEducations.FirstOrDefault(x => x.EmpEducationId == model.empEducationId);
         if (employeeEducation != null)
         {
             employeeEducation.EmployeeId    = model.employeeId;
             employeeEducation.InstituteName = model.instituteName;
             employeeEducation.InstituteType = model.instituteType;
             employeeEducation.JoinedOn      = model.joinedOn;
             employeeEducation.PassedOn      = model.passedOn;
             employeeEducation.IsActive      = 1;
             int updated = context.SaveChanges();
             if (updated > 0)
             {
                 return(new EmployeeEducationModel()
                 {
                     empEducationId = employeeEducation.EmpEducationId,
                     employeeId = employeeEducation.EmployeeId,
                     instituteName = employeeEducation.InstituteName,
                     instituteType = employeeEducation.InstituteType,
                     joinedOn = employeeEducation.JoinedOn,
                     passedOn = employeeEducation.PassedOn,
                     isActive = employeeEducation.IsActive
                 });
             }
             else
             {
                 return(null);
             }
         }
         else
         {
             return(null);
         }
     }
 }
Esempio n. 24
0
        public void PutEducation_ShouldReturnOk()
        {
            var educationsTestData = new List <EmployeeEducation>()
            {
                new EmployeeEducation {
                    Id = 1, EmployeeId = 2
                },
                new EmployeeEducation {
                    Id = 2, Deleted = true, EmployeeId = 2
                },
                new EmployeeEducation {
                    Id = 3, EmployeeId = 3
                }
            };
            var educations = MockHelper.MockDbSet(educationsTestData);
            var dbContext  = new Mock <IAppDbContext>();

            dbContext.Setup(m => m.EmployeeEducations).Returns(educations.Object);
            dbContext.Setup(d => d.Set <EmployeeEducation>()).Returns(educations.Object);

            var factory = new Mock <IDbContextFactory>();

            factory.Setup(m => m.CreateDbContext()).Returns(dbContext.Object);

            IDbContextFactory fac = factory.Object;
            var controller        = new EmployeeEducationsController(fac);

            EmployeeEducation car = new EmployeeEducation {
                Id = 3, Deleted = null, EmployeeId = 3
            };

            var result = controller.PutEmployeeEducation(3, car.ToDTO()) as OkNegotiatedContentResult <EmployeeEducationDTO>;

            Assert.IsNotNull(result);
            Assert.AreEqual(3, result.Content.Id);
        }
Esempio n. 25
0
        public static EmpEducationDTO ConvertRespondentInfoToDTO(EmployeeEducation employeeEducation)
        {
            Mapper.CreateMap <EmployeeEducation, EmpEducationDTO>().ConvertUsing(

                m =>
            {
                return(new EmpEducationDTO
                {
                    EduId = m.EduId,
                    CountryId = m.CountryId,
                    EducationStatus = m.EducationStatus,
                    EmpCode = m.EmpCode,
                    DegreeName = m.DegreeName,
                    EmpEduLevelId = m.EmpEduLevelId,
                    FacultyName = m.FacultyName,
                    MarkingSystem = m.MarkingSystem,
                    ObtainedMark = m.ObtainedMark,
                    PassedDate = Convert.ToDateTime(m.PassedDate),
                    ScanDocument = m.ScanDocument,
                    UniversityName = m.UniversityName,
                    Division = m.Division
                               //Country = new CountryDTO
                               //{
                               //    CountryName = m.Country.CountryName,
                               //    CountryId = m.Country.CountryId
                               //},
                               //EducationLevel = new EducationLevelDTO
                               //{
                               //    LevelName = m.EducationLevel.LevelName,
                               //    LevelId = m.EducationLevel.LevelId
                               //}
                });
            }
                );
            return(Mapper.Map <EmployeeEducation, EmpEducationDTO>(employeeEducation));
        }
Esempio n. 26
0
        public async Task <IActionResult> UpdateEmployeeEducation(int EmployeeEducationId, EmployeeEducation employeeEducation)
        {
            try
            {
                var res = await _service.UpdateEmployeeEducation(EmployeeEducationId, employeeEducation);

                if (res != null)
                {
                    return(Ok(res));
                }
                return(StatusCode(StatusCodes.Status204NoContent));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Esempio n. 27
0
        public EmpEducationDTO InsertEmpEducation(EmpEducationDTO data)
        {
            EmployeeEducation dataToInsert = EmpEducationRequestFormatter.ConvertRespondentInfoFromDTO(data);

            return(EmpEducationRequestFormatter.ConvertRespondentInfoToDTO(_unitOfWork.EmployeeEducationRepository.Create(dataToInsert)));
        }
        protected void btnEducation_Click(object sender, EventArgs e)
        {
            int    id        = GetQueryIntValue("id");
            int    uid       = GetQueryIntValue("uid");
            string activeTab = GetQueryValue("activeTab");

            Infobasis.Data.DataEntity.EmployeeEducation eeEd = DB.EmployeeEducations.Where(u => u.ID == id).FirstOrDefault();
            bool createNew = false;

            if (eeEd != null)
            {
                eeEd.LastUpdateDatetime = DateTime.Now;
                eeEd.LastUpdateByID     = UserInfo.Current.ID;
                eeEd.LastUpdateByName   = UserInfo.Current.ChineseName;
            }
            else
            {
                eeEd = new EmployeeEducation();
                eeEd.CreateDatetime = DateTime.Now;
                eeEd.CreateByID     = UserInfo.Current.ID;
                eeEd.CreateByName   = UserInfo.Current.ChineseName;

                createNew = true;
            }

            eeEd.UserID = uid;
            eeEd.EducationalInstitution = tbxEducationalInstitution.Text;
            eeEd.Major             = tbxMajor.Text;
            eeEd.Education         = Change.ToInt(DropDownEducation.SelectedValue);
            eeEd.EducationName     = DropDownEducation.SelectedText;
            eeEd.EducationType     = Change.ToInt(DropDownEducationType.SelectedValue);
            eeEd.EducationTypeName = DropDownEducationType.SelectedText;
            eeEd.AcademicDegree    = tbxAcademicDegree.Text;

            DateTime startDate = Change.ToDateTime(tbxStartDate.Text);
            DateTime endDate   = Change.ToDateTime(tbxEndDate.Text);

            if (startDate != DateTime.MinValue)
            {
                eeEd.StartDate = Change.ToDateTime(tbxStartDate.Text);
            }
            if (endDate != DateTime.MinValue)
            {
                eeEd.EndDate = Change.ToDateTime(tbxEndDate.Text);
            }

            eeEd.IsHighest = cbxIsHighest.Checked;
            eeEd.Remark    = tbxRemark.Text;

            EmployeeAdjust eeAdjust = new EmployeeAdjust()
            {
                UserID         = uid,
                AdjustItemName = "教育培训经历",
                AdjustDate     = DateTime.Now,
                AllChangeData  = eeEd.ToString(),
                isAdjusted     = true,
                CreateByID     = UserInfo.Current.ID,
                CreateByName   = UserInfo.Current.ChineseName,
                CreateDatetime = DateTime.Now
            };

            DB.EmployeeAdjusts.Add(eeAdjust);

            if (createNew)
            {
                DB.EmployeeEducations.Add(eeEd);
            }

            SaveChanges();

            ShowNotify("保存成功!");
            PageContext.RegisterStartupScript("refreshTopWindow();");
        }
Esempio n. 29
0
 public bool CheckIsExist(EmployeeEducation employeeEducation)
 {
     return(employeeEducationRepository.Get(chk => chk.EmployeeId == employeeEducation.EmployeeId && chk.LevelId == employeeEducation.LevelId) == null ? false : true);
 }
Esempio n. 30
0
 public EmployeeEducation SoftDeleteObject(EmployeeEducation employeeEducation)
 {
     return(employeeEducation = _validator.ValidDeleteObject(employeeEducation) ?
                                _repository.SoftDeleteObject(employeeEducation) : employeeEducation);
 }