public ActionResult SaveLanguage(EmployeeLanguagesViewModel model)
        {
            var dataDetails = _db.Employee_Languages.Where(x => x.LanguageID == model.LanguageID && x.EmployeeID != model.EmployeeID).ToList();

            if (dataDetails.Count > 0)
            {
                return(Json("Error", JsonRequestBehavior.AllowGet));
            }
            else
            {
                if (model.Id == 0)
                {
                    Employee_Languages mm = new Employee_Languages();
                    mm.EmployeeID           = model.EmployeeID;
                    mm.LanguageID           = model.LanguageID;
                    mm.SpeakingID           = model.SpeakingID;
                    mm.ListeningID          = model.ListeningID;
                    mm.WritingID            = model.WritingID;
                    mm.ReadingID            = model.ReadingID;
                    mm.Archived             = false;
                    mm.Created              = DateTime.Now;
                    mm.LastModified         = DateTime.Now;
                    mm.UserIDCreatedBy      = SessionProxy.UserId;
                    mm.UserIDLastModifiedBy = SessionProxy.UserId;
                    _db.Employee_Languages.Add(mm);
                    _db.SaveChanges();
                }
                else
                {
                    var data = _db.Employee_Languages.Where(x => x.Id == model.Id).FirstOrDefault();
                    data.LanguageID           = model.LanguageID;
                    data.SpeakingID           = model.SpeakingID;
                    data.ListeningID          = model.ListeningID;
                    data.WritingID            = model.WritingID;
                    data.ReadingID            = model.ReadingID;
                    data.Archived             = false;
                    data.LastModified         = DateTime.Now;
                    data.UserIDLastModifiedBy = SessionProxy.UserId;
                    _db.SaveChanges();
                }
                EmployeeResumeViewModel models = AllDetailsList(model.EmployeeID);
                return(PartialView("_partialResumeDetailsList", models));
            }
        }
        public EmployeeResumeViewModel AllDetailsList(int EmployeeId)
        {
            EmployeeResumeViewModel modelList = new EmployeeResumeViewModel();

            modelList.EmployeeID = EmployeeId;
            var workdetails        = _db.Employee_Experiences.Where(x => x.EmployeeID == EmployeeId && x.Archived == false).ToList();
            var educationDetails   = _db.Employee_Educations.Where(x => x.EmployeeID == EmployeeId && x.Archived == false).ToList();
            var qualificationlist  = _db.Employee_Qualifications.Where(x => x.EmployeeID == EmployeeId && x.Archived == false).ToList();
            var laguageDetailsList = _db.Employee_Languages.Where(x => x.EmployeeID == EmployeeId && x.Archived == false).ToList();
            var resumeText         = _db.Employee_Resume.Where(x => x.EmployeeID == EmployeeId).FirstOrDefault();

            if (resumeText != null)
            {
                modelList.ResumeID   = resumeText.Id;
                modelList.ResumeText = resumeText.ResumeText;
            }
            if (workdetails.Count > 0)
            {
                foreach (var item in workdetails)
                {
                    EmployeeExperienceViewModel model = new EmployeeExperienceViewModel();
                    model.Id               = item.Id;
                    model.EmployeeID       = item.EmployeeID;
                    model.CompanyName      = item.CompanyName;
                    model.JobTitle         = item.JobTitle;
                    model.JobStartDate     = String.Format("{0:MMM-yyyy}", item.JobStartDate);
                    model.JobEndDate       = String.Format("{0:MMM-yyyy}", item.JobEndDate);
                    model.OtherInformation = item.OtherInformation;
                    modelList.WorkExperienceList.Add(model);
                }
            }
            if (educationDetails.Count > 0)
            {
                foreach (var item in educationDetails)
                {
                    EmployeeEducationsViewModel model = new EmployeeEducationsViewModel();
                    model.Id               = item.Id;
                    model.EmployeeID       = item.EmployeeID;
                    model.CourseName       = item.CourseName;
                    model.InstitutionName  = item.InstitutionName;
                    model.StartDate        = String.Format("{0:MMM-yyyy}", item.StartDate);
                    model.EndDate          = String.Format("{0:MMM-yyyy}", item.EndDate);
                    model.OtherInformation = item.OtherInformation;
                    modelList.EductionList.Add(model);
                }
            }
            if (qualificationlist.Count > 0)
            {
                foreach (var item in qualificationlist)
                {
                    EmployeeQualificationsViewModel model = new EmployeeQualificationsViewModel();
                    model.Id         = item.Id;
                    model.EmployeeID = item.EmployeeID;
                    model.Detail     = item.Detail;
                    modelList.QualificationList.Add(model);
                }
            }
            if (laguageDetailsList.Count > 0)
            {
                foreach (var item in laguageDetailsList)
                {
                    var languageName = _otherSettingMethod.getSystemListValueById((int)item.LanguageID);
                    //var SpeakingName = _otherSettingMethod.getSystemListValueById((int)item.SpeakingID);
                    //var ListeningName = _otherSettingMethod.getSystemListValueById((int)item.ListeningID);
                    //var WritingName = _otherSettingMethod.getSystemListValueById((int)item.WritingID);
                    //var ReadingName = _otherSettingMethod.getSystemListValueById((int)item.ReadingID);

                    EmployeeLanguagesViewModel model = new EmployeeLanguagesViewModel();
                    model.Id           = item.Id;
                    model.EmployeeID   = item.EmployeeID;
                    model.LanguageID   = (int)item.LanguageID;
                    model.LanguageName = languageName.Value;
                    modelList.LanguageDetailsList.Add(model);
                    //model.SpeakingID = (int)item.SpeakingID;
                    //model.SpeakingName = SpeakingName.Value;
                    //model.ListeningID = (int)item.ListeningID;
                    //model.ListeningName = ListeningName.Value;
                    //model.WritingID = (int)item.WritingID;
                    //model.WritingName = WritingName.Value;
                    //model.ReadingID = (int)item.ReadingID;
                    //model.ReadingName = ReadingName.Value;
                }
            }
            return(modelList);
        }
        public ActionResult AddEditLanguage(int Id, int employeeId)
        {
            EmployeeLanguagesViewModel model = new EmployeeLanguagesViewModel();
            var Languagelist    = _otherSettingMethod.getAllSystemValueListByKeyName("Language List");
            var ProficiencyList = _otherSettingMethod.getAllSystemValueListByKeyName("Language Proficiency List");

            if (Id == 0)
            {
                model.Id         = 0;
                model.EmployeeID = employeeId;
                foreach (var item in Languagelist)
                {
                    model.LanguageList.Add(new SelectListItem()
                    {
                        Text = item.Value, Value = item.Id.ToString()
                    });
                }
                foreach (var item in ProficiencyList)
                {
                    model.SpeakingList.Add(new SelectListItem()
                    {
                        Text = item.Value, Value = item.Id.ToString()
                    });
                }
                foreach (var item in ProficiencyList)
                {
                    model.ListeningList.Add(new SelectListItem()
                    {
                        Text = item.Value, Value = item.Id.ToString()
                    });
                }
                foreach (var item in ProficiencyList)
                {
                    model.WritingList.Add(new SelectListItem()
                    {
                        Text = item.Value, Value = item.Id.ToString()
                    });
                }
                foreach (var item in ProficiencyList)
                {
                    model.ReadingList.Add(new SelectListItem()
                    {
                        Text = item.Value, Value = item.Id.ToString()
                    });
                }
            }
            else
            {
                var data          = _db.Employee_Languages.Where(x => x.Id == Id).FirstOrDefault();
                var languageName  = _otherSettingMethod.getSystemListValueById((int)data.LanguageID);
                var SpeakingName  = _otherSettingMethod.getSystemListValueById((int)data.SpeakingID);
                var ListeningName = _otherSettingMethod.getSystemListValueById((int)data.ListeningID);
                var WritingName   = _otherSettingMethod.getSystemListValueById((int)data.WritingID);
                var ReadingName   = _otherSettingMethod.getSystemListValueById((int)data.ReadingID);
                model.Id           = data.Id;
                model.EmployeeID   = data.EmployeeID;
                model.LanguageID   = (int)data.LanguageID;
                model.LanguageName = languageName.Value;
                model.SpeakingID   = (int)data.SpeakingID;
                // model.SpeakingName = SpeakingName.Value;
                model.ListeningID = (int)data.ListeningID;
                //  model.ListeningName = ListeningName.Value;
                model.WritingID = (int)data.WritingID;
                //   model.WritingName = WritingName.Value;
                model.ReadingID = (int)data.ReadingID;
                //  model.ReadingName = ReadingName.Value;
            }
            return(PartialView("_partialAddEditLanguageDetails", model));
        }