Exemplo n.º 1
0
        public ActionResult AddEditEducationDetails(int EducationId = 0, bool IsReadOnly = false)
        {
            ViewBag.Classes           = GetClasses();
            ViewBag.Discipline        = GetDiscipline(0);
            ViewBag.Colleges          = GetColleges();
            ViewBag.EducationCategory = GetEducationCategory();
            ViewBag.Specialization    = GetSpecialization();
            ViewBag.University        = GetUniversity();
            ViewBag.Months            = GetMonths();
            ViewBag.Years             = GetYears();

            ViewBag.IsReadOnly = IsReadOnly;
            ViewBag.IsEditPage = false;
            if (System.Web.HttpContext.Current.Request.IsAuthenticated)
            {
                userId   = Convert.ToInt32(System.Web.HttpContext.Current.User.Identity.Name.Split('|')[1]);
                userName = System.Web.HttpContext.Current.User.Identity.Name.Split('|')[0];

                //var res = user.Where(u => u.Password == details.Password && u.Email.ToLower() == details.Email.ToLower()).SingleOrDefault();
                var eduDetails_lst = _IEducationService.GetAll(null, null, "");
                Session["eduDetails_lst"] = eduDetails_lst;

                var obj = eduDetails_lst.Where(u => u.UserID == userId && u.EduDetID == EducationId).FirstOrDefault();
                if (obj != null)
                {
                    _educationDetails = obj;
                }
            }
            Models.EducationDetails model = new EducationDetails();
            if (EducationId != 0)
            {
                Mapper.CreateMap <Data.EmployeeEducationDetail, Models.EducationDetails>();
                model = Mapper.Map <Data.EmployeeEducationDetail, Models.EducationDetails>(_educationDetails);

                //By Sachin Khot
                //model.EducationCategoryId = Convert.ToInt32(model.EducationCategory);
                model.EducationCategoryId = Convert.ToInt32(model.EducationCategoryId);
                //model.InstituteNameId = Convert.ToInt32(model.InstituteName);
                model.InstituteNameId = Convert.ToInt32(model.CollegeID);
                //model.University_BoardNameId = Convert.ToInt32(model.University_BoardName);
                model.University_BoardNameId = Convert.ToInt32(model.UniversityID);
                //model.ClassId = Convert.ToInt32(model.Class);
                model.ClassId = Convert.ToInt32(model.ClassId);

                //ViewBag.Discipline = GetDiscipline(Convert.ToInt32(model.TypeofDegreeDeploma));
                ViewBag.Discipline = GetDiscipline(Convert.ToInt32(model.DisciplineID));

                //model.TypeofDegreeDeplomaId = Convert.ToInt32(model.TypeofDegreeDeploma);
                model.TypeofDegreeDeplomaId = Convert.ToInt32(model.DisciplineID);

                //model.SpecializationId = Convert.ToInt32(model.Specialization);
                model.SpecializationId = Convert.ToInt32(model.SpecializationId);
                ViewBag.IsEditPage     = true;
            }
            //Mapper.CreateMap<List<GetEducationList_Result>, List<EducationDetailsHistory>>();

            //user.EducationalDetailsList = EducationListPagedList(userId);
            return(View("EducationalDetails", model));
        }
Exemplo n.º 2
0
 public bool UpdateEmployeeEducation(EmployeeEducationDetail obj)
 {
     using (var context = new IPDEntities())
     {
         //db.SaveChanges();
         var local = context.EmployeeEducationDetails.Find(obj.EduDetID);
         context.Entry(local).CurrentValues.SetValues(obj);
         context.Entry(local).State = EntityState.Modified;
         bool status = Save();
         return(status);
     }
 }
Exemplo n.º 3
0
        public ActionResult EducationalDetails(string EducationCategoryId = "1")
        {
            ViewBag.Classes           = GetClasses();
            ViewBag.Discipline        = GetDiscipline(0);
            ViewBag.Colleges          = GetColleges();
            ViewBag.EducationCategory = GetEducationCategory();
            ViewBag.Specialization    = GetSpecialization();
            ViewBag.University        = GetUniversity();
            ViewBag.Months            = GetMonths();
            ViewBag.Years             = GetYears();

            if (System.Web.HttpContext.Current.Request.IsAuthenticated)
            {
                userId   = Convert.ToInt32(System.Web.HttpContext.Current.User.Identity.Name.Split('|')[1]);
                userName = System.Web.HttpContext.Current.User.Identity.Name.Split('|')[0];

                var eduDetails_lst = _IEducationService.GetAll(null, null, "");
                Session["eduDetails_lst"] = eduDetails_lst;

                var obj = eduDetails_lst.Where(u => u.UserID == userId && u.EducationCategoryID == Convert.ToInt16(EducationCategoryId)).FirstOrDefault();
                if (obj != null)
                {
                    _educationDetails = obj;
                }
            }

            Mapper.CreateMap <Data.EmployeeEducationDetail, Models.EducationDetails>();
            var user = Mapper.Map <Data.EmployeeEducationDetail, Models.EducationDetails>(_educationDetails);

            //Commented by Sachin khot
            //user.EducationCategoryId = Convert.ToInt32(user.EducationCategory);
            //user.InstituteNameId = Convert.ToInt32(user.InstituteName);
            //user.University_BoardNameId = Convert.ToInt32(user.University_BoardName);
            //user.ClassId = Convert.ToInt32(user.Class);
            //user.TypeofDegreeDeplomaId = Convert.ToInt32(user.TypeofDegreeDeploma);
            //user.SpecializationId = Convert.ToInt32(user.Specialization);

            //Update Code by Sachin Khot

            user.EducationCategoryId    = Convert.ToInt32(user.EducationCategoryId);
            user.InstituteNameId        = Convert.ToInt32(user.InstituteNameId);
            user.University_BoardNameId = Convert.ToInt32(user.University_BoardNameId);
            user.ClassId = Convert.ToInt32(user.ClassId);
            user.TypeofDegreeDeplomaId = Convert.ToInt32(user.TypeofDegreeDeplomaId);
            user.SpecializationId      = Convert.ToInt32(user.SpecializationId);

            //Mapper.CreateMap<List<GetEducationList_Result>, List<EducationDetailsHistory>>();

            //user.EducationalDetailsList = EducationListPagedList(userId);
            return(View("NewEducationDetails", user));
        }
Exemplo n.º 4
0
 public EducationController(IUserService IUserService, IEducationService IEducationService, IClassService IClassService, ICollegeService ICollegeService, IDisciplineService IDisciplineService,
                            IEducationCategoryService IEducationCategoryService, ISpecializationService ISpecializationService, IUniversityService IUniversityService, IEducationCategoryUniversityBoardMappingService IEducationCategoryUniversityBoardMappingService)
 {
     this._IUserService      = IUserService;
     this._IEducationService = IEducationService;
     _educationDetails       = new EmployeeEducationDetail();
     this._IClassService     = IClassService;
     _class = new Master_Class();
     this._ICollegeService = ICollegeService;
     _college = new Master_College();
     this._IDisciplineService = IDisciplineService;
     _discipline = new Master_Discipline();
     this._IEducationCategoryService = IEducationCategoryService;
     _educationCategory           = new Master_EducationCategory();
     this._ISpecializationService = ISpecializationService;
     _specialization          = new Master_Specialization();
     this._IUniversityService = IUniversityService;
     _university = new Master_University();
     this._IEducationCategoryUniversityBoardMappingService = IEducationCategoryUniversityBoardMappingService;
     _educationCategoryUniversityBoardMapping = new EducationCategoryUniversityBoardMapping();
 }
Exemplo n.º 5
0
        public bool DeleteEducationDetail(int ID, string userName)
        {
            bool result;

            using (IPDEntities ctx = new IPDEntities())
            {
                try
                {
                    EmployeeEducationDetail educationdetail = ctx.EmployeeEducationDetails.Where(m => m.EduDetID == ID).FirstOrDefault();
                    educationdetail.IsActive    = false;
                    educationdetail.UpdatedDate = DateTime.UtcNow;
                    educationdetail.UpdatedBy   = userName;
                    ctx.SaveChanges();
                    result = true;
                }
                catch (Exception ex)
                {
                    result = false;
                }
            }
            return(result);
        }
Exemplo n.º 6
0
 public bool Update(EmployeeEducationDetail obj, string[] param, string spName)
 {
     return(_IEducationRepository.Update(obj, param, spName));
 }
Exemplo n.º 7
0
 public bool Insert(EmployeeEducationDetail obj, string[] param, string spName)
 {
     return(_IEducationRepository.Insert(obj, param, spName));
 }
Exemplo n.º 8
0
 public IEnumerable <EmployeeEducationDetail> GetAll(EmployeeEducationDetail obj, string[] param, string spName)
 {
     return(_IEducationRepository.GetAll(obj, param, spName));
 }
Exemplo n.º 9
0
        public ActionResult EducationalDetails(EducationDetails empdetails)
        {
            try
            {
                EducationDetails details = new EducationDetails();
                if (empdetails.educationDetialslist != null && empdetails.educationDetialslist.Count == 1)
                {
                    details = (EducationDetails)empdetails.educationDetialslist[0];
                }
                else
                {
                    details = empdetails;
                }

                details.EducationCategoryId    = details.EducationCategoryId;
                details.OtherEducationCategory = details.OtherEducationCategory;
                details.DisciplineID           = details.TypeofDegreeDeplomaId;
                details.OtherDiscipline        = details.OtherDiscipline;
                details.UniversityID           = details.University_BoardNameId;
                details.OtherUniversityName    = details.OtherUniversityName;
                details.ClassId          = details.ClassId;
                details.CollegeID        = details.InstituteNameId;
                details.OtherCollegeName = details.OtherCollegeName;
                details.SpecializationId = _ISpecializationService.GetAll(null, null, "").Where(i => i.Specialization == "Other").Select(x => x.SpecializationID).FirstOrDefault();
                if (!string.IsNullOrWhiteSpace(details.FromDate.ToString()) && !string.IsNullOrWhiteSpace(details.ToDate.ToString()))
                {
                    details.FromDate = details.FromDate;
                    details.ToDate   = details.ToDate;
                }

                bool   status   = false;
                string userName = null;
                ModelState.Remove("PassingMonth");
                ModelState.Remove("PassingYear");
                ModelState.Remove("Percentage");
                ModelState.Remove("AttndedToMonth");
                ModelState.Remove("AttndedToYear");

                //if (ModelState.IsValid)
                //{
                details.UserId = Convert.ToInt32(System.Web.HttpContext.Current.User.Identity.Name.Split('|')[1]);
                userName       = System.Web.HttpContext.Current.User.Identity.Name.Split('|')[0];

                details.UpdatedBy   = userName;
                details.UpdatedDate = DateTime.UtcNow;

                Mapper.CreateMap <EducationDetails, Data.EmployeeEducationDetail>();
                EmployeeEducationDetail eduDetail = Mapper.Map <EducationDetails, Data.EmployeeEducationDetail>(details);

                var obj       = _IEducationService.GetEmployeeEducationDetailsByUserID(Convert.ToInt32(details.UserId)); //educationList.Where(u => u.UserID == details.UserId).ToList();
                var objUpdate = obj.Where(u => u.UserID == details.UserId).ToList();

                if (obj != null)
                {
                    var overlappedRecord = obj.Where(u => Convert.ToDateTime(u.FromDate) <= Convert.ToDateTime(details.ToDate) && Convert.ToDateTime(details.FromDate) <= Convert.ToDateTime(u.ToDate) && u.IsActive == true && u.EduDetID != details.EduDetID).ToList();

                    if (overlappedRecord.Count > 0)
                    {
                        return(Json(new { result = false, Message = "Education duration should not fall between previous education duration." }, JsonRequestBehavior.AllowGet));
                    }

                    obj = obj.Where(u => u.UserID == details.UserId && u.EducationCategoryID == Convert.ToInt16(details.EducationCategoryId) &&
                                    u.CollegeID == details.InstituteNameId &&
                                    u.OtherSpecialization == Convert.ToString(details.OtherSpecialization) &&
                                    u.PassingYear == details.PassingYear && u.IsActive == true).ToList();
                }

                //check if user have alredy added record for this category
                if (obj.Count > 0 && details.EduDetID != obj.FirstOrDefault().EduDetID)
                {
                    return(Json(new { result = false, Message = "Data for this Education Category is already Added" }, JsonRequestBehavior.AllowGet));
                }
                //if (eduDetail.CreatedBy == null || eduDetail.CreatedBy == null)
                //    eduDetail.CreatedBy = userName;
                //if (eduDetail.CreatedDate == DateTime.MinValue || eduDetail.CreatedDate == null)
                //    eduDetail.CreatedDate = DateTime.UtcNow;

                if (details.EduDetID == 0)
                {
                    eduDetail.CreatedBy   = userName;
                    eduDetail.CreatedDate = DateTime.UtcNow;
                    eduDetail.UpdatedBy   = userName;
                    eduDetail.UpdatedDate = DateTime.UtcNow;
                    eduDetail.IsActive    = true;
                    status = _IEducationService.Insert(eduDetail, null, "");
                    return(Json(new { result = false, Message = "Success" }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    eduDetail.UpdatedBy   = userName;
                    eduDetail.UpdatedDate = DateTime.UtcNow;
                    eduDetail.IsActive    = true;
                    status = _IEducationService.Update(eduDetail, null, "");
                    return(Json(new { result = false, Message = "Success" }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception ex)
            {
                return(Json(new { result = false, Message = "Error" }, JsonRequestBehavior.AllowGet));
            }
        }