private void getEduDetailsbutton_Click(object sender, EventArgs e) { try { IApplicantEducationalDetails _studentEduDetails = new StudentEducationDetails(); _studentID = 700; EducationDetails _resultEduDetails = _studentEduDetails.GetStudentEduDetailsBy(_studentID); undergradUniversityTextbox.Text = _resultEduDetails.UnderGrad_University; undergraduateStreamTextbox.Text = _resultEduDetails.UnderGrad_Department; undergraduateYearTextBox.Text = Convert.ToString(_resultEduDetails.UnderGrad_Year); undergraduateGpaTextbox.Text = Convert.ToString(_resultEduDetails.UnderGrad_GPA); graduateUniversityTextBox.Text = _resultEduDetails.Graduation_University; graduationStreamTextBox.Text = _resultEduDetails.Graduation_Department; graduationYearTextBox.Text = Convert.ToString(_resultEduDetails.Graduation_Year); graduationGpaTextbox.Text = Convert.ToString(_resultEduDetails.Graduation_GPA); if (!string.IsNullOrEmpty(_resultEduDetails.GRE_Score.ToString())) { greTextbox.Text = Convert.ToString(_resultEduDetails.GRE_Score); } if (!string.IsNullOrEmpty(_resultEduDetails.IELTS_Score.ToString())) { ieltstoeflTextbox.Text = Convert.ToString(_resultEduDetails.IELTS_Score); } } catch (Exception Ex) { MessageBox.Show(Ex.Message); } }
public HttpResponseMessage insertEducationDetails(EducationDetails educationData) { var data = _infoHandleManafer.insertEducationDetails(educationData); HttpResponseMessage response = Request.CreateResponse <object>(HttpStatusCode.OK, data); return(response); }
public List <EducationDetails> getEducationDetails_byCId(int cId) { _param = new SqlParameter[] { new SqlParameter("@cId", cId) }; _dt = _sf.returnDTWithProc_executeReader("p_tblEducationDetails_get_byCId", _param); List <EducationDetails> listEduDetail = new List <EducationDetails>(); if (_dt.Rows.Count > 0) { foreach (DataRow row in _dt.Rows) { EducationDetails ed = new EducationDetails(); ed.eduId = Convert.ToInt32(row["eduId"]); ed.institute = Convert.ToString(row["institute"]); ed.departmant = Convert.ToString(row["departmant"]); ed.degree = Convert.ToString(row["degree"]); ed.currentlyPursuing = Convert.ToBoolean(row["currentlyPursuing"]); ed.fromMonth = Convert.ToString(row["fromMonth"]); ed.fromYear = Convert.ToInt32(row["fromYear"]); ed.toMonth = Convert.ToString(row["toMonth"]); ed.toYear = Convert.ToInt32(row["toYear"]); listEduDetail.Add(ed); } } return(listEduDetail); }
private void eduDetailsSaveButton_Click(object sender, EventArgs e) { try { IApplicantEducationalDetails _studentData = new StudentEducationDetails(); EducationDetails eduDetails = new EducationDetails(); eduDetails.StudentId = _studentID; eduDetails.UnderGrad_University = (string.IsNullOrEmpty(undergraduateGpaTextbox.Text) == false) ? undergradUniversityTextbox.Text : "NA"; eduDetails.UnderGrad_Department = (string.IsNullOrEmpty(undergraduateStreamTextbox.Text) == false) ? undergraduateStreamTextbox.Text : "NA"; eduDetails.UnderGrad_Year = (string.IsNullOrEmpty(undergraduateYearTextBox.Text) == false) ? Convert.ToInt32(undergraduateYearTextBox.Text) : 0; eduDetails.UnderGrad_GPA = (string.IsNullOrEmpty(undergraduateGpaTextbox.Text) == false) ? Convert.ToDecimal(undergraduateGpaTextbox.Text) : 0.0m; eduDetails.Graduation_University = (string.IsNullOrEmpty(graduateUniversityTextBox.Text) == false) ? graduateUniversityTextBox.Text : "NA"; eduDetails.Graduation_Department = (string.IsNullOrEmpty(graduationStreamTextBox.Text) == false) ? graduationStreamTextBox.Text : "NA"; eduDetails.Graduation_Year = (string.IsNullOrEmpty(graduationYearTextBox.Text) == true) ? 0 : Convert.ToInt32(graduationYearTextBox.Text); eduDetails.Graduation_GPA = (string.IsNullOrEmpty(graduationGpaTextbox.Text) == true) ? 0.0m : Convert.ToDecimal(graduationGpaTextbox.Text); eduDetails.GRE_Score = (string.IsNullOrEmpty(greTextbox.Text) == true) ? 0.0m : Convert.ToDecimal(greTextbox.Text); eduDetails.IELTS_Score = (string.IsNullOrEmpty(ieltstoeflTextbox.Text) == true) ? 0.0m : Convert.ToDecimal(ieltstoeflTextbox.Text); var _numberOfRowsEffected = _studentData.insertEducationDetails(eduDetails); if (_numberOfRowsEffected > 0) { MessageBox.Show("Details Submitted Successfully"); } else { MessageBox.Show("Details not Submitted Successfully, Please contact administrator"); } } catch (Exception ex) { MessageBox.Show("Exception Occured in Education Details Tab: " + ex.Message); } }
//Add new Education on the Profile page public void AddEducationOnProfile(EducationDetails educationObj) { //Click on AddNew button AddNewEducation.Click(); //Enter Name of College driver.WaitForElementIsVisible(CollegeName); CollegeName.SendKeys(educationObj.University); //Select Country of College SelectElement selectCountry = new SelectElement(CollegeCountry); selectCountry.SelectByValue(educationObj.Country); //Select Title of Education SelectElement selectTitle = new SelectElement(EducationTitle); selectTitle.SelectByValue(educationObj.Title); //Enter Degree of Education EducationDegree.SendKeys(educationObj.Degree); //Select Year of Graduation SelectElement selectYear = new SelectElement(EducationYear); selectYear.SelectByValue(educationObj.Year); //Click on Add button to add Education data AddButton.Click(); }
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)); }
public bool EducationDetails(EducationDetails req) { try { _context.EducationDetails.Add(req); _context.SaveChanges(); return(true); } catch { return(false); } }
public string UpDateStudentEduDetails(EducationDetails studentEduDetail) { try { SqlCommand _userSqlCommand = new SqlCommand(); _userSqlCommand.Connection = _studentDatabaseConnection.OpenSQlDatabaseConnection(); string _userCommandText = @"Update Student_Education set UnderGrad_Department = @UnderGradDepartment, UnderGrad_Year = @UnderGradYear, UnderGrad_University = @UnderGradUniversity, UnderGrad_GPA = @UnderGradGPA, Graduation_Department = @GraduationDepartment , Graduation_Year = @GraduationYear , Graduation_University = @GraduationUniversity , Graduation_GPA = @GraduationGPA , GRE_Score = @GREScore , IELTS_Score = @IELTSScore where StudentId = @StudentId "; _userSqlCommand.CommandText = _userCommandText; _userSqlCommand.Parameters.AddWithValue("@StudentId", studentEduDetail.StudentId); _userSqlCommand.Parameters.AddWithValue("@UnderGradDepartment", studentEduDetail.UnderGrad_Department); _userSqlCommand.Parameters.AddWithValue("@UnderGradYear", Convert.ToInt32(studentEduDetail.UnderGrad_Year)); _userSqlCommand.Parameters.AddWithValue("@UnderGradUniversity", studentEduDetail.UnderGrad_University); _userSqlCommand.Parameters.AddWithValue("@UnderGradGPA", Convert.ToDecimal(studentEduDetail.UnderGrad_GPA)); _userSqlCommand.Parameters.AddWithValue("@GraduationDepartment", studentEduDetail.Graduation_Department); _userSqlCommand.Parameters.AddWithValue("@GraduationYear", Convert.ToInt16(studentEduDetail.Graduation_Year)); _userSqlCommand.Parameters.AddWithValue("@GraduationUniversity", studentEduDetail.Graduation_University); _userSqlCommand.Parameters.AddWithValue("@GraduationGPA", Convert.ToDecimal(studentEduDetail.Graduation_GPA)); _userSqlCommand.Parameters.AddWithValue("@GREScore", Convert.ToDecimal(studentEduDetail.GRE_Score)); _userSqlCommand.Parameters.AddWithValue("@IELTSScore", Convert.ToDecimal(studentEduDetail.IELTS_Score)); _userSqlCommand.ExecuteNonQuery(); return("Education details Updated successfully"); } catch (Exception Ex) { throw Ex; } finally { _studentDatabaseConnection.CloseSqlDatabaseConnection(); } }
public EducationDetails GetEducationDetails(int ID) { EducationalInfo E = _db.EducationalInfo.First(x => x.Id == ID); EducationDetails ED = new EducationDetails { Id = E.Id, percentage = E.percentage, College = E.College, backlogs = E.backlogs, Specialization = E.Specialization, YOS = E.YOS }; return(ED); }
public EducationDetails GetStudentEduDetailsBy(int Id) { try { SqlCommand _userSqlCommand = new SqlCommand(); string _userCommandText = @"select *from Student_Education where StudentId = @StudentId "; _userSqlCommand.Connection = _studentDatabaseConnection.OpenSQlDatabaseConnection(); _userSqlCommand.CommandText = _userCommandText; _userSqlCommand.Parameters.AddWithValue("@StudentId", Id); SqlDataReader _resultStudentEduDetails = _userSqlCommand.ExecuteReader(); EducationDetails _studentEduDetails = new EducationDetails(); while (_resultStudentEduDetails.Read()) { _studentEduDetails.UnderGrad_Department = _resultStudentEduDetails["UnderGrad_Department"].ToString(); _studentEduDetails.UnderGrad_Year = (int)_resultStudentEduDetails["UnderGrad_Year"]; _studentEduDetails.UnderGrad_University = _resultStudentEduDetails["UnderGrad_University"].ToString(); _studentEduDetails.UnderGrad_GPA = Convert.ToDecimal(_resultStudentEduDetails["UnderGrad_GPA"]); // if (!string.IsNullOrEmpty(_resultStudentEduDetails["AddressL2"].ToString())) { _studentDetails.AddressL2 = _resultStudentEduDetails["AddressL2"].ToString(); } _studentEduDetails.Graduation_Department = _resultStudentEduDetails["Graduation_Department"].ToString(); _studentEduDetails.Graduation_Year = (int)_resultStudentEduDetails["Graduation_Year"]; _studentEduDetails.Graduation_University = _resultStudentEduDetails["Graduation_University"].ToString(); _studentEduDetails.Graduation_GPA = Convert.ToDecimal(_resultStudentEduDetails["Graduation_GPA"]); _studentEduDetails.GRE_Score = Convert.ToDecimal(_resultStudentEduDetails["GRE_Score"].ToString()); _studentEduDetails.IELTS_Score = Convert.ToDecimal(_resultStudentEduDetails["IELTS_Score"].ToString()); } return(_studentEduDetails); } catch (Exception Ex) { throw Ex; } finally { _studentDatabaseConnection.CloseSqlDatabaseConnection(); } }
public void AddEducation() { //Populate Education Excel data in Collection GlobalDefinitions.ExcelLib.PopulateInCollection(Base.excelPath, "Education"); EducationDetails educationDetailsobj = new EducationDetails(); educationDetailsobj.University = GlobalDefinitions.ExcelLib.ReadData(2, "University"); educationDetailsobj.Country = GlobalDefinitions.ExcelLib.ReadData(2, "Country"); educationDetailsobj.Title = GlobalDefinitions.ExcelLib.ReadData(2, "Title"); educationDetailsobj.Degree = GlobalDefinitions.ExcelLib.ReadData(2, "Degree"); educationDetailsobj.Year = GlobalDefinitions.ExcelLib.ReadData(2, "Year"); Profile profileObj = new Profile(); profileObj.ClickOnEducationTab(); profileObj.AddEducationOnProfile(educationDetailsobj); Assert.AreEqual("Education has been added", profileObj.GetPopUpMsg()); profileObj.ClosePopUp(); }
public int insertEducationDetails(EducationDetails eduDetails) { try { SqlCommand _userSqlCommand = new SqlCommand(); _userSqlCommand.Connection = _studentDatabaseConnection.OpenSQlDatabaseConnection(); string _userCommandText = @"Insert INTO Student_Education ( StudentId, UnderGrad_Department, UnderGrad_Year, UnderGrad_University, UnderGrad_GPA, Graduation_Department, Graduation_Year, Graduation_University, Graduation_GPA , GRE_Score, IELTS_Score ) values( @StudentId , @UnderGradDepartment, @UnderGradYear, @UnderGradUniversity, @UnderGradGPA, @GraduationDepartment, @GraduationYear, @GraduationUniversity,@GraduationGPA ,@GREScore, @IELTSScore) "; _userSqlCommand.CommandText = _userCommandText; _userSqlCommand.Parameters.AddWithValue("@StudentId", eduDetails.StudentId); _userSqlCommand.Parameters.AddWithValue("@UnderGradDepartment", eduDetails.UnderGrad_Department); _userSqlCommand.Parameters.AddWithValue("@UnderGradYear", Convert.ToInt32(eduDetails.UnderGrad_Year)); _userSqlCommand.Parameters.AddWithValue("@UnderGradUniversity", eduDetails.UnderGrad_University); _userSqlCommand.Parameters.AddWithValue("@UnderGradGPA", Convert.ToDecimal(eduDetails.UnderGrad_GPA)); _userSqlCommand.Parameters.AddWithValue("@GraduationDepartment", eduDetails.Graduation_Department); _userSqlCommand.Parameters.AddWithValue("@GraduationYear", Convert.ToInt16(eduDetails.Graduation_Year)); _userSqlCommand.Parameters.AddWithValue("@GraduationUniversity", eduDetails.Graduation_University); _userSqlCommand.Parameters.AddWithValue("@GraduationGPA", Convert.ToDecimal(eduDetails.Graduation_GPA)); _userSqlCommand.Parameters.AddWithValue("@GREScore", Convert.ToDecimal(eduDetails.GRE_Score)); _userSqlCommand.Parameters.AddWithValue("@IELTSScore", Convert.ToDecimal(eduDetails.IELTS_Score)); return(_userSqlCommand.ExecuteNonQuery()); } catch (Exception Ex) { throw; } finally { _studentDatabaseConnection.CloseSqlDatabaseConnection(); } }
private void updateEduDetailsbutton_Click(object sender, EventArgs e) { try { IApplicantEducationalDetails _updateStudentEduData = new StudentEducationDetails(); EducationDetails eduDetails = new EducationDetails(); eduDetails.StudentId = _studentID; eduDetails.UnderGrad_University = undergradUniversityTextbox.Text; eduDetails.UnderGrad_Department = undergraduateStreamTextbox.Text; eduDetails.UnderGrad_Year = Convert.ToInt32(undergraduateYearTextBox.Text); eduDetails.UnderGrad_GPA = Convert.ToDecimal(undergraduateGpaTextbox.Text); eduDetails.Graduation_University = graduateUniversityTextBox.Text; eduDetails.Graduation_Department = graduationStreamTextBox.Text; eduDetails.Graduation_Year = Convert.ToInt32(graduationYearTextBox.Text); eduDetails.Graduation_GPA = Convert.ToDecimal(graduationGpaTextbox.Text); if (!string.IsNullOrEmpty(greTextbox.Text) && !string.IsNullOrEmpty(ieltstoeflTextbox.Text)) { eduDetails.GRE_Score = Convert.ToDecimal(greTextbox.Text); eduDetails.IELTS_Score = Convert.ToDecimal(ieltstoeflTextbox.Text); } else { eduDetails.GRE_Score = 0.00m; eduDetails.IELTS_Score = 0.00m; } _updateStudentEduData.UpDateStudentEduDetails(eduDetails); MessageBox.Show("Details Submitted Successfully"); } catch (Exception ex) { MessageBox.Show("Exception Occured in details Updating education details tab " + ex.Message); } }
public ActionResult GetEducationalDetailsGrid(int userId) { //Models.EducationDetails EducationModel = new EducationDetails(); //EducationModel.EducationalDetailsList = EducationListPagedList(userId); //return View("_GetEducationList", EducationModel.EducationalDetailsList); 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(); EducationDetails educationModel = new EducationDetails(); List <EmployeeEducationDetail> list = _IEducationService.GetEmployeeEducationDetailsByUserID(userId); educationModel.educationDetialslist = list .Select(x => new EducationDetails() { EduDetID = x.EduDetID, UserId = x.UserID, FromDate = x.FromDate, EducationCategoryId = x.EducationCategoryID, OtherEducationCategory = x.OtherEducationCategory, ToDate = x.ToDate, BreaksDuringEducation = x.BreaksDuringEducation, ClassId = x.ClassID, TypeofDegreeDeplomaId = x.DisciplineID, OtherDiscipline = x.OtherDiscipline, PassingYear = x.PassingYear, OtherSpecialization = x.OtherSpecialization, InstituteNameId = x.CollegeID, OtherCollegeName = x.OtherCollegeName, University_BoardNameId = x.UniversityID, OtherUniversityName = x.OtherUniversityName, Percentage = x.Percentage, UniversityList = GetUniversityList(x.EducationCategoryID) }).OrderByDescending(x => x.PassingYear).ToList(); foreach (var item in educationModel.educationDetialslist) { if (item.EducationCategoryId == 0) { item.EducationCategory = item.OtherEducationCategory; } else { item.EducationCategory = (from pair in ViewBag.EducationCategory as SelectList where pair.Value == item.EducationCategoryId.ToString() select pair.Text).FirstOrDefault(); } } ViewBag.EducationCategoryForUser = GetEducationCategoryByEducationId(userId); var userDetails = _IUserService.GetById(userId); ViewBag.IsSubmitted = userDetails == null ? false : userDetails.IsSubmitted.HasValue && userDetails.IsSubmitted.Value == true; return(View("_GetEducationList", educationModel)); }
public EducationDetails insertEducationDetails(EducationDetails data) { return(_educationDetailsRepository.insertEducationDetails(data)); }
public int saveEducationDetails(EducationDetails ed) { _param = new SqlParameter[] { new SqlParameter("@eduId", ed.eduId), new SqlParameter("@cId", ed.cId), new SqlParameter("@institute", ed.institute), new SqlParameter("@departmant", ed.departmant), new SqlParameter("@degree", ed.degree), new SqlParameter("@currentlyPursuing", ed.currentlyPursuing), new SqlParameter("@fromMonth", ed.fromMonth), new SqlParameter("@fromYear", ed.fromYear), new SqlParameter("@toMonth", ed.toMonth), new SqlParameter("@toYear", ed.toYear) }; return(_sf.executeNonQueryWithProc("p_tblEducationDetails_save", _param)); }
private EducationDetails GetEducations(int constituentId) { var educationDetailsData = HttpHelper.Get<EducationDetailsData>(string.Format(serviceBaseUri + "/EducationDetails?ConstituentId={0}", constituentId)); mapper = new AutoDataContractMapper(); var educations = new EducationDetails(); mapper.MapList(educationDetailsData, educations, typeof(EducationDetail)); return educations; }
private void SaveUser(RegisterFormModel rfm) { var fileName = DateTime.Now.ToString("yyyymmddMMss") + rfm.PersonalDetail.FirstName + rfm.PersonalDetail.LastName + System.IO.Path.GetExtension(rfm.PersonalDetail.ResumeFile.FileName); //datetime needed? var user = new User() { FirstName = rfm.PersonalDetail.FirstName, LastName = rfm.PersonalDetail.LastName, Password = rfm.PersonalDetail.Password, //must encrypt Email = rfm.PersonalDetail.Email, ContactNumber = rfm.PersonalDetail.ContactNumber, Role = _context.Role.First(ut => ut.Type == "JobSeeker"), ResumeFileName = fileName, DOB = rfm.PersonalDetail.DOB, CreatedDate = DateTime.Now }; _context.User.Add(user); SaveFile(rfm.PersonalDetail.ResumeFile, fileName); foreach (var ed in rfm.ExperienceDetails) { var experienceDetail = new ExperienceDetails() { Seeker = user, CompanyName = ed.CompanyName, JobTitle = ed.JobTitle, StartDate = ed.StartDate, EndDate = ed.EndDate, Type = ed.Type }; _context.ExperienceDetails.Add(experienceDetail); _context.SaveChanges(); foreach (var skill in ed.SkillId) { //experienceDetail.Skills.Add(new Skill() { Id = Convert.ToInt32(skill) }); _context.UserExperienceSkill.Add(new UserExperienceSkill { SeekerId = user.Id, ExperienceDetailId = experienceDetail.Id, SkillId = Convert.ToInt32(skill) }); } } var eduDetail = new EducationDetails() { Seeker = user, HighestQualification = rfm.EducationDetail.HighestQualification, InstituteOrUniversityName = rfm.EducationDetail.InstituteOrUniversityName, MajorBranch = rfm.EducationDetail.MajorBranch, Percentage = rfm.EducationDetail.Percentage, EducationTypeId = Convert.ToInt32(rfm.EducationDetail.Type) }; _context.EducationDetails.Add(eduDetail); _context.SaveChanges(); }
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)); } }