public static List <SolutionOrganizationView> GetSolutions(string search, int state, int minScore) { var mifnexsoEntities = new MIFNEXSOEntities(); var result = mifnexsoEntities.ExecuteStoreQuery <SolutionOrganizationView>("SELECT dbo.Solution.SolutionId AS SSolutionId, dbo.Solution.SolutionTypeId AS SSolutionTypeId, " + " dbo.Solution.Title AS STitle, dbo.Solution.TagLine AS STagLine, " + " dbo.Solution.Description AS SDescription, dbo.Solution.Biography AS SBiography, dbo.Solution.Challenge AS SChallenge, dbo.Solution.Approach AS SApproach, " + " dbo.Solution.Results AS SResults, dbo.Solution.ImplementationDetails AS SImplementationDetails, dbo.Solution.AdditionalCost AS SAdditionalCost, " + " dbo.Solution.AvailableResources AS SAvailableResources, dbo.Solution.TimeFrame AS STimeFrame, dbo.Solution.Duration AS SDuration, " + " dbo.Solution.DurationDetails AS SDurationDetails, dbo.Solution.SolutionStatusId AS SSolutionStatusId, dbo.Solution.SolutionType AS SSolutionType, " + " dbo.Solution.Topic AS STopic, dbo.Solution.Language AS SLanguage, dbo.Solution.CreatedUserId AS SCreatedUserId, dbo.Solution.Deleted AS SDeleted, " + " dbo.Solution.Country AS SCountry, dbo.Solution.Region AS SRegion, dbo.Solution.City AS SCity, dbo.Solution.Address AS SAddress, " + " dbo.Solution.ZipCode AS SZipCode, dbo.Solution.Logo AS SLogo, dbo.Solution.Cost1 AS SCost1, dbo.Solution.Cost2 AS SCost2, dbo.Solution.Cost3 AS SCost3, " + " dbo.Solution.DeliveryFormat AS SDeliveryFormat, dbo.Solution.Cost AS SCost, dbo.Solution.CostType AS SCostType, dbo.Solution.CostDetails AS SCostDetails, " + " dbo.Solution.SolutionState AS SSolutionState, dbo.Solution.Beneficiaries AS SBeneficiaries, dbo.Solution.DateCreated AS SDateCreated, " + " dbo.Solution.DateUpdated AS SDateUpdated, dbo.Solution.ChallengeReference AS SChallengeReference, dbo.Organization.OrganizationID AS OOrganizationID, " + " dbo.Organization.Code AS OCode, dbo.Organization.Name AS OName, dbo.Organization.Address AS OAddress, dbo.Organization.Phone AS OPhone, " + " dbo.Organization.Email AS OEmail, dbo.Organization.ContactEmail AS OContactEmail, dbo.Organization.Website AS OWebsite, dbo.Organization.Twitter AS OTwitter, " + " dbo.Organization.Skype AS OSkype, dbo.Organization.Facebook AS OFacebook, dbo.Organization.GooglePlus AS OGooglePlus, " + " dbo.Organization.LinkedIn AS OLinkedIn, dbo.Organization.Description AS ODescription, dbo.Organization.Logo AS OLogo, dbo.Organization.Country AS OCountry, " + " dbo.Organization.Region AS ORegion, dbo.Organization.ZipCode AS OZipCode, dbo.Organization.City AS OCity, dbo.Organization.Created AS OCreated, " + " dbo.Organization.Updated AS OUpdated, dbo.Organization.Latitude AS OLatitude, dbo.Organization.Longitude AS OLongitude, " + " dbo.Organization.GoogleLocation AS OGoogleLocation " + " FROM dbo.Solution INNER JOIN " + " dbo.Organization ON dbo.Solution.OrganizationId = dbo.Organization.OrganizationID where dbo.GetScore(Solution.SolutionId,'JUDGE')>" + minScore.ToString() + " and Solution.SolutionState=" + state.ToString() + " order by dbo.GetScore(Solution.SolutionId,'JUDGE') desc" ).ToList(); return(result); }
public ChallengeJudgeComponent() { mifnexsoEntities = new MIFNEXSOEntities(); challengeJudge = new ChallengeJudge(); challengeJudge.ChallengeJudgeId = Guid.Empty; mifnexsoEntities.ChallengeJudges.AddObject(challengeJudge); }
public AttributesComponent(Guid guid) { mifnexsoEntities = new MIFNEXSOEntities(); try { if (guid != Guid.Empty) { attributes = mifnexsoEntities.Atrributes.FirstOrDefault(a => a.AttributeID == guid); } else { attributes = new Atrributes(); attributes.AttributeID = Guid.Empty; attributes.OrganizationID = Guid.Empty; attributes.Type = string.Empty; attributes.Value = string.Empty; attributes.ValueType = string.Empty; attributes.Description = string.Empty; attributes.Label = string.Empty; mifnexsoEntities.Atrributes.AddObject(attributes); } } catch (Exception) { throw; } }
public HttpResponseMessage MarkAllAsRead() { try { var currentUser = DotNetNuke.Entities.Users.UserController.GetCurrentUserInfo(); if (!currentUser.IsInRole("Registered Users")) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Unauthorized)); } var read = DateTime.Now; MIFNEXSOEntities entity = new MIFNEXSOEntities(); var listNotification = entity.Notifications.Where(a => a.UserId == currentUser.UserID && a.Read == null); foreach (var item in listNotification) { item.Read = read; } if (entity.SaveChanges() >= 0) { return(Request.CreateResponse(HttpStatusCode.OK, "Successful Operation")); } throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)); } catch (HttpResponseException e) { throw e; } catch (Exception ee) { DotNetNuke.Services.Exceptions.Exceptions.LogException(ee); throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)); } }
public PotentialUserComponent(Guid potentialUserId) { if (potentialUserId != Guid.Empty) { mifnexsoEntities = new MIFNEXSOEntities(); try { potentialUser = mifnexsoEntities.PotentialUsers.FirstOrDefault(a => a.PotentialUserId == potentialUserId); if (potentialUser == null) { potentialUser = new PotentialUser(); potentialUser.PotentialUserId = Guid.Empty; mifnexsoEntities.PotentialUsers.AddObject(potentialUser); } } catch (Exception) { throw; } } else { potentialUser = new PotentialUser(); } }
public SocialMediaIndicatorComponent(Guid objectRelated, string objectType, string indicatorType, int?userId) { mifnexsoEntities = new MIFNEXSOEntities(); try { if (objectRelated != Guid.Empty) { if (userId != null) { socialMediaIndicator = mifnexsoEntities.SocialMediaIndicators.FirstOrDefault( a => a.ObjectId == objectRelated && a.ObjectType == objectType && a.IndicatorType == indicatorType && a.UserId == userId); } if (socialMediaIndicator == null) { mifnexsoEntities = new MIFNEXSOEntities(); socialMediaIndicator = new SocialMediaIndicator(); socialMediaIndicator.SocialMediaIndicatorId = Guid.Empty; socialMediaIndicator.ObjectId = objectRelated; socialMediaIndicator.UserId = userId; socialMediaIndicator.ObjectType = objectType; socialMediaIndicator.IndicatorType = indicatorType; mifnexsoEntities.SocialMediaIndicators.AddObject(socialMediaIndicator); } } } catch (Exception) { throw; } }
protected ScoreComponent(Guid SolutionId, int userId, string scoreType) { if (SolutionId != Guid.Empty && userId > 0 && scoreType != string.Empty) { mifnexsoEntities = new MIFNEXSOEntities(); try { score = mifnexsoEntities.Scores.FirstOrDefault( a => a.SolutionId == SolutionId && a.UserId == userId && a.ScoreType == scoreType && a.Active == true); if (score == null) { score = new Score(); score.UserId = userId; score.SolutionId = SolutionId; score.ScoreType = scoreType; score.ScoreId = Guid.Empty; mifnexsoEntities.Scores.AddObject(score); } } catch (Exception) { throw; } } }
public OrganizationComponent() { mifnexsoEntities = new MIFNEXSOEntities(); organization = new Organization(); organization.OrganizationID = Guid.NewGuid(); mifnexsoEntities.Organizations.AddObject(organization); }
public ReferencesComponent() { mifnexsoEntities = new MIFNEXSOEntities(); reference = new Reference(); reference.ReferenceId = Guid.Empty; mifnexsoEntities.References.AddObject(reference); }
public AccreditationsComponent() { mifnexsoEntities = new MIFNEXSOEntities(); acreditation = new Accreditation(); acreditation.AccreditationId = Guid.Empty; mifnexsoEntities.Accreditations.AddObject(acreditation); }
public ListComponent(string key, string category, string culture) { if (!string.IsNullOrEmpty(key)) { mifnexsoEntities = new MIFNEXSOEntities(); try { list = mifnexsoEntities.Lists.FirstOrDefault(a => a.Key == key && a.Category == category && a.Culture == culture); if (list == null) { list = new List(); list.Key = key; list.Value = string.Empty; list.Category = string.Empty; mifnexsoEntities.Lists.AddObject(list); } } catch (Exception) { throw; } } }
public MessageComponent() { mifnexsoEntities = new MIFNEXSOEntities(); message = new Message(); message.MessageId = Guid.Empty; mifnexsoEntities.Messages.AddObject(message); }
public JudgesAssignationComponent() { mifnexsoEntities = new MIFNEXSOEntities(); judgesAssignation = new JudgesAssignation(); judgesAssignation.JudgeAssigantionId = Guid.Empty; mifnexsoEntities.JudgesAssignations.AddObject(judgesAssignation); }
public static List <string> GetSolutionChallenges() { var mifnexsoEntities = new MIFNEXSOEntities(); var result = mifnexsoEntities.ExecuteStoreQuery <string>("select challengereference from solution where challengereference is not null group by challengereference ").ToList(); return(result); }
public NotificationComponent() { mifnexsoEntities = new MIFNEXSOEntities(); notification = new Notification(); notification.NotificationId = Guid.Empty; mifnexsoEntities.Notifications.AddObject(notification); }
public BadgeComponent(Guid badgeId) { if (badgeId != Guid.Empty) { mifnexsoEntities = new MIFNEXSOEntities(); try { badge = mifnexsoEntities.Badges.FirstOrDefault(a => a.BadgeId == badgeId); if (badge == null) { badge = new Badge(); badge.BadgeId = Guid.Empty; mifnexsoEntities.Badges.AddObject(badge); } } catch (Exception) { throw; } } else { badge = new Badge(); } }
public static decimal GetAggregatorSocialMediaIndicatorPerObjectRelated(Guid objectRelated, string objecType, string indicatorType, string agregator) { var mifnexsoEntities = new MIFNEXSOEntities(); var result_ = (from c in mifnexsoEntities.SocialMediaIndicators where c.ObjectId == objectRelated && c.ObjectType == objecType && c.IndicatorType == indicatorType select c); if (result_ != null) { if (result_.Count() > 0) { switch (agregator) { case "SUM": return(result_.Sum(a => a.Value)); case "AVG": return(result_.Average(a => a.Value)); case "COUNT": return(result_.Count()); } } } return(0); }
public BadgeComponent(Guid solutionId, string type) { if (solutionId != Guid.Empty && !string.IsNullOrEmpty(type)) { mifnexsoEntities = new MIFNEXSOEntities(); try { badge = mifnexsoEntities.Badges.FirstOrDefault(a => a.SolutionId == solutionId && a.Type == type); if (badge == null) { badge = new Badge(); badge.BadgeId = Guid.Empty; mifnexsoEntities.Badges.AddObject(badge); } } catch (Exception) { throw; } } else { badge = new Badge(); } }
/// <summary> /// Load information of each email sent: device type, country, city, browser /// </summary> /// <param name="CampaignLogId"></param> /// <returns>mailTrackerLog</returns> public MailTrackerLog MailTrackerLogComponentByCampaignLogId(Guid CampaignLogId) { MailTrackerLog mailTrackerLog; if (CampaignLogId != Guid.Empty) { mifnexsoEntities = new MIFNEXSOEntities(); try { mailTrackerLog = mifnexsoEntities.MailTrackerLogs.FirstOrDefault(a => a.CampaingLogId == CampaignLogId); if (mailTrackerLog == null) { mailTrackerLog = new MailTrackerLog(); mailTrackerLog.MailTrackerLogId = Guid.Empty; mifnexsoEntities.MailTrackerLogs.AddObject(mailTrackerLog); } return(mailTrackerLog); } catch { return(null); } } else { return(null); } }
public CampaignLogComponent(Guid CampaignLogId) { if (CampaignLogId != Guid.Empty) { mifnexsoEntities = new MIFNEXSOEntities(); try { campaignLog = mifnexsoEntities.CampaignLogs.FirstOrDefault(a => a.CampaignLogId == CampaignLogId); if (campaignLog == null) { campaignLog = new CampaignLog(); campaignLog.CampaignLogId = Guid.Empty; mifnexsoEntities.CampaignLogs.AddObject(campaignLog); } } catch (Exception) { throw; } } else { campaignLog = new CampaignLog(); campaignLog.CampaignLogId = Guid.Empty; mifnexsoEntities.CampaignLogs.AddObject(campaignLog); } }
public static double GetGlobalAdditionalJudgeScore(Guid solutionId, string challengeReference) { var mifnexsoEntities = new MIFNEXSOEntities(); var result = from c in mifnexsoEntities.Scores where c.SolutionId == solutionId && c.ScoreType == "CUSTOM_XML" && c.ChallengeReference == challengeReference && c.Active == true select c; double finalScore = 0; int judges = 0; foreach (var score in result) { judges++; foreach (var scoreValue in score.ScoreValues) { finalScore = finalScore + scoreValue.value * scoreValue.ScoreType.Weight; } } if (judges != 0) { return(finalScore / judges); } else { return(double.MinValue); } }
public UserPropertiesListComponent(int userId, string key, string category) { if (!string.IsNullOrEmpty(key)) { mifnexsoEntities = new MIFNEXSOEntities(); try { userPropertiesList = mifnexsoEntities.UserPropertiesLists.FirstOrDefault(a => a.UserPropertyId == userId && a.Key == key && a.Category == category); if (userPropertiesList == null) { userPropertiesList = new UserPropertiesList(); userPropertiesList.ListId = Guid.NewGuid(); userPropertiesList.Key = key; userPropertiesList.UserPropertyId = userId; userPropertiesList.Category = category; mifnexsoEntities.UserPropertiesLists.AddObject(userPropertiesList); } } catch (Exception) { throw; } } }
public static List <string> GetPotentialUserSources() { var mifnexsoEntities = new MIFNEXSOEntities(); var result = mifnexsoEntities.ExecuteStoreQuery <string>("select source from potentialUsers where source is not null group by source").ToList(); return(result); }
/// <summary> /// This method Update States indexed in the table AnalysisData /// </summary> /// <returns></returns> public void UpdateIndexingStates(List <Guid> listRequestUpdateState) { mifnexsoEntities = new MIFNEXSOEntities(); // Massive upgrade registration status of indexing documents mifnexsoEntities.AnalysisDatas.Where(x => listRequestUpdateState.Contains(x.ObjectId)).ToList().ForEach(a => a.Indexed = true); mifnexsoEntities.SaveChanges(); }
public PotentialUserComponent(string email) { if (!string.IsNullOrEmpty(email)) { mifnexsoEntities = new MIFNEXSOEntities(); try { potentialUser = mifnexsoEntities.PotentialUsers.FirstOrDefault(a => a.Email == email && (a.Deleted == false || a.Deleted == null)); if (potentialUser == null) { potentialUser = new PotentialUser(); potentialUser.Email = email; potentialUser.PotentialUserId = Guid.Empty; mifnexsoEntities.PotentialUsers.AddObject(potentialUser); } } catch (Exception) { throw; } } else { potentialUser = new PotentialUser(); } }
/// <summary> /// This method gets All Records found in table solution. /// But not in the tabla of dataAnalysis. /// To make data analysis /// </summary> /// <returns>Return list of solutions for analysis data</returns> public List <DataIndexDto> GetDataAnalysis() { var lReturn = new List <DataIndexDto>(); using (mifnexsoEntities = new MIFNEXSOEntities()) { lReturn = (from a in mifnexsoEntities.Solution join b in mifnexsoEntities.AnalysisDatas on a.SolutionId equals b.ObjectId into joined from b in joined.DefaultIfEmpty() where a.Deleted != true && b.ObjectId == null select new DataIndexDto { solutionId = a.SolutionId, title = a.Title, tagline = a.TagLine, challenge = a.Challenge, approach = a.Approach, results = a.Results, implementationDetails = a.ImplementationDetails, durationDetails = a.DurationDetails, description = a.Description, lenguege = a.Language }).Take(100).ToList(); } return(lReturn); }
public ChallengeComponent() { mifnexsoEntities = new MIFNEXSOEntities(); challenge = new ChallengeSchema(); challenge.ChallengeReference = string.Empty; mifnexsoEntities.ChallengeSchemas.AddObject(challenge); }
/// <summary> /// This method retrieves the information to index a stored procedure /// and the retrives information is encapsulated in DTO /// </summary> /// <returns></returns> public List <IndexDataDto> GetDataForIndex() { var lReturn = new List <IndexDataDto>(); using (mifnexsoEntities = new MIFNEXSOEntities()) { lReturn = (from a in mifnexsoEntities.spGetDataIndex() select new IndexDataDto { objectId = a.ObjectId.GetValueOrDefault(Guid.Empty), title = a.Title, organizationName = a.OrganizationName, scoreValue = a.ScoreValue.GetValueOrDefault(1), fullRequest = a.FullText, keywords = a.Keywords, sentences = a.Sentences, concepts = a.ConceptsMember, language = a.Language, category = a.Category, key = a.keys, label = a.Label, country = a.Country, region = a.Region, city = a.City }).ToList(); } return(lReturn); }
public SolutionListComponent(Guid solutionId, string key, string category) { if (!string.IsNullOrEmpty(key)) { mifnexsoEntities = new MIFNEXSOEntities(); try { solutionList = mifnexsoEntities.SolutionLists.FirstOrDefault(a => a.SolutionId == solutionId && a.Key == key && a.Category == category); if (solutionList == null) { solutionList = new SolutionList(); solutionList.ListId = Guid.NewGuid(); solutionList.Key = key; solutionList.SolutionId = solutionId; solutionList.Category = category; mifnexsoEntities.SolutionLists.AddObject(solutionList); } } catch (Exception) { throw; } } }
public CustomDataLogComponent() { mifnexsoEntities = new MIFNEXSOEntities(); customDataLog = new CustomDataLog(); customDataLog.CustomDataLogId = Guid.Empty; mifnexsoEntities.CustomDataLog.AddObject(customDataLog); }