public static async Task <bool> Moderate(this VRCSharpSession session, APIUser user, ModerationType type) { HttpClientHandler handler = null; HttpClient client = new HttpClient(); if (session.UseProxies) { //Load proxies from Proxies.txt handler = new HttpClientHandler(); handler.Proxy = APIExtensions.GetRandomProxy(); client = new HttpClient(handler); } client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Add("Authorization", session.AuthToken); var payload = JsonConvert.SerializeObject(new ModerationPayload() { moderated = user.id, type = type.Convert() }); var response = await client.PostAsync($"https://vrchat.com/api/1/auth/user/playermoderations?apiKey={GlobalVars.ApiKey}&userId={user.id}", new StringContent(payload, Encoding.UTF8, "application/json")); if (response.StatusCode == HttpStatusCode.OK) { return(true); } else { return(false); } }
protected void unbind() { // MS-5451 Do not allow entrants to exceed the maximum number of entries per entrant var searchCompetitionEntries = new Search { Type = msCompetitionEntry.CLASS_NAME }; searchCompetitionEntries.AddCriteria(Expr.Equals("Entrant", ConciergeAPI.CurrentEntity.ID)); searchCompetitionEntries.AddCriteria(Expr.Equals("Competition", targetCompetition.ID)); searchCompetitionEntries.AddCriteria(Expr.Equals("Status", targetCompetitionInfo.SubmittedStatusId)); var searchResultsCompetitionEntries = APIExtensions.GetSearchResult(searchCompetitionEntries, 0, null); if (!targetCompetitionInfo.CanEnter || searchResultsCompetitionEntries.TotalRowCount >= targetCompetition.MaximumNumberOfEntriesPerEntrant) { QueueBannerMessage("Please ensure that the competition is still open and that you will not exceed the maximum number of entries with this submission."); GoHome(); } targetCompetitionEntry.Name = tbEntryName.Text; targetCompetitionEntry.DateSubmitted = DateTime.UtcNow; if (MultiStepWizards.EnterCompetition.EntryFee != null) { targetCompetitionEntry.Status = targetCompetitionInfo.PendingPaymentStatusId; targetCompetitionEntry.EntryFee = MultiStepWizards.EnterCompetition.EntryFee.ID; } else { targetCompetitionEntry.Status = targetCompetitionInfo.SubmittedStatusId; } cfsEntryFields.Harvest(); }
protected void setExistingRegistrationCountLabel() { //Search for existing registrations for the current entity/event from the Concierge API Search sRegistered = new Search { Type = msEventRegistration.CLASS_NAME, Context = targetEvent.ID }; sRegistered.AddCriteria(Expr.Equals("Owner", targetEntity.ID)); sRegistered.AddCriteria(Expr.IsBlank("CancellationDate")); sRegistered.OutputColumns.Add(new SearchOutputColumn { Name = "Name", AggregateFunction = SearchOuputAggregate.Count }); // add one more criteria - we only care about existing if the name hasn't been changed sRegistered.AddCriteria(Expr.Equals("Name", targetEntity.Name)); registrationsCount = (int)APIExtensions.GetSearchResult(sRegistered, 0, null).Table.Rows[0]["Name"]; //Display a message if there are existing registrations for the current entity if (registrationsCount > 0) { lblExistingRegistration.Text = string.Format("Note, you already have {0} registration(s) for this event.", registrationsCount); lblExistingRegistration.Visible = true; } }
private void SubmitForm() { targetInstance = APIExtensions.SaveObject(targetInstance); // ok, log an activity if (ConciergeAPI.CurrentEntity != null) { if (targetForm.ActivityType != null) { msActivity a = CreateNewObject <msActivity>(); a.Type = targetForm.ActivityType; a.Name = targetForm.Name; a.Date = DateTime.Now; a.Entity = ConciergeAPI.CurrentEntity.ID; SaveObject(a); } // ok, send an email if (!string.IsNullOrWhiteSpace(targetForm.ConfirmationEmail)) { using (var api = GetServiceAPIProxy()) { var emailTemplate = api.Get(targetForm.ConfirmationEmail).ResultValue.ConvertTo <msEmailTemplateContainer>(); api.SendTransactionalEmail(emailTemplate.Name, CurrentEntity.ID, null); } } } }
private SearchResult findComponent() { Search s = new Search(msCertificationComponent.CLASS_NAME); s.AddCriteria(Expr.Equals("Code", tbComponentID.Text.Trim())); int number; if (int.TryParse(tbComponentID.Text, out number)) { s.AddCriteria(Expr.Equals("LocalID", number)); } s.GroupType = SearchOperationGroupType.Or; // either or s.AddOutputColumn("Name"); s.AddOutputColumn("Code"); s.AddOutputColumn("LocalID"); s.AddOutputColumn(msCertificationComponent.FIELDS.StartDate); s.AddOutputColumn(msCertificationComponent.FIELDS.Description); s.AddOutputColumn(msCertificationComponent.FIELDS.AllowPartialParticipation); s.AddOutputColumn("Address"); var result = APIExtensions.GetSearchResult(s, 0, 1); return(result); }
/// <summary> /// This addition to the MembershipLogic class assumes that all associations, at minimum, /// define an active membership as having ReceivesMemberBenefits == true and the termination /// date is either null or in the future. /// </summary> /// <param name="entityId">Entity to check Membership for.</param> /// <returns>True if the Entity is a Member.</returns> public static bool IsActiveMember(string entityId) { if (string.IsNullOrWhiteSpace(entityId)) { return(false); } var key = string.Format(IsActiveMemberCacheKeyTemplate, entityId); var isActiveMember = SessionManager.Get <bool?>(key, () => { var search = new Search("MembershipWithFlowdown"); search.AddCriteria(Expr.Equals(msMembership.FIELDS.Owner, entityId)); search.AddCriteria(Expr.Equals(msMembership.FIELDS.ReceivesMemberBenefits, true)); var sog = new SearchOperationGroup { GroupType = SearchOperationGroupType.Or }; sog.Criteria.Add(Expr.IsBlank(msMembership.FIELDS.TerminationDate)); sog.Criteria.Add(Expr.IsGreaterThan(msMembership.FIELDS.TerminationDate, DateTime.Today.Date)); search.AddCriteria(sog); var result = APIExtensions.GetSearchResult(search, 0, 1); return(result != null && result.TotalRowCount > 0); }); return(isActiveMember.HasValue && isActiveMember.Value); }
protected void getLeader() { Search sLeaders = GetChapterLeaderSearch(targetChapter.ID); SearchResult srLeaders = APIExtensions.GetSearchResult(sLeaders, 0, 1); leader = ConvertLeaderSearchResult(srLeaders); }
protected override void InitializePage() { base.InitializePage(); // load the types Search s = new Search(msCEUType.CLASS_NAME); s.AddOutputColumn("Name"); s.AddSortColumn("DisplayOrder"); s.AddSortColumn("Name"); foreach (DataRow dr in APIExtensions.GetSearchResult(s, 0, null).Table.Rows) { ddlType.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString())); } if (targetCredit != null) { ddlType.ClearSelection(); ListItem li = ddlType.Items.FindByValue(targetCredit.Type); if (li == null) { li = new ListItem(targetCredit.Type); ddlType.Items.Add(li); } li.Selected = true; dpDate.SelectedDate = targetCredit.CreditDate; tbQuantity.Text = targetCredit.Quantity.ToString(); tbNotes.Text = targetCredit.Notes; } }
protected override void InitializePage() { base.InitializePage(); Search s = new Search(msExhibitor.CLASS_NAME); s.AddCriteria(Expr.Equals(msExhibitor.FIELDS.Show, targetShow.ID)); s.AddSortColumn("Name"); s.AddOutputColumn("AssignedBooths"); s.AddOutputColumn("Name"); s.AddOutputColumn("Logo"); s.AddOutputColumn("Bio"); var dt = APIExtensions.GetSearchResult(s, 0, null).Table; if (dt.Rows.Count > 0) { lNoExhibitors.Visible = false; rptExhibitors.DataSource = dt; rptExhibitors.DataBind(); } CustomTitle.Text = string.Format("{0} Exhibitor Listing", targetShow.Name); }
private void ApplyInventory(DataTable productData) { // Initialize the Dictionary with the ProductIDs as keys var inventoriedProducts = (from DataRow dr in productData.Rows where Convert.ToBoolean(dr["TrackInventory"]) && !Convert.ToBoolean(dr["AllowBackOrders"]) select dr["ID"].ToString()).ToDictionary(k => k, v => 0m); if (inventoriedProducts.Count > 0) { var inventorySearch = new Search(msStockItemInventory.CLASS_NAME); inventorySearch.AddOutputColumn("Product"); inventorySearch.AddOutputColumn("QuantityAvailable"); inventorySearch.AddCriteria(Expr.IsOneOfTheFollowing("Product", inventoriedProducts.Keys.ToList())); inventorySearch.AddCriteria(Expr.IsGreaterThan("QuantityAvailable", 0)); var inventoryResults = APIExtensions.GetSearchResult(inventorySearch, 0, null); foreach (DataRow dr in inventoryResults.Table.Rows) { inventoriedProducts[Convert.ToString(dr["Product"])] += Convert.ToDecimal(dr["QuantityAvailable"]); } foreach (DataRow dr in productData.Rows) { var productId = Convert.ToString(dr["ID"]); if (inventoriedProducts.ContainsKey(productId)) { dr["QuantityAvailable"] = inventoriedProducts[productId]; } } } }
public static async Task <bool> Message(this VRCSharpSession session, APIUser user, string Message, string worldIdWithTags) { HttpClientHandler handler = null; HttpClient client = new HttpClient(); if (session.UseProxies) { //Load proxies from Proxies.txt handler = new HttpClientHandler(); handler.Proxy = APIExtensions.GetRandomProxy(); client = new HttpClient(handler); } client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Add("Authorization", session.AuthToken); var payload = JsonConvert.SerializeObject(new InvitePayload() { message = "", type = "invite", details = new Details($"{session.Info.displayName} said: {Message}", worldIdWithTags) }); var response = await client.PostAsync($"https://vrchat.com/api/1/user/{user.id}/notification?apiKey={GlobalVars.ApiKey}", new StringContent(payload, Encoding.UTF8, "application/json")); Console.WriteLine(payload.ToString()); if (response.StatusCode == HttpStatusCode.OK) { return(true); } else { return(false); } }
private void initializeRegistrations() { Search s = new Search(msEventRegistration.CLASS_NAME); s.Context = targetEvent.ID; s.AddCriteria(Expr.Equals("Group", targetOrganization.ID)); s.AddOutputColumn("Owner.LocalID"); s.AddOutputColumn("Owner.Name"); s.AddOutputColumn("Fee.Name"); s.AddOutputColumn("Owner.LocalID"); s.AddOutputColumn(msRegistrationBase.FIELDS.CancellationDate); var dt = APIExtensions.GetSearchResult(s, 0, null).Table; dt.Columns.Add("Status"); foreach (DataRow dr in dt.Rows) { if (dr["CancellationDate"] != DBNull.Value) { dr["Status"] = "Cancelled"; } else { dr["Status"] = "Active"; } } gvRegistrants.DataSource = dt; gvRegistrants.DataBind(); }
protected override void InitializeTargetObject() { base.InitializeTargetObject(); var targetObject = APIExtensions.LoadObjectFromAPI(ContextID); if (targetObject == null) { GoToMissingRecordPage(); return; } switch (targetObject.ClassType) { case msDiscussionTopic.CLASS_NAME: targetDiscussionTopic = targetObject.ConvertTo <msDiscussionTopic>(); targetForum = LoadObjectFromAPI <msForum>(targetDiscussionTopic.Forum); TargetDiscussionBoard = LoadObjectFromAPI <msDiscussionBoard>(targetForum.DiscussionBoard); break; case msForum.CLASS_NAME: targetForum = targetObject.ConvertTo <msForum>(); TargetDiscussionBoard = LoadObjectFromAPI <msDiscussionBoard>(targetForum.DiscussionBoard); break; case msDiscussionBoard.CLASS_NAME: TargetDiscussionBoard = targetObject.ConvertTo <msDiscussionBoard>(); break; } if (targetObject.ParentTypes.Contains(msDiscussionBoard.CLASS_NAME)) { TargetDiscussionBoard = targetObject.ConvertTo <msDiscussionBoard>(); } }
public static async Task <FriendStatus> Friend(this VRCSharpSession session, APIUser User) { HttpClientHandler handler = null; HttpClient client = new HttpClient(); if (session.UseProxies) { //Load proxies from Proxies.txt handler = new HttpClientHandler(); handler.Proxy = APIExtensions.GetRandomProxy(); client = new HttpClient(handler); } client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Add("Authorization", session.AuthToken); var payload = JsonConvert.SerializeObject(new FriendRequest() { _params = new FriendRequest.Params() { userId = User.id } }); var response = await client.PostAsync($"https://vrchat.com/api/1/user/{User.id}/friendRequest?apiKey={GlobalVars.ApiKey}", new StringContent(payload, Encoding.UTF8, "application/json")); if (response.StatusCode == HttpStatusCode.OK) { return(JsonConvert.DeserializeObject <FriendStatus>(await response.Content.ReadAsStringAsync())); } else { return(null); } }
protected void rgAllGifts_OnNeedDataSource(object sender, GridNeedDataSourceEventArgs e) { Search s = new Search { Type = msGift.CLASS_NAME }; s.AddOutputColumn("ID"); s.AddOutputColumn("Date"); s.AddOutputColumn("Fund.Name"); s.AddOutputColumn("Type"); s.AddOutputColumn("LocalID"); s.AddOutputColumn("Total"); s.AddCriteria(Expr.Equals("Donor.ID", ConciergeAPI.CurrentEntity.ID)); var result = APIExtensions.GetSearchResult(s, 0, null); if (result.Table != null) { rgAllGifts.DataSource = result.Table; } rgAllGifts.VirtualItemCount = result.TotalRowCount; lNoGifts.Visible = result.TotalRowCount == 0; rgAllGifts.Visible = !lNoGifts.Visible; }
protected void loadDataFromConcierge(IConciergeAPIService serviceProxy) { targetCompetition = serviceProxy.LoadObjectFromAPI <msCompetition>(ContextID); if (targetCompetition == null) { GoToMissingRecordPage(); return; } targetEntryInfo = targetCompetition.GetCompetitionEntryInformation(); // now check judging if (ConciergeAPI.CurrentEntity == null) { return; } Search s = new Search("JudgingTeamMember"); s.AddOutputColumn("Team.ID"); s.AddCriteria(Expr.Equals("Team.Competition.ID", targetCompetition.ID)); s.AddCriteria(Expr.Equals("Member.ID", ConciergeAPI.CurrentEntity.ID)); SearchResult sr = APIExtensions.GetSearchResult(s, 0, 1); if (sr.TotalRowCount > 0 && sr.Table != null && sr.Table.Rows.Count > 0) { judgingTeamID = sr.Table.Rows[0]["Team.ID"].ToString(); } }
protected msIndividual unbindAndSearch(string emailAddress) { Search sIndividual = new Search(msIndividual.CLASS_NAME); sIndividual.AddOutputColumn("ID"); sIndividual.AddOutputColumn("Name"); sIndividual.AddOutputColumn("FirstName"); sIndividual.AddOutputColumn("LastName"); SearchOperationGroup emailGroup = new SearchOperationGroup(); emailGroup.FieldName = "EmailAddress"; emailGroup.GroupType = SearchOperationGroupType.Or; emailGroup.Criteria.Add(Expr.Equals("EmailAddress", emailAddress)); emailGroup.Criteria.Add(Expr.Equals("EmailAddress2", emailAddress)); emailGroup.Criteria.Add(Expr.Equals("EmailAddress3", emailAddress)); sIndividual.AddCriteria(emailGroup); sIndividual.AddSortColumn("LastName"); sIndividual.AddSortColumn("FirstName"); SearchResult srIndividual = APIExtensions.GetSearchResult(sIndividual, 0, null); if (srIndividual.Table.Rows.Count > 0) { return(LoadObjectFromAPI <msIndividual>(srIndividual.Table.Rows[0]["ID"].ToString())); } return(null); }
/// <summary> /// Initializes the target object for the page /// </summary> /// <remarks>Many pages have "target" objects that the page operates on. For instance, when viewing /// an event, the target object is an event. When looking up a directory, that's the target /// object. This method is intended to be overriden to initialize the target object for /// each page that needs it.</remarks> protected override void InitializeTargetObject() { base.InitializeTargetObject(); Search sDefaultMemOrg = new Search { Type = msMembershipOrganization.CLASS_NAME }; sDefaultMemOrg.AddOutputColumn("ID"); sDefaultMemOrg.AddOutputColumn(msMembershipOrganization.FIELDS.MembersCanJoinThroughThePortal); sDefaultMemOrg.AddCriteria(string.IsNullOrWhiteSpace(ContextID) ? Expr.Equals("IsDefault", true) : Expr.Equals("ID", ContextID)); SearchResult srDefaultMemOrg = APIExtensions.GetSearchResult(sDefaultMemOrg, 0, null); if (srDefaultMemOrg != null && srDefaultMemOrg.Table != null && srDefaultMemOrg.Table.Rows.Count > 0) { drMembershipOrganization = srDefaultMemOrg.Table.Rows[0]; } targetEntity = MultiStepWizards.RenewMembership.Entity ?? (!string.IsNullOrWhiteSpace(EntityID) ? LoadObjectFromAPI <msEntity>(EntityID) : CurrentEntity); if (drMembershipOrganization == null) { GoToMissingRecordPage(); return; } }
protected override void InitializePage() { base.InitializePage(); // check for failed deferred billing schedules Search sBillingSchedule = new Search(msBillingSchedule.CLASS_NAME); sBillingSchedule.AddCriteria(Expr.Equals("Order.BillTo", CurrentEntity.ID)); sBillingSchedule.AddCriteria(Expr.Equals(msBillingSchedule.FIELDS.Status, "Suspended")); sBillingSchedule.AddOutputColumn("Order.Name"); sBillingSchedule.AddOutputColumn("Order.Date"); sBillingSchedule.AddOutputColumn("Order.Total"); sBillingSchedule.AddOutputColumn("Order.Memo"); var results = APIExtensions.GetSearchResult(sBillingSchedule, 0, null); if (results.TotalRowCount == 1) // just redirect { Response.Redirect("RectifySuspendedBillingSchedule.aspx?contextID=" + results.Table.Rows[0]["ID"]); } gvTransactions.DataSource = results.Table; gvTransactions.DataBind(); }
public ActionResult Delete(FastPayWay FastPayWay) { if (FastPayWay.Id != 0) { FastPayWay = Entity.FastPayWay.FirstOrDefault(n => n.Id == FastPayWay.Id); } if (FastPayWay == null) { ViewBag.ErrorMsg = "数据不存在"; return(View("Error")); } try { Entity.FastPayWay.DeleteObject(FastPayWay); Entity.SaveChanges(); APIExtensions.ClearCacheAll(); ViewBag.Msg = "删除成功"; return(View("Succeed")); } catch { ViewBag.Msg = "删除失败"; return(View("Error")); } }
protected void wzEnterInfo_StepChanged(object sender, EventArgs e) { switch (wzEnterInfo.ActiveStepIndex) { // MS-5360 case 0: DeleteCurrentForm(); break; case 1: CustomFieldSet1.Harvest(); // MS-5360 targetInstance = APIExtensions.SaveObject(targetInstance); CurrentFormID.Value = targetInstance["ID"].ToString(); CustomFieldSet2.MemberSuiteObject = targetInstance; CustomFieldSet2.Bind(); break; case 2: SubmitForm(); if (ConciergeAPI.CurrentEntity == null && targetForm.AnonymousSubmissionCompletionUrl != null) { wzEnterInfo.FinishDestinationPageUrl = targetForm.AnonymousSubmissionCompletionUrl; } wzEnterInfo.DisplayCancelButton = false; break; } }
private void bindExhibitorMerchandise() { var s = new Search(msExhibitorMerchandise.CLASS_NAME); s.AddCriteria(Expr.Equals("Show", targetShow.ID)); s.AddCriteria(Expr.Equals("IsActive", true)); s.AddCriteria(Expr.Equals("SellOnline", true)); s.AddSortColumn("DisplayOrder"); s.AddSortColumn("Name"); var products = new List <string>(); foreach (System.Data.DataRow dr in APIExtensions.GetSearchResult(s, 0, null).Table.Rows) { products.Add(Convert.ToString(dr["ID"])); } if (products.Count > 0) { divOtherProducts.Visible = true; using (var api = GetServiceAPIProxy()) { var describedProducts = api.DescribeProducts(targetEntity.ID, products).ResultValue; rptAdditionalItems.DataSource = describedProducts; rptAdditionalItems.DataBind(); } } }
protected override void InitializePage() { base.InitializePage(); using (var api = GetServiceAPIProxy()) { foldersAndFiles = api.DescribeFolder(targetFolder.ID).ResultValue; DocumentsLogic.SetupContextAndParentFolders(api, targetFolder, hlFolderContext, foldersAndFiles, rptParentFolders, true); // get the folder path lblSourceFolder.Text = DocumentsLogic.GetFolderPath(api, targetFolder.ID) + @"\" + targetFile.Name; } Search sFolders = new Search(msFileFolder.CLASS_NAME); sFolders.AddCriteria(Expr.Equals("FileCabinet", targetFolder.FileCabinet)); sFolders.AddOutputColumn("FolderPath"); sFolders.AddSortColumn("FolderLevel"); sFolders.AddSortColumn("Name"); ddlDestination.DataSource = APIExtensions.GetSearchResult(sFolders, 0, null).Table; ddlDestination.DataTextField = "FolderPath"; ddlDestination.DataValueField = "ID"; ddlDestination.DataBind(); ddlDestination.Items.Insert(0, new ListItem("--- Select a Destination Folder ---", "")); }
/// <summary> /// This will tell you if a msEntity is in the applicable membership type /// </summary> /// <returns></returns> private bool isInApplicableMembershipType() { // We need to now check the Membership Type to see if the if (!targetCommittee.RestrictByMembershipType) { return(true); // ok, we're good } Search s = new Search { Type = "MembershipWithFlowDown" }; s.AddOutputColumn("Type"); s.AddCriteria(Expr.Equals("Owner", ConciergeAPI.CurrentEntity.ID)); var searchReult = APIExtensions.GetSearchResult(s, 0, null); if (searchReult.TotalRowCount > 0) { var aMembershipTypes = targetCommittee["ApplicableOpenMembershipTypes"] as List <string>; var dr = searchReult.Table.Rows[0]; if (aMembershipTypes == null) { return(false); } return(dr.ItemArray.Any(item => aMembershipTypes.Contains(item.ToString()))); } return(false); }
//MS-4881 protected DataTable LoadDataFromConcierge(bool currentContacts, int start, int count, out int totalCount) { var searches = new List <Search>(); // Relationships var sRelationships = new Search("RelationshipsForARecord") { ID = msRelationship.CLASS_NAME, Context = targetOrganization.ID }; sRelationships.AddOutputColumn("ID"); sRelationships.AddOutputColumn("RightSide_Individual.LocalID"); sRelationships.AddOutputColumn("Target_ID"); sRelationships.AddOutputColumn("Target_Name"); sRelationships.AddOutputColumn("IsActive"); sRelationships.AddOutputColumn("RightSide_Individual.EmailAddress"); sRelationships.AddOutputColumn("RelationshipTypeName"); sRelationships.AddCriteria(Expr.IsNotBlank("RightSide_Individual.Name")); // bring individuals over only MS-4426 sRelationships.AddCriteria(Expr.Equals("IsActive", currentContacts)); sRelationships.AddSortColumn("Target_Name"); searches.Add(sRelationships); var searchResults = APIExtensions.GetMultipleSearchResults(searches, start, count); var srRelationships = searchResults.Single(x => x.ID == msRelationship.CLASS_NAME); totalCount = srRelationships.TotalRowCount; return(srRelationships.Table); }
protected void loadDataFromConcierge() { Search sScoringCriterion = new Search(msScoringCriterion.CLASS_NAME); sScoringCriterion.AddOutputColumn("Name"); sScoringCriterion.AddOutputColumn("Description"); sScoringCriterion.AddOutputColumn("MinimumScore"); sScoringCriterion.AddOutputColumn("MaximumScore"); sScoringCriterion.AddOutputColumn("AllowDecimalScores"); sScoringCriterion.AddCriteria(Expr.Equals("Competition", targetCompetitionEntry.Competition)); sScoringCriterion.AddSortColumn("DisplayOrder"); SearchResult srScoringCriterion = APIExtensions.GetSearchResult(sScoringCriterion, 0, null); dtScoringCriterion = srScoringCriterion.Table; DataColumn scScore = dtScoringCriterion.Columns.Add("Score", typeof(decimal)); foreach (DataRow drScoringCriterion in dtScoringCriterion.Rows) { DataRow criterion = drScoringCriterion; msScoreCardScore scoreCardScore = targetScoreCard.Scores.Where(x => x.Criterion == criterion["ID"].ToString()).SingleOrDefault(); if (scoreCardScore != null) { drScoringCriterion[scScore] = scoreCardScore.Score; } } }
protected void loadDataFromConcierge() { Search sLeaders = GetOrganizationalLayerLeaderSearch(targetOrganizationalLayer.ID); SearchResult srLeaders = APIExtensions.GetSearchResult(sLeaders, 0, 1); leader = ConvertLeaderSearchResult(srLeaders); }
/// <summary> /// Executes a search against the Concierge API for committee memberships related to the current entity /// </summary> /// <returns></returns> private void loadDataFromConcierge() { Search s = new Search { Type = msCommitteeMembership.CLASS_NAME }; s.AddOutputColumn("Committee.ID"); s.AddOutputColumn("Committee.Name"); s.AddOutputColumn("Term.Name"); s.AddOutputColumn("Position.Name"); s.AddOutputColumn("EffectiveStartDate"); s.AddOutputColumn("EffectiveEndDate"); s.AddOutputColumn("IsCurrent"); s.AddCriteria(Expr.Equals("Member.ID", ConciergeAPI.CurrentEntity.ID)); s.AddCriteria(Expr.Equals("Committee.ShowInPortal", true)); s.AddSortColumn("Committee.Name"); var searchResult = APIExtensions.GetSearchResult(s, 0, null); //Create a data view from the search results filtering on just current memberships dvCurrentCommitteeMemberships = new DataView(searchResult.Table); dvCurrentCommitteeMemberships.RowFilter = "IsCurrent=1"; //Create a data view from the search results filtering on non-current memberships dvPastCommitteeMemberships = new DataView(searchResult.Table); dvPastCommitteeMemberships.RowFilter = "IsCurrent=0"; }
protected void loadDataFromConcierge() { var searches = new List <Search>(); // Job Posting Locations var sLocations = new Search(msJobPostingLocation.CLASS_NAME); sLocations.AddOutputColumn("ID"); sLocations.AddOutputColumn("Name"); sLocations.AddSortColumn("Name"); searches.Add(sLocations); // Job Posting Categories var sCategories = new Search(msJobPostingCategory.CLASS_NAME); sCategories.AddOutputColumn("ID"); sCategories.AddOutputColumn("Name"); sCategories.AddSortColumn("Name"); searches.Add(sCategories); var results = APIExtensions.GetMultipleSearchResults(searches, 0, null); dvLocations = new DataView(results[0].Table); dvCategories = new DataView(results[1].Table); }
public static async Task <FriendRequestCancel> Unfriend(this VRCSharpSession session, APIUser User) { HttpClientHandler handler = null; HttpClient client = new HttpClient(); if (session.UseProxies) { //Load proxies from Proxies.txt handler = new HttpClientHandler(); handler.Proxy = APIExtensions.GetRandomProxy(); client = new HttpClient(handler); } client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Add("Authorization", session.AuthToken); var response = await client.DeleteAsync($"https://vrchat.com/api/1/user/{User.id}/friendRequest?apiKey={GlobalVars.ApiKey}"); if (response.StatusCode == HttpStatusCode.OK) { return(JsonConvert.DeserializeObject <FriendRequestCancel>(await response.Content.ReadAsStringAsync())); } else { return(null); } }