public List <JobVm> Search(string keywords, int langId = 1) { var lookup = keywords.ToLower().Split(' '); using (var db = new LMISEntities()) { return(db.JobOffers .AsNoTracking() .Where(r => r.IsDeleted == null && r.JobStatus && r.IsApproved == (byte)Approval.Approved) .Select(a => new { Offer = a, TitleDesc = SqlUdf.SubCodeName(a.JobTiltleID, langId), TitleSearchable = SqlUdf.SubCodeSearchString(a.JobTiltleID, langId), Details = a.JobOfferDetails }) .Where(r => lookup.Any(q => r.TitleSearchable.ToLower().Contains(q))) .ToList() .Select(a => new JobVm { JobId = (long)a.Offer.JobOfferID, Title = a.TitleDesc, Description = (new GlobalString(a.Details.Select(d => new LocalString(d.LanguageID, d.JobDescription)).ToList())).Reduce(langId), EmploymentType = a.Offer.EmploymentTypeID, Country = a.Offer.CountryID, City = a.Offer.CityID }) .ToList()); } }
public UserCat GetUserCat(long portalUserId) { using (var db = new LMISEntities()) try { var cat = db.PortalUsers .Single(r => r.PortalUsersID == portalUserId) .UserCategory.Trim().ToLower(); switch (cat) { case "org": return(UserCat.Organization); case "ind": return(UserCat.Individual); } return(UserCat.Unknown); } catch (Exception) { return(UserCat.Unknown); } }
public List <CalendarVM> List(int langId) { List <CalendarVM> result; List <Event> resultEvent; List <Opportunity> resultOpportunity; using (var db = new LMISEntities()) { resultEvent = db.Events.Include(r => r.EventsDetails).Where(r => r.IsDeleted == null && r.IsApproved == 2 && r.StartDate.Year >= DateTime.Now.Year).ToList(); resultOpportunity = db.Opportunities.Include(r => r.OpportunitiesDetails).Where(r => r.IsDeleted == null && r.Is_Approved == 2 && r.StartDate.Year >= DateTime.Now.Year).ToList(); var resultTraning = db.TrainingOffers.Where(r => r.IsDeleted == null && r.Is_Approved == 2 && r.StartDate.Year >= DateTime.Now.Year).Select(s => new { s.TrainingOfferID, Title = SqlUdf.SubCodeName(s.CourseNameID, langId), s.StartDate, s.EndDate }).ToList(); result = resultEvent.Select(r => new CalendarVM { Id = r.EventId, Title = r.EventsDetails.Where(w => w.LanguageID == langId).Select(d => d.EventTitle).FirstOrDefault(), StartDate = r.StartDate.AsUtc(), EndDate = r.EndDate.AsUtc(), Type = 1 }).ToList(); result.AddRange(resultOpportunity.Select(r => new CalendarVM { Id = r.OpportunityID, Title = r.OpportunitiesDetails.Where(w => w.LanguageID == langId).Select(d => d.OpportunityTitle).FirstOrDefault(), StartDate = r.StartDate.AsUtc(), EndDate = r.EndDate.AsUtc(), Type = 2 }).ToList()); result.AddRange(resultTraning.Select(r => new CalendarVM { Id = r.TrainingOfferID, Title = r.Title, StartDate = r.StartDate.AsUtc(), EndDate = r.EndDate.AsUtc(), Type = 3 }).ToList()); } return(result); }
public List <UnionVm> List(int langId = 1) { List <Union> ds; using (var db = new LMISEntities()) { ds = db.Unions .Include(r => r.UnionDetails) .Include(r => r.UnionProfessions) .Include(r => r.UnionCommittees.Select(d => d.UnionCommitteeDetails)) .Where(r => r.IsDeleted == null) .ToList(); } return(ds.Select(r => new UnionVm() { UnionId = (long)r.ID, Name = r.UnionDetails.Select(d => new LocalString(d.LangID, d.Name)).ToList(), Address = r.UnionDetails.Select(d => new LocalString(d.LangID, d.Address)).ToList(), Professions = r.UnionProfessions.GroupBy(d => d.ProfID, d => new LocalString(d.LangID, d.Name), (k, g) => new GlobalString(g.ToList())).ToList(), Committees = r.UnionCommittees.Select(d => new UnionVm.UnionCommittee { Gov = new CodeSet { id = d.Gov }, Name = d.UnionCommitteeDetails.Select(dd => new LocalString(dd.LangID, dd.Name)).ToList() }).ToList(), Telephone = r.Telephone, Fax = r.Fax, Email = r.Email, Website = r.Website, Logo = r.Logo }) .ToList()); }
public List <Dictionary <string, object> > DetailApplicants(long contactId, long id, int langId = 1) { List <JobApplied> ds; using (var db = new LMISEntities()) { ds = db.JobApplieds .AsNoTracking() .Include(r => r.JobOffer) .Include(r => r.IndividualDetail.IndividualDetailsDets) .Where(r => r.JobOffer.IsDeleted == null && r.JobOffer.OrganizationContactID == contactId && r.JobOffer.JobOfferID == (int)id) .OrderBy(r => r.ViewStatus).ThenBy(r => r.ApplyDate) .ToList(); } return(ds.Select(a => new Dictionary <string, object> { { "id", a.JobAppliedID }, { "userId", a.IndPortalUserID.ToString(CultureInfo.InvariantCulture) }, { "userName", new GlobalString(a.IndividualDetail.IndividualDetailsDets .Select(d => new LocalString(d.LanguageID, d.FirstName + " " + d.LastName)) .ToList()).ToLocalString((Language)langId, true).T }, { "date", a.ApplyDate }, { "status", a.ViewStatus } }).ToList()); }
public List <OrgContactVm> ListOrgContacts(long portalUserId) { List <OrganizationContact_Info> ds; using (var db = new LMISEntities()) { ds = db.OrganizationContact_Info .Include(r => r.OrganizationContactInfoDetails) .Where(r => r.IsDeleted == null && r.PortalUsersID == portalUserId && r.JobTitleID.Trim().ToLower() != "admin") .ToList(); } var ret = ds.Select(r => new OrgContactVm() { PortalUserId = portalUserId, ContactId = (long)r.OrganizationContactID, UserName = r.Email, FullName = r.OrganizationContactInfoDetails.Select(d => new LocalString(d.LanguageID, d.ContactFullName)).ToList(), Department = r.OrganizationContactInfoDetails.Select(d => new LocalString(d.LanguageID, d.Department)).ToList(), JobTitle = r.JobTitleID, Mobile = r.Mobile, Telephone = r.Telephone, Fax = r.Fax }) .ToList(); return(ret); }
public OrgContactVm GetOrgContact(long contactId, long portalUserId = 0) { OrganizationContact_Info tr; using (var db = new LMISEntities()) { tr = db.OrganizationContact_Info .Include(r => r.OrganizationContactInfoDetails) .SingleOrDefault(r => r.IsDeleted == null && r.OrganizationContactID == contactId && (portalUserId == 0 || r.PortalUsersID == portalUserId)); } if (tr == null) { return(null); } return(new OrgContactVm() { PortalUserId = portalUserId, ContactId = (long)tr.OrganizationContactID, UserName = tr.Email, FullName = tr.OrganizationContactInfoDetails.Select(d => new LocalString(d.LanguageID, d.ContactFullName)).ToList(), Department = tr.OrganizationContactInfoDetails.Select(d => new LocalString(d.LanguageID, d.Department)).ToList(), JobTitle = tr.JobTitleID, Mobile = tr.Mobile, Telephone = tr.Telephone, Fax = tr.Fax }); }
public List <OfficeVm> List() { List <Office> ds; using (var db = new LMISEntities()) { ds = db.Offices .Include(r => r.OfficeDetails) .Where(r => r.IsDeleted == null) .ToList(); } return(ds.Select(r => new OfficeVm() { OfficeId = (long)r.ID, Title = r.OfficeDetails.Select(d => new LocalString(d.LangID, d.Title)).ToList(), Address = r.OfficeDetails.Select(d => new LocalString(d.LangID, d.Address)).ToList(), District = r.OfficeDetails.Select(d => new LocalString(d.LangID, d.District)).ToList(), Telephone = r.Telephone, Mobile = r.Mobile, Fax = r.Fax, Hotline = r.Hotline }) .ToList()); }
public OrgVm LoadProfile(long portalUserId) { OrganizationContact_Info admin; List <OrganizationDetail> ds; using (var db = new LMISEntities()) { admin = db.OrganizationContact_Info .First(r => r.IsDeleted == null && r.PortalUsersID == portalUserId && r.JobTitleID.Trim().ToLower() == "admin"); ds = db.OrganizationDetails .Include(r => r.PortalUser) .Include(r => r.OrganizationDetails_Det) .Where(r => r.DeleteUserID == null && r.PortalUsersID == portalUserId) .ToList(); } var ret = ds.Select(r => new OrgVm() { PortalUserId = portalUserId, OrgType = r.PortalUser.UserSubCategory, LogoFileName = r.OrganizationLogoPath, OrgName = r.OrganizationDetails_Det.Select(d => new LocalString(d.LanguageID, d.OrganizationName)).ToList(), ProfileFileName = r.OrganizationProfilePath, OrgSize = r.OrganizationSize, IDType = r.PortalUser.IDType, ID = r.PortalUser.IDNumber, DateEstablished = r.EstablishmentDate.AsUtc(), YOE = r.YearsofExperienceID, Activity = r.EconomicActivity, Industry = r.IndustryType, OtherIndustry = r.OrganizationDetails_Det.Select(d => new LocalString(d.LanguageID, d.OtherIndustryType)).ToList(), ContactInfo = new OrgVm.OrgContactInfo() { Country = r.CountryID, City = r.CityID, PostalCode = r.ZipPostalCode, Address = r.OrganizationDetails_Det.Select(d => new LocalString(d.LanguageID, d.Address)).ToList(), Telephone = r.Telephone, Website = r.OrganizationWebsite }, ReceiveTraining = r.PortalUser.TrainingSeeker, OfferJobs = r.PortalUser.Employer, OfferTraining = r.PortalUser.TrainingProvider, ItcRegNo = r.RegistrationNumberWithITC, Approval = (Approval)r.Is_Approved, RejectReason = r.RejectReason }) .SingleOrDefault(); if (ret == null) { return(null); } ret.UserName = admin.Email; ret.AuthLetterFileName = admin.AuthorizationletterPath; return(ret); }
public List <TrainingVm> BriefByOrgContact(long contactId, long?id = null, int langId = 1) { using (var db = new LMISEntities()) { return(db.TrainingOffers .AsNoTracking() .Where(r => r.IsDeleted == null && r.OrganizationContactID == contactId && (id == null || r.TrainingOfferID == id)) .Select(a => new { Offer = a, TitleDesc = SqlUdf.SubCodeName(a.CourseNameID, langId), Details = a.TrainingOfferDetails }) .ToList() .Select(a => new TrainingVm() { Id = (long)a.Offer.TrainingOfferID, ContactId = (long)a.Offer.OrganizationContactID, PortalUserId = (long)a.Offer.PortalUsersID, Title = a.TitleDesc, Status = a.Offer.trainingStatus, Approval = (Approval)a.Offer.Is_Approved, RejectReason = a.Offer.RejectReason, NewTitle = a.Details.Select(d => new LocalString(d.LanguageID, d.OtherCours_Name)).ToList(), }) .ToList()); } }
public EmployersTrainingProvidersVM Post(EmployersTrainingProvidersVM vm, string userId) { using (var db = new LMISEntities()) { try { var id = vm.ID; var checkExist = db.EmployersTrainingProviders.Count(c => c.Name == vm.Name && c.ID != vm.ID && c.IsDeleted == null); if (checkExist > 0) { return(null); } if (id > 0) //Update { var tr = db.EmployersTrainingProviders .Where(r => r.IsDeleted == null && r.ID == id) .ToList().Single(); tr.Description = vm.Description; tr.Name = vm.Name; tr.Website = vm.Website; tr.LogoPath = string.IsNullOrEmpty(vm.LogoPath)?tr.LogoPath: vm.LogoPath; tr.UpdateUserID = userId; tr.UpdateDate = DateTime.UtcNow; tr.LanguageID = vm.LanguageID; tr.Type = (vm.Type != 0); } else //Insert { var tr = new EmployersTrainingProvider() { Description = vm.Description, Name = vm.Name, Website = vm.Website, LogoPath = vm.LogoPath, PostUserID = userId, PostDate = DateTime.UtcNow, LanguageID = vm.LanguageID, Type = (vm.Type != 0) }; db.EmployersTrainingProviders.Add(tr); db.SaveChanges(); vm.ID = tr.ID; } db.SaveChanges(); } catch (Exception ex) { ExceptionDispatchInfo.Capture(ex).Throw(); } return(vm); } }
public List <Infrastructure.Data.Entities.HelpfulLinkVm> Get(int languageId, decimal?HelpfulLinkURLId) { List <HelpfulLinkVm> result; using (var db = new LMISEntities()) { result = db.HelpfulLinks.Where( w => w.IsDeleted == null && (w.HelpfulLinkLanguage == languageId || languageId == 0) && w.HelpfulLinkID == (HelpfulLinkURLId > 0 ? HelpfulLinkURLId : w.HelpfulLinkID)) .Select(s => new HelpfulLinkVm { HelpfulLinkID = s.HelpfulLinkID, HelpfulLinkURL = s.HelpfulLinkURL, HelpfulLinkName = s.HelpfulLinkName, HelpfulLinkLanguage = s.HelpfulLinkLanguage, GroupID = s.GroupID, GroupName = SqlUdf.SubCodeName(s.GroupID, languageId) }) .OrderBy(o => o.GroupName) .ToList(); } return(result); }
public List <Infrastructure.Data.Entities.NewsVm> GetNewsByID(decimal newsID, int LanguageId) { using (var db = new LMISEntities()) { var result = (from _news in db.News where (_news.IsDeleted == false || _news.IsDeleted == null) && _news.NewsLangauage == LanguageId && EntityFunctions.TruncateTime(_news.NewsExpiryDate) >= EntityFunctions.TruncateTime(DateTime.Now) && _news.NewsID == newsID select new NewsVm { NewsID = _news.NewsID, NewsTitle = _news.NewsTitle, NewsDescription = _news.NewsDescription, NewsDate = _news.NewsDate, NewsExpiryDate = _news.NewsExpiryDate, NewsBannerPath = _news.NewsBannerPath, NewsIconPath = _news.NewsIconPath, NewsVideoPath = _news.NewsVideoPath, NewsLangauage = _news.NewsLangauage, PostUserID = _news.PostUserID, PostDate = _news.PostDate, IsInformal = _news.IsInformal, IsAchievement = _news.IsAchievement }); return(result.ToList()); } }
public void Approve(string adminId, long reqKey, long feedbackId, bool approved, string reason) { using (var db = new LMISEntities()) using (var transaction = db.Database.BeginTransaction()) { try { var log = db.RequestLogs .Where(r => r.ID == reqKey && r.RequestID == feedbackId && r.RequestType == "02900008" && r.Is_Approved == 1) .ToList().Single(); log.AdminID = adminId; log.Is_Approved = approved ? (byte)Approval.Approved : (byte)Approval.Rejected; var tr = db.Feedbacks .Where(r => r.FeedbackID == feedbackId) .ToList().Single(); tr.IsReviewed = approved; db.SaveChanges(); transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); ExceptionDispatchInfo.Capture(ex).Throw(); } } }
public Dictionary <string, object> Review(long id, int langId = 1) { using (var db = new LMISEntities()) { return(db.Feedbacks .AsNoTracking() .Where(r => r.FeedbackID == id && r.IsDeleted == null) .Select(a => new { Type = SqlUdf.SubCodeName(a.FeedbackTypeId, 1), Feedback = a }) .ToList() .Select(a => new Dictionary <string, object> { { "Id", id }, { "Type", a.Type }, { "Title", a.Feedback.Title }, { "Desc", a.Feedback.Description }, { "Lang", a.Feedback.FeedbackLang }, { "Approval", a.Feedback.IsReviewed ? (byte)Approval.Approved : (byte)Approval.Pending } }) .SingleOrDefault()); } }
public int Post(Dictionary <string, string> keys) { using (var context = new LMISEntities()) { ConfigCenter config; foreach (var key in keys) { if (key.Key.EndsWith("En")) { config = context.ConfigCenters.Single(w => w.Key == key.Key.Substring(0, key.Key.Length - 2) && w.SexCode == 1); } else if (key.Key.EndsWith("Fr")) { config = context.ConfigCenters.Single(w => w.Key == key.Key.Substring(0, key.Key.Length - 2) && w.SexCode == 2); } else if (key.Key.EndsWith("Ar")) { config = context.ConfigCenters.Single(w => w.Key == key.Key.Substring(0, key.Key.Length - 2) && w.SexCode == 3); } else { config = context.ConfigCenters.Single(w => w.Key == key.Key); } config.Value = key.Value; } context.SaveChanges(); } return(0); }
public List <EventVm> ListByOrgContact(long contactId) { List <Event> ds; using (var db = new LMISEntities()) { ds = db.Events .Include(r => r.EventsDetails) .Where(r => r.IsDeleted == null && r.OrganizationContactID == contactId) .ToList(); } return(ds.Select(r => new EventVm() { EventId = (long)r.EventId, ContactId = (long)r.OrganizationContactID, Title = r.EventsDetails.Select(d => new LocalString(d.LanguageID, d.EventTitle)).ToList(), Address = r.EventsDetails.Select(d => new LocalString(d.LanguageID, d.EventAddress)).ToList(), StartDate = r.StartDate.AsUtc(), EndDate = r.EndDate.AsUtc(), Type = r.EventTypeID, Price = r.Price, ContactAddress = r.EventsDetails.Select(d => new LocalString(d.LanguageID, d.EventContactAddress)).ToList(), ContactTelephone = r.EventContactTelephone, ContactWebsite = r.EventContactWebsite, FilePath = r.UploadPath, IsInternal = r.IsInternal == true, IsInformal = r.IsInformal == true, Approval = (Approval)r.IsApproved }) .ToList()); }
public List <OpportunityVm> ListByOrgContact(long contactId) { List <Opportunity> ds; using (var db = new LMISEntities()) { ds = db.Opportunities .Include(r => r.OpportunitiesDetails) .Where(r => r.IsDeleted == null && r.OrganizationContactID == contactId) .ToList(); } return(ds.Select(r => new OpportunityVm() { OpportunityId = (long)r.OpportunityID, ContactId = (long)r.OrganizationContactID, Title = r.OpportunitiesDetails.Select(d => new LocalString(d.LanguageID, d.OpportunityTitle)).ToList(), FilePath = r.OpportunityFilePath, StartDate = r.StartDate.AsUtc(), EndDate = r.EndDate.AsUtc(), Approval = (Approval)r.Is_Approved, IsInformal = r.IsInformal, IsInternal = r.IsInternal == true }) .ToList()); }
public Dictionary <string, object> ApplicationRequirements(long id, int langId = 1) { using (var db = new LMISEntities()) { return(db.JobOffers .AsNoTracking() .Where(r => r.JobOfferID == id && r.IsDeleted == null && r.JobStatus && r.IsApproved == (byte)Approval.Approved) .Select(a => new { Title = SqlUdf.SubCodeName(a.JobTiltleID, langId), AppTemplate = a.JobOfferAdditionalDocs .Where(d => d.AdditionalDocTypeID == "99999999") .Select(d => d.AdditionalDocTemplatePath) .FirstOrDefault(), AdditionalDocs = a.JobOfferAdditionalDocs .Where(d => d.AdditionalDocTypeID != "99999999") .Select(d => new CodeSet { id = d.AdditionalDocTypeID, desc = SqlUdf.SubCodeName(d.AdditionalDocTypeID, langId) }).ToList() }) .ToList() .Select(a => new Dictionary <string, object> { { "Id", id }, { "Title", a.Title }, { "AppTemplate", a.AppTemplate }, { "AdditionalDocs", a.AdditionalDocs } }) .SingleOrDefault()); } }
public List <OpportunityVm> List(bool?informal = null) { using (var db = new LMISEntities()) { var ds = db.Opportunities .Include(r => r.OpportunitiesDetails) .Where(r => r.IsDeleted == null && r.Is_Approved == (byte)Approval.Approved && r.EndDate >= DateTime.UtcNow && (informal == null || r.IsInformal == informal)) .ToList(); return(ds.Select(r => new OpportunityVm() { OpportunityId = (long)r.OpportunityID, ContactId = (long)r.OrganizationContactID, ContactName = r.OrganizationContact_Info.OrganizationContactInfoDetails.Select(d => new LocalString(d.LanguageID, d.ContactFullName)).ToList(), OrganizationName = r.OrganizationContact_Info.OrganizationDetail.OrganizationDetails_Det.Select(d => new LocalString(d.LanguageID, d.OrganizationName)).ToList(), Title = r.OpportunitiesDetails.Select(d => new LocalString(d.LanguageID, d.OpportunityTitle)).ToList(), FilePath = r.OpportunityFilePath, StartDate = r.StartDate.AsUtc(), EndDate = r.EndDate.AsUtc(), Approval = (Approval)r.Is_Approved, IsInformal = r.IsInformal, IsInternal = r.IsInternal == true }) .ToList()); } }
public List <OpportunityVm> ListInternal() { using (var db = new LMISEntities()) { db.Database.Log = message => System.Diagnostics.Debug.Write(message); var ds = db.Opportunities .Include(r => r.OpportunitiesDetails) .Where(r => r.IsDeleted == null && r.IsInternal == true) .ToList(); return(ds.Select(r => new OpportunityVm() { OpportunityId = (long)r.OpportunityID, ContactId = (long)r.OrganizationContactID, ContactName = r.OrganizationContact_Info.OrganizationContactInfoDetails.Select(d => new LocalString(d.LanguageID, d.ContactFullName)).ToList(), OrganizationName = r.OrganizationContact_Info.OrganizationDetail.OrganizationDetails_Det.Select(d => new LocalString(d.LanguageID, d.OrganizationName)).ToList(), Title = r.OpportunitiesDetails.Select(d => new LocalString(d.LanguageID, d.OpportunityTitle)).ToList(), FilePath = r.OpportunityFilePath, StartDate = r.StartDate.AsUtc(), EndDate = r.EndDate.AsUtc(), Approval = (Approval)r.Is_Approved, IsInformal = r.IsInformal, IsInternal = r.IsInternal == true }) .ToList()); } }
public IndividualRegisterationVm GetPersonalInformation(UserInfo user) { List <PortalUser> ds; using (var db = new LMISEntities()) { ds = db.PortalUsers .Where(r => r.PortalUsersID == user.PortalUserId).ToList(); return(ds.Select(r => new IndividualRegisterationVm() { IdType = r.IDType, NationailtyIDorPassportID = r.IDNumber, RegisterationId = (long)r.PortalUsersID, Email = r.IndividualDetail.Email, MobileNumber = r.IndividualDetail.MobileNo, TelephoneNo = r.IndividualDetail.TelephoneNo, Gender = r.IndividualDetail.GenderId, BirthDate = r.IndividualDetail.DateOfBirth, Maritalstatus = r.IndividualDetail.MaritalStatusId, Militarystatus = r.IndividualDetail.MilitaryStatus_Id, Nationality = r.IndividualDetail.NationalityId, Country = r.IndividualDetail.CountryID, City = r.IndividualDetail.CityID, AllowtoViewMyInfo = r.IndividualDetail.AllowtoViewMyInfo, IndividualMedicalId = r.IndividualDetail.IndividualMedicalID, FirstName = r.IndividualDetail.IndividualDetailsDets.Select(d => new LocalString(d.LanguageID, d.FirstName)).ToList(), LastName = r.IndividualDetail.IndividualDetailsDets.Select(d => new LocalString(d.LanguageID, d.LastName)).ToList(), Address = r.IndividualDetail.IndividualDetailsDets.Select(d => new LocalString(d.LanguageID, d.Address)).ToList() }) .SingleOrDefault()); } }
public EducationalInformationVm GetEducationInformation(long id, UserInfo user) { List <IndividualEducationlevel> ds; using (var db = new LMISEntities()) { ds = db.IndividualEducationlevels .Where(r => r.IsDeleted == null && r.PortalUsersID == user.PortalUserId && r.IndividualEducationlevelID == id) .ToList(); GlobalString nullname = new GlobalString("", "", ""); // nullname. = null; return(ds.Select(r => new EducationalInformationVm() { IndividualEducationlevelID = (long)r.IndividualEducationlevelID, Degree = (!string.IsNullOrWhiteSpace(r.Degree)) ? r.Degree.Trim() : null, Name = r.IndividualEducationlevelDets.Select(d => new LocalString(d.LanguageID, d.InstitutionName)).ToList(), EducationalLevelId = r.LevelOfEducation, Grade = r.IndividualEducationlevelDets.Select(d => new LocalString(d.LanguageID, d.Grade)).ToList(), graduationyear = r.GraduationYear, Percentage = (r.GradePrecentage.HasValue) ? r.GradePrecentage.Value : 0, InstitutionType = r.IndividualEducationlevelDets.Select(d => new LocalString(d.LanguageID, d.InstitutionType)).ToList(), CertificationType = r.IndividualEducationlevelDets.Select(d => new LocalString(d.LanguageID, d.CertificationType)).ToList(), FacultyName = r.IndividualEducationlevelDets.Select(d => new LocalString(d.LanguageID, d.FacultyName)).ToList(), GradeGPA = (r.GradeGPA.HasValue) ? (float)r.GradeGPA.Value : 0 }) .SingleOrDefault()); } }
public List <JobVm> BriefByOrgContact(long contactId, long?id = null, int langId = 1) { using (var db = new LMISEntities()) { return(db.JobOffers .AsNoTracking() .Where(r => r.IsDeleted == null && r.OrganizationContactID == contactId && (id == null || r.JobOfferID == id)) .Select(a => new { Offer = a, TitleDesc = SqlUdf.SubCodeName(a.JobTiltleID, langId), Details = a.JobOfferDetails }) .ToList() .Select(a => new JobVm() { JobId = (long)a.Offer.JobOfferID, ContactId = (long)a.Offer.OrganizationContactID.GetValueOrDefault(), PortalUserId = (long)a.Offer.PortalUsersID, Title = a.TitleDesc, JobStatus = a.Offer.JobStatus, Approval = (Approval)a.Offer.IsApproved, RejectReason = a.Offer.RejectReason, NewTitle = a.Details.Select(d => new LocalString(d.LanguageID, d.OtherJobTitle)).ToList(), PostDate = a.Offer.PostDate }) .ToList()); } }
public bool IsByOrgContact(long id, long contactId) { using (var db = new LMISEntities()) { return(db.Events .Any(r => r.IsDeleted == null && r.EventId == id && r.OrganizationContactID == contactId)); } }
public bool IsInternal(long id) { using (var db = new LMISEntities()) { return(db.Events .Any(r => r.IsDeleted == null && r.EventId == id && r.IsInternal == true)); } }
public bool IsInternal(long id) { using (var db = new LMISEntities()) { return(db.Opportunities .Any(r => r.IsDeleted == null && r.OpportunityID == id && r.IsInternal == true)); } }
public decimal JobApplied() { using (var db = new LMISEntities()) { return(db.JobApplieds .Where(w => w.ApplyDate.Year == DateTime.Now.Year) .Count()); } }
public List <object> GroupSkillsForIndustry(string industryId, int langId = 1) { List <object> ds; using (var db = new LMISEntities()) { ds = db.Skills.Where(a => a.IndustryId == industryId) .Select(a => a.SkillID) .Distinct() .GroupJoin( db.Skills.Where(a => a.IndustryId == industryId), a => a, b => b.SkillID, (k, g) => new { SkillId = k, SkillDesc = SqlUdf.SubCodeName(k, langId), Levels = g.Select(a => new { id = a.SkillLevel_ID, desc = SqlUdf.SubCodeName(a.SkillLevel_ID, langId) }), TypeIsRequired = (SqlUdf.SubCodeParent(k) == "02000003") //For Lingual Skills Only }) .ToList() .GroupJoin( db.SubCodes.Where(a => a.GeneralID == "022") //Skill Types .Select(a => new { id = a.SubID, desc = SqlUdf.SubCodeName(a.SubID, langId) }) .Distinct(), a => true, b => true, (k, g) => new { id = k.SkillId, desc = k.SkillDesc, Types = k.TypeIsRequired ? g.ToList() : g.ToList().TakeWhile(a => false), k.Levels }) .SelectMany(a => a.Types.DefaultIfEmpty(new { id = "", desc = "" }), (p, c) => new { id = industryId + "|" + p.id + "|" + c.id, desc = p.desc + (c.id == "" ? "" : " [" + c.desc + "]"), options = p.Levels.Select(a => new { id = industryId + "|" + p.id + "|" + c.id + "|" + a.id, desc = a.desc + ": " + p.desc + (c.id == "" ? "" : " [" + c.desc + "]"), Skill = new { p.id, p.desc }, Type = (c.id == "" ? null : c), Level = a }) }) .ToList() .Cast <object>().ToList(); } return(ds); }
public ConceptNonFormalTrainingVM Post(ConceptNonFormalTrainingVM vm, string userId) { using (var db = new LMISEntities()) { try { var id = vm.ConceptID; var checkExist = db.ConceptOfNonFormalTrainings.Count(c => c.ConceptTitle == vm.ConceptTitle && c.ConceptID != vm.ConceptID && c.IsDeleted == null); if (checkExist > 0) { return(null); } if (id > 0) //Update { var tr = db.ConceptOfNonFormalTrainings .Where(r => r.IsDeleted == null && r.ConceptID == id) .ToList().Single(); tr.ConceptDescription = vm.ConceptDescription; tr.ConceptTitle = vm.ConceptTitle; tr.ImagePath = vm.ImagePath; tr.UpdateUserID = userId; tr.UpdateDate = DateTime.UtcNow; tr.LanguageID = vm.LanguageID; } else //Insert { var tr = new ConceptOfNonFormalTraining() { ConceptDescription = vm.ConceptDescription, ConceptTitle = vm.ConceptTitle, ImagePath = vm.ImagePath, PostUserID = userId, PostDate = DateTime.UtcNow, LanguageID = vm.LanguageID }; db.ConceptOfNonFormalTrainings.Add(tr); db.SaveChanges(); vm.ConceptID = tr.ConceptID; } db.SaveChanges(); } catch (Exception ex) { ExceptionDispatchInfo.Capture(ex).Throw(); } return(vm); } }