Exemplo n.º 1
0
        public ActionResult EducationEdit(int empId, int eduId)
        {
            if (!ViewBag.AllowView)
            {
                ViewBag.Error = "You are not Authorize to use this Page";
                return(PartialView("_partialviewNotFound"));
            }
            List <SelectListItem> educationLevel = new List <SelectListItem>();

            foreach (var row in _educationLevel.GetEducationLevel())
            {
                educationLevel.Add(new SelectListItem
                {
                    Text  = row.LevelName,
                    Value = row.LevelId.ToString()
                });
            }
            IEnumerable <SelectListItem> countries = _countryService.GetCountryList();

            ViewBag.Countries      = countries;
            ViewBag.EducationLevel = educationLevel;
            ViewBag.EmployeeDetail = _empDetails.GetEmployeeDetails(empId);
            ViewBag.SideBar        = _moduleService.AdminEmployeeDetailsMenu(empId);
            EmpEducationDTO data = _empEducationService.GetEducationByEduId(eduId);

            data.PassedDateNP = !String.IsNullOrEmpty(Convert.ToString(data.PassedDate)) ? NepEngDate.EngToNep(Convert.ToDateTime(data.PassedDate)) : null;

            //data.PassedDate = Convert.ToDateTime( NepDateConverter.EngToNep(data.PassedDate).ToString());
            return(View("../Employee/Education/EducationEdit", data));
        }
Exemplo n.º 2
0
        public int UpdateEducation(EmpEducationDTO data)
        {
            EmployeeEducation dataToUpdate = EmpEducationRequestFormatter.ConvertRespondentInfoFromDTO(data);
            var res = _unitOfWork.EmployeeEducationRepository.Update(dataToUpdate);

            return(res);
        }
Exemplo n.º 3
0
        public void Edit(EmpEducationDTO EduDTO)
        {
            using (var container = new InventoryContainer())
            {
                var Comp = new EmpEducation();
                Comp = container.EmpEducations.FirstOrDefault(o => o.EduId.Equals(EduDTO.EduId));
                //  Comp = container.EmpEducations  .FirstOrDefault(o => o.EmpId.Equals(EduDTO.EmpId));
                //  Comp.EmpId = EduDTO.EmpId;
                // Comp.EduId = EduDTO.EduId;
                Comp.Board         = EduDTO.Board;
                Comp.UpdateBy      = EduDTO.UpdateBy;
                Comp.Updatedate    = EduDTO.Updatedate;
                Comp.Cgpa          = EduDTO.Cgpa;
                Comp.Division      = EduDTO.Division;
                Comp.Eximination   = EduDTO.Eximination;
                Comp.InstituteName = EduDTO.InstituteName;
                Comp.PassingYear   = EduDTO.PassingYear;        //problem can be occur
                Comp.ResultType    = EduDTO.ResultType;
                Comp.Note          = EduDTO.Note;

                Comp = (EmpEducation)DTOMapper.DTOObjectConverter(EduDTO, Comp);

                container.SaveChanges();
            }
        }
        public ActionResult EditEducation(EmpEducationDTO data)
        {
            data.PassedDate = Convert.ToDateTime(NepEngDate.NepToEng(data.PassedDateNP));

            data.EmpCode         = Convert.ToInt32(Session["EmpCode"]);
            data.EducationStatus = 0;
            EmpEducationDTO       jtd            = new EmpEducationDTO();
            List <SelectListItem> educationLevel = new List <SelectListItem>();

            foreach (var row in _educationLevel.GetEducationLevel())
            {
                educationLevel.Add(new SelectListItem
                {
                    Text  = row.LevelName,
                    Value = row.LevelId.ToString()
                });
            }
            IEnumerable <SelectListItem> CountryList = _countryService.GetCountryList();

            ViewBag.Countries      = CountryList;
            ViewBag.EducationLevel = educationLevel;
            //if (!ModelState.IsValid)
            //{
            //    return View(jtd);
            //}
            if (data.EducationStatus == 0)
            {
                if (data.File != null)
                {
                    string extension = Path.GetExtension(data.File.FileName).ToLower();
                    if (extension == ".jpeg" || extension == ".jpg" || extension == ".png")
                    {
                        data.ScanDocument = (data.EduId + data.File.FileName).ToLower();
                        //housePermitModel = _housePermitService.insertHousePermits(housePermit);
                        if (data != null)
                        {
                            string path = Server.MapPath("~\\img\\");
                            data.File.SaveAs(path + data.ScanDocument);
                        }
                    }
                    else
                    {
                        ModelState.AddModelError("InvalidImage", "The file you are trying to upload is not image.");
                        return(View());
                    }
                }
                int res = _empEducationService.UpdateEducation(data);
                ViewBag.Success = "Education of " + data.EmpCode + " has been updated";
                ModelState.Clear();
                return(View(jtd));
            }
            else
            {
                ViewBag.Success = "Education already approved ";
                return(View(jtd));
            }
        }
Exemplo n.º 5
0
 public void Add(EmpEducationDTO DTO)
 {
     using (var container = new InventoryContainer())
     {
         EmpEducation gur = new EmpEducation();
         container.EmpEducations.AddObject((EmpEducation)DTOMapper.DTOObjectConverter(DTO, gur));
         container.SaveChanges();
     }
 }
        public ActionResult EducationDetail(string id)
        {
            EmpEducationDTO empDetails = new EmpEducationDTO();
            int             empCode    = Convert.ToInt32(Session["EmpCode"]);

            ListOfDatas(empCode);
            int expId = Convert.ToInt32(id);

            empDetails = _empEducationService.GetEducationByEduId(expId);

            return(View(empDetails));
        }
Exemplo n.º 7
0
        public ActionResult EducationEdit(EmpEducationDTO data)
        {
            data.PassedDate = !string.IsNullOrEmpty(data.PassedDateNP) ? Convert.ToDateTime(NepEngDate.NepToEng(data.PassedDateNP)) : data.PassedDate;

            if (!ViewBag.AllowEdit)
            {
                ViewBag.Error = "You are not Authorize to use this Page";
                return(PartialView("_partialviewNotFound"));
            }
            try
            {
                ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu(data.EmpCode);
                List <SelectListItem> educationLevel = new List <SelectListItem>();
                foreach (var row in _educationLevel.GetEducationLevel())
                {
                    educationLevel.Add(new SelectListItem
                    {
                        Text  = row.LevelName,
                        Value = row.LevelId.ToString()
                    });
                }
                IEnumerable <SelectListItem> countries = _countryService.GetCountryList();
                ViewBag.Countries      = countries;
                ViewBag.EducationLevel = educationLevel;
                ViewBag.EmployeeDetail = _empDetails.GetEmployeeDetails(data.EmpCode);
                if (!ModelState.IsValid)
                {
                    return(View("../Employee/Education/EducationEdit", data));
                }
                int res = _empEducationService.UpdateEducation(data);
                if (res > 0)
                {
                    ViewBag.Success = "Education updated successfully";
                }
                else
                {
                    ViewBag.Error = "Couldn't update";
                }
                return(Redirect("/education/" + data.EmpCode));
            }
            catch (Exception ex)
            {
                ViewBag.EmployeeDetail = _empDetails.GetEmployeeDetails(data.EmpCode);
                ViewBag.SideBar        = _moduleService.AdminEmployeeDetailsMenu(data.EmpCode);
                ViewBag.Error          = ex.Message;
                return(View("../Employee/Education/EducationEdit", data));
            }
        }
        public ActionResult AddEducation(EmpEducationDTO data)
        {
            data.PassedDate = Convert.ToDateTime(NepEngDate.NepToEng(data.PassedDateNP));
            data.EmpCode    = Convert.ToInt32(Session["EmpCode"]);

            List <SelectListItem> educationLevel = new List <SelectListItem>();

            foreach (var row in _educationLevel.GetEducationLevel())
            {
                educationLevel.Add(new SelectListItem
                {
                    Text  = row.LevelName,
                    Value = row.LevelId.ToString()
                });
            }
            IEnumerable <SelectListItem> CountryList = _countryService.GetCountryList();

            ViewBag.Countries      = CountryList;
            ViewBag.EducationLevel = educationLevel;
            //ViewBag.EmployeeDetail = _empDetails.GetEmployeeDetails(id);
            //ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu(id);
            try
            {
                if (!ModelState.IsValid)
                {
                    ModelState.AddModelError("Error", "Please Fill up all required field");
                    return(View());
                }
                EmpEducationDTO res = new EmpEducationDTO();
                //data.EmpCode = id;
                res             = _empEducationService.InsertEmpEducation(data);
                ViewBag.Success = "Education added";
                return(View());
            }
            catch (Exception ex)
            {
                //ViewBag.EmployeeDetail = _empDetails.GetEmployeeDetails(id);
                //ViewBag.SideBar = _moduleService.AdminEmployeeDetailsMenu(id);
                ViewBag.Error = ex.Message;
                ModelState.AddModelError("Error", ex.Message);
                return(View(data));
            }
        }
Exemplo n.º 9
0
        public ActionResult EducationCreate(int id, EmpEducationDTO data)
        {
            data.PassedDate = !string.IsNullOrEmpty(data.PassedDateNP) ? Convert.ToDateTime(NepEngDate.NepToEng(data.PassedDateNP)) : data.PassedDate;
            List <SelectListItem> educationLevel = new List <SelectListItem>();

            foreach (var row in _educationLevel.GetEducationLevel())
            {
                educationLevel.Add(new SelectListItem
                {
                    Text  = row.LevelName,
                    Value = row.LevelId.ToString()
                });
            }
            IEnumerable <SelectListItem> CountryList = _countryService.GetCountryList();

            ViewBag.Countries      = CountryList;
            ViewBag.EducationLevel = educationLevel;
            ViewBag.EmployeeDetail = _empDetails.GetEmployeeDetails(id);
            ViewBag.SideBar        = _moduleService.AdminEmployeeDetailsMenu(id);
            try
            {
                if (ModelState.IsValid)
                {
                    ModelState.AddModelError("Error", "Please Fill up all required field");
                    return(RedirectToAction("EducationList" + id));
                }
                EmpEducationDTO res = new EmpEducationDTO();
                data.EmpCode    = id;
                res             = _empEducationService.InsertEmpEducation(data);
                ViewBag.Success = "Education added";
                return(Redirect("/Education/" + data.EmpCode));
            }
            catch (Exception ex)
            {
                ViewBag.EmployeeDetail = _empDetails.GetEmployeeDetails(id);
                ViewBag.SideBar        = _moduleService.AdminEmployeeDetailsMenu(id);
                ViewBag.Error          = ex.Message;
                ModelState.AddModelError("Error", ex.Message);
                return(View("../Employee/Education/EducationCreate", data));
            }
        }
Exemplo n.º 10
0
        public ActionResult AddEducation()
        {
            EmpEducationDTO employeeEducation = new EmpEducationDTO();

            employeeEducation.CountryList = _empEducationService.GetCountryList();
            List <SelectListItem> educationLevel = new List <SelectListItem>();

            foreach (var row in _educationLevel.GetEducationLevel())
            {
                educationLevel.Add(new SelectListItem
                {
                    Text  = row.LevelName,
                    Value = row.LevelId.ToString()
                });
            }
            IEnumerable <SelectListItem> CountryList = _countryService.GetCountryList();

            ViewBag.EducationLevel = educationLevel;
            ViewBag.Countries      = CountryList;
            return(View(employeeEducation));
        }
Exemplo n.º 11
0
        public ActionResult EditEducation(int id)
        {
            EmpEducationDTO res = new EmpEducationDTO();

            res = _empEducationService.GetEducationByEduId(id);
            res.PassedDateNP = NepEngDate.EngToNep(Convert.ToDateTime(res.PassedDate));
            List <SelectListItem> educationLevel = new List <SelectListItem>();

            foreach (var row in _educationLevel.GetEducationLevel())
            {
                educationLevel.Add(new SelectListItem
                {
                    Text  = row.LevelName,
                    Value = row.LevelId.ToString()
                });
            }
            IEnumerable <SelectListItem> CountryList = _countryService.GetCountryList();

            ViewBag.EducationLevel = educationLevel;
            ViewBag.Countries      = CountryList;
            return(View(res));
        }
Exemplo n.º 12
0
        public static EmployeeEducation ConvertRespondentInfoFromDTO(EmpEducationDTO employeeEducationDTO)
        {
            Mapper.CreateMap <EmpEducationDTO, EmployeeEducation>().ConvertUsing(

                m =>
            {
                return(new EmployeeEducation
                {
                    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 <EmpEducationDTO, EmployeeEducation>(employeeEducationDTO));
        }
Exemplo n.º 13
0
        public EmpEducationDTO InsertEmpEducation(EmpEducationDTO data)
        {
            EmployeeEducation dataToInsert = EmpEducationRequestFormatter.ConvertRespondentInfoFromDTO(data);

            return(EmpEducationRequestFormatter.ConvertRespondentInfoToDTO(_unitOfWork.EmployeeEducationRepository.Create(dataToInsert)));
        }
Exemplo n.º 14
0
 public void Edit(EmpEducationDTO EduDTO)
 {
     EDuDAL.Edit(EduDTO);
 }
Exemplo n.º 15
0
 public void Add(EmpEducationDTO DTO)
 {
     EDuDAL.Add(DTO);
 }