public async Task OnGetAsync(string returnUrl, string organisationType) { try { await SetViewData(); OrganisationTypes = new SelectList(await NodeContext.Org_tbTypes.OrderBy(t => t.OrganisationTypeCode).Select(t => t.OrganisationType).ToListAsync()); OrganisationStatuses = new SelectList(await NodeContext.Org_tbStatuses.OrderBy(t => t.OrganisationStatusCode).Select(t => t.OrganisationStatus).ToListAsync()); TaxCodes = new SelectList(await NodeContext.App_TaxCodes.OrderBy(t => t.TaxCode).Select(t => t.TaxCode).ToListAsync()); Orgs orgs = new(NodeContext); string organisatonType = string.IsNullOrEmpty(organisationType) ? OrganisationTypes.First().ToString() : await NodeContext.Org_tbTypes.Where(t => t.OrganisationType == organisationType).Select(t => t.OrganisationType).FirstOrDefaultAsync(); OrgEntry = new OrgData() { AccountName = string.Empty, OrganisationType = organisationType, OrganisationStatus = NodeContext.Org_tbStatuses.Where(t => t.OrganisationStatusCode == (short)NodeEnum.OrgStatus.Active).Select(t => t.OrganisationStatus).First(), TaxCode = await orgs.DefaultTaxCode() }; ReturnUrl = string.IsNullOrEmpty(returnUrl) ? "./Index" : returnUrl; } catch (Exception e) { NodeContext.ErrorLog(e); throw; } }
public override double[][] getData() { //////BOLL: MA(CLOSE, M); //////UB: BOLL + 2 * STD(CLOSE, M); //////LB: BOLL - 2 * STD(CLOSE, M); List <double> boll = new List <double>(); List <double> ub = new List <double>(); List <double> lb = new List <double>(); for (int i = 0; i < OrgData.Length; i++) { int M = _M; List <double> PastVal = null; if (i < M) { PastVal = OrgData.ToList <double>(); } else { PastVal = OrgData.ToList <double>().GetRange(OrgData.Length - M, M); } double std = ProbMath.CalculateStdDev(PastVal); double ma = PastVal.Average(); boll.Add(ma); ub.Add(ma + 2 * std); lb.Add(ma - 2 * std); } double[][] r = new double[3][]; r[0] = boll.ToArray(); r[1] = ub.ToArray(); r[2] = lb.ToArray(); _LastResult = r;//所有子类此方法内均需执行该语句 return(r); }
protected override void TimerCallback(object state) { // TODO: Do parallel work foreach (var whitelistedUrl in WhitelistedUrls) { var html = PrepareSource(whitelistedUrl); // Create a instance of the OrgData class, setting all the needed props // Then, save it on the DB var tabs = html.GetNodesByClass("pagehead-tabs-item"); // html.GetNodeByClass("org-name").InnerText var orgData = new OrgData { Name = whitelistedUrl.Split('/').Last(), Members = int.Parse(html.GetNodesByClass("js-profile-tab-count-container").First(node => node.Name.ToLowerInvariant() == "div").GetNodeByClass(countSelector).InnerText), Packages = GetCountFrom(tabs, 1), Projects = GetCountFrom(tabs, 3), Repositories = GetCountFrom(tabs, 0), Teams = GetCountFrom(tabs, 2), Date = DateTime.Now }; orgData.DoQuery(); } }
public override global::System.Data.DataSet Clone() { OrgData cln = ((OrgData)(base.Clone())); cln.InitVars(); cln.SchemaSerializationMode = this.SchemaSerializationMode; return(cln); }
public AlternativeType(OrgData data) { Name = "Alternative"; Field <IdGraphType>("Id", resolve: context => context.Source.Id.ToString()); Field <StringGraphType>("Value", resolve: context => context.Source.Value.ToString()); Field <StringGraphType>("Text", resolve: context => context.Source.Text.ToString()); Field <StringGraphType>("Type", resolve: context => context.Source.Type.ToString()); Field <ListGraphType <StringGraphType> >("Respondents", resolve: context => context.Source.Respondents); }
public QuestionType(OrgData data) { Name = "Question"; Field <IdGraphType>("Id", resolve: context => context.Source.Id.ToString()); Field <StringGraphType>("Type", resolve: context => context.Source.Type.ToString()); Field <StringGraphType>("Stem", resolve: context => context.Source.Stem.ToString()); Field <StringGraphType>("Topic", resolve: context => context.Source.Topic.ToString()); Field <ListGraphType <AlternativeType> >("Alternatives", resolve: context => context.Source.Alternatives); }
public MessageType(OrgData data) { Name = "Message"; Field <IdGraphType>("Id", resolve: context => context.Source.Id.ToString()); Field <PublicUserDataType>("From", resolve: context => data.GetUser(context.Source.From.ToString())); Field <PublicUserDataType>("To", resolve: context => data.GetUser(context.Source.To.ToString())); Field <StringGraphType>("Body", resolve: context => context.Source.Body.ToString()); Field <StringGraphType>("Type", resolve: context => context.Source.Type.ToString()); Field <BooleanGraphType>("Read", resolve: context => context.Source.Read.ToString()); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { OrgData ds = new OrgData(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
public SessionType(OrgData data) { Name = "Session"; Field <IdGraphType>("Id", resolve: context => context.Source.Id.ToString()); Field <StringGraphType>("Name", resolve: context => context.Source.Name.ToString()); Field <PublicUserDataType>("Leader", resolve: context => data.GetUser(context.Source.Leader.ToString())); Field <StringGraphType>("Status", resolve: context => context.Source.Status.ToString()); Field <ListGraphType <QuestionType> >("Questions", resolve: context => context.Source.Questions); Field <QuestionType>("CurrentQuestion", resolve: context => { return(context.Source.CurrentQuestion == null ? null : data.GetQuestion(context.Source.CurrentQuestion.ToString())); }); }
public AnswerType(OrgData data) { Name = "Answer"; Field <IdGraphType>("Id", resolve: context => context.Source.Id.ToString()); Field <SessionType>("Session", resolve: context => data.GetSession(context.Source.SessionId)); Field <QuestionType>("Question", resolve: context => data.GetQuestion(context.Source.QuestionId.ToString())); Field <AlternativeType>("Alternative", resolve: context => data.GetAlternative( context.Source.SessionId, context.Source.QuestionId, context.Source.AlternativeId )); Field <PublicUserDataType>("User", resolve: context => data.GetUser(context.Source.UserId.ToString())); Field <StringGraphType>("Value", resolve: context => context.Source.Value.ToString()); }
public NewUserType(OrgData data) { Name = "NewUser"; Field <StringGraphType>("employeeID", resolve: context => context.Source.EmployeeID.ToString()); Field <StringGraphType>("givenName", resolve: context => context.Source.GivenName.ToString()); Field <StringGraphType>("sN", resolve: context => context.Source.SN.ToString()); Field <StringGraphType>("title", resolve: context => context.Source.Title.ToString()); Field <StringGraphType>("description", resolve: context => context.Source.Description.ToString()); Field <StringGraphType>("department", resolve: context => context.Source.Department.ToString()); Field <StringGraphType>("manager", resolve: context => context.Source.Manager.ToString()); Field <StringGraphType>("physicalDeliveryOfficeName", resolve: context => context.Source.PhysicalDeliveryOfficeName.ToString()); Field <StringGraphType>("homeDirectoryServer", resolve: context => context.Source.HomeDirectoryServer.ToString()); Field <StringGraphType>("telephoneNumber", resolve: context => context.Source.TelephoneNumber.ToString()); Field <BooleanGraphType>("created", resolve: context => context.Source.Created.ToString()); }
private async Task <OrgData> GetOrgData() { using (System.Net.Http.HttpClient client = new System.Net.Http.HttpClient()) { client.DefaultRequestHeaders.Add("Authorization", "Bearer " + CloudProjectSettings.accessToken); var response = await client.GetAsync(String.Format("https://api.unity.com/v1/core/api/orgs/{0}", CloudProjectSettings.organizationId)); if (!response.IsSuccessStatusCode) { throw new Exception("Failed to retrieve org data."); } var data = await response.Content.ReadAsStringAsync(); return(OrgData.ParseOrgData(data)); } }
public string GetOrganization() { //首先获取第一层关系.数据库内ParentID等于0的数据有且只有一个,表示公司最高位 Mpr_Organization OneList = OrganizetionService.GetModel(s => s.ParentID == 0); OrgData OneOrgList = new OrgData(); if (OneList != null) { //加入第一层关系人 OneOrgList.id = OneList.ID; OneOrgList.name = OneList.Name; OneOrgList.title = OneList.Title; OneOrgList.photo = OneList.Photo; OneOrgList.workcard = OneList.WorkNo; OneOrgList.children = GetOrgList(OneList); } return(Newtonsoft.Json.JsonConvert.SerializeObject(OneOrgList)); }
public void ParseOrgData_ReturnsValidOrgData() { const string data = @"{ ""id"" : ""test_id"", ""name"" : ""test_name"", ""foreign_key"" : ""12345678909876"", ""billable_user_fk"" : 12345678909876, ""org_identifier"" : ""72f505cf-7149-44be-0000-12401583906f"", ""orgIdentifier"" : ""72f505cf-7149-44be-0000-12401583906f"" }"; var result = OrgData.ParseOrgData(data); Assert.AreEqual("test_id", result.id); Assert.AreEqual("test_name", result.name); Assert.AreEqual("12345678909876", result.foreign_key); Assert.AreEqual("12345678909876", result.billable_user_fk); Assert.AreEqual("72f505cf-7149-44be-0000-12401583906f", result.org_identifier); Assert.AreEqual("72f505cf-7149-44be-0000-12401583906f", result.orgIdentifier); }
public ADUserType(OrgData data) { Name = "ADUser"; Field <IdGraphType>("id", resolve: context => context.Source.Properties["sAMAccountName"].Value); Field <StringGraphType>("sAMAccountName", resolve: context => context.Source.Properties["sAMAccountName"].Value); Field <StringGraphType>("GivenName", resolve: context => context.Source.Properties["GivenName"].Value); Field <StringGraphType>("SN", resolve: context => context.Source.Properties["SN"].Value); Field <StringGraphType>("DisplayName", resolve: context => context.Source.Properties["DisplayName"].Value); Field <StringGraphType>("Description", resolve: context => context.Source.Properties["Description"].Value); Field <StringGraphType>("Department", resolve: context => context.Source.Properties["Department"].Value); Field <StringGraphType>("Mail", resolve: context => context.Source.Properties["Mail"].Value); Field <StringGraphType>("Title", resolve: context => context.Source.Properties["Title"].Value); Field <StringGraphType>("telephoneNumber", resolve: context => context.Source.Properties["telephoneNumber"].Value); Field <StringGraphType>("DistinguishedName", resolve: context => context.Source.Properties["DistinguishedName"].Value); Field <StringGraphType>("physicalDeliveryOfficeName", resolve: context => context.Source.Properties["physicalDeliveryOfficeName"].Value); Field <ListGraphType <ADGroupType> >("MemberOf", resolve: context => data.GetGroupNames((object[])context.Source.Properties["MemberOf"].Value)); Field <ListGraphType <MessageType> >("Messages", resolve: context => data.GetMessages(context.Source.Properties["sAMAccountName"].Value.ToString(), "pm")); Field <PublicUserDataType>("Manager", resolve: context => data.GetManager(context.Source.Properties["Manager"].Value)); Field <ListGraphType <PublicUserDataType> >("Employees", resolve: context => data.GetEmployees(context.Source.Properties["DistinguishedName"].Value)); }
public async Task Get_WithValidId_Within_CacheEntryExpirationDate_ShouldOnlyCallService_Once(string validId) { var cache = new MemoryCache(new MemoryCacheOptions()); var testData = new OrgData(validId, "testname", "test"); var mockedService = new Mock <IOrgDataService>(); mockedService .Setup(x => x.GetOrgDataById(validId)) .Returns(Task.FromResult <OrgData?>(testData)); var controller = new OrgDataController(mockedService.Object, cache); await controller.Get(validId); await controller.Get(validId); cache.Count.Should().Be(1); mockedService.Verify(x => x.GetOrgDataById(validId), Times.Once); }
public List <OrgData> GetOrgList(Mpr_Organization ParentMod) { List <OrgData> Orglist = new List <OrgData>(); //根据当前Mod获取当前最上级下所有夏季列表 List <Mpr_Organization> dbList = OrganizetionService.FindByParam(s => s.ParentID == ParentMod.ID && s.Status == 1, s => s.Sort); if (dbList.Count > 0) { foreach (var item in dbList) { OrgData OneOrgList = new OrgData(); //加入第一层关系人 OneOrgList.id = item.ID; OneOrgList.name = item.Name; OneOrgList.title = item.Title; OneOrgList.photo = item.Photo; OneOrgList.workcard = item.WorkNo; OneOrgList.children = GetOrgList(item); Orglist.Add(OneOrgList); } } return(Orglist); }
public async Task Get_WithInterval_Over_CacheEntryExpirationDate_ShouldCallServiceTwice() { var cache = new MemoryCache(new MemoryCacheOptions()); const string validId = "123123123"; var testData = new OrgData(validId, "testname", "test"); var mockedService = new Mock <IOrgDataService>(); mockedService .Setup(x => x.GetOrgDataById(validId)) .Returns(Task.FromResult <OrgData?>(testData)); var controller = new OrgDataController(mockedService.Object, cache); await controller.Get(validId); await Task.Delay(TimeSpan.FromSeconds(31)); await controller.Get(validId); cache.Count.Should().Be(1); mockedService.Verify(x => x.GetOrgDataById(validId), Times.Exactly(2)); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) { global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); OrgData ds = new OrgData(); global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny(); any1.Namespace = "http://www.w3.org/2001/XMLSchema"; any1.MinOccurs = new decimal(0); any1.MaxOccurs = decimal.MaxValue; any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any1); global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny(); any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"; any2.MinOccurs = new decimal(1); any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax; sequence.Items.Add(any2); global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute1.Name = "namespace"; attribute1.FixedValue = ds.Namespace; type.Attributes.Add(attribute1); global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute(); attribute2.Name = "tableTypeName"; attribute2.FixedValue = "OrgDetailsDataTable"; type.Attributes.Add(attribute2); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte()));) { ; } if ((s1.Position == s1.Length)) { return(type); } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return(type); }
public QuestionAnalysisType(OrgData data) { Name = "QuestionAnalysis"; Field <StringGraphType>("Id", resolve: context => context.Source.Id.ToString()); Field <IntGraphType>("Count", resolve: context => context.Source.Count); }
public void ParseOrgData_ThrowsException() { const string data = "invalid data"; Assert.Throws <ArgumentException>(() => { OrgData.ParseOrgData(data); }); }
public Mutations(OrgData data, IHttpContextAccessor accessor) { Name = "Mutation"; /* Messages */ /* Update */ Field <MessageType>( "markAsRead", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "id", Description = "message id" } ), resolve: context => { return(data.MarkMessageAsRead(context.GetArgument <string>("id"))); } ); /* Users */ /* Update */ Field <NewUserType>( "createUser", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <NewUserInputType> > { Name = "user", Description = "updated user fields" } ), resolve: context => { return(data.CreateUser(context.GetArgument <NewUser>("user"))); } ); Field <ADUserType>( "updateADUser", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "id", Description = "user id" }, new QueryArgument <NonNullGraphType <ADUserInputType> > { Name = "user", Description = "updated user fields" } ), resolve: context => { return(data.UpdateADUser((WindowsIdentity)accessor.HttpContext.User.Identity, context.GetArgument <string>("id"), context.GetArgument <Dictionary <string, dynamic> >("user"))); } ); /* Questions */ /* Create */ Field <QuestionType>( "addQuestion", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <QuestionInputType> > { Name = "question", Description = "question fields" } ), resolve: context => { return(data.AddQuestion(context.GetArgument <Question>("question"))); } ); /* Update */ Field <QuestionType>( "updateQuestion", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "id", Description = "question id" }, new QueryArgument <NonNullGraphType <QuestionInputType> > { Name = "question", Description = "updated question fields" } ), resolve: context => { return(data.UpdateQuestion(context.GetArgument <string>("id"), context.GetArgument <Dictionary <string, dynamic> >("question"))); } ); //Field<QuestionType>( // "answerQuestion", // arguments: new QueryArguments( // new QueryArgument<NonNullGraphType<StringGraphType>> { Name = "id", Description = "question id" }, // new QueryArgument<NonNullGraphType<StringGraphType>> { Name = "username", Description = "username" } // ), // resolve: context => // { // return data.AnswerQuestion(context.GetArgument<string>("id"), context.GetArgument<string>("username")); // } //); /* Sessions */ /* Create */ Field <SessionType>( "createSession", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <SessionInputType> > { Name = "session", Description = "session fields" } ), resolve: context => { return(data.CreateSession(context.GetArgument <Session>("session"))); } ); /* Update */ Field <SessionType>( "addQuestionsToSession", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "id", Description = "session id" }, new QueryArgument <ListGraphType <StringGraphType> > { Name = "questions", Description = "question ids" } ), resolve: context => { return(data.AddQuestionsToSession(context.GetArgument <string>("id"), context.GetArgument <List <string> >("questions"))); } ); Field <SessionType>( "setSessionStatus", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "id", Description = "session id" }, new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "status", Description = "session status" } ), resolve: context => { return(data.SetSessionStatus(context.GetArgument <string>("id"), context.GetArgument <string>("status"))); } ); Field <SessionType>( "askQuestion", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "sessionId", Description = "session id" }, new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "questionId", Description = "question id" } ), resolve: context => { return(data.AskQuestion(context.GetArgument <string>("sessionId"), context.GetArgument <string>("questionId"))); } ); /* Answers */ /* Create */ Field <AnswerType>( "answerQuestion", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <AnswerInputType> > { Name = "answer", Description = "answer" } ), resolve: context => { return(data.AnswerQuestion(context.GetArgument <Answer>("answer"))); } ); }
OrgData SetLocalOrg(OrgData orgdata) { SessionManager.CurrentObject = orgdata; return(LocalOrg()); }
public ADGroupType(OrgData data) { Field <StringGraphType>("Name", resolve: context => context.Source.Name); Field <StringGraphType>("DistinguishedName", resolve: context => context.Source.DistinguishedName); }
public async override void OnOpen() { options.Add(new BuiltInOption()); options.Add(new EditorHostedOption()); options.Add(new CCDOption()); options.Add(new CustomOption()); var blackTexture = new Texture2D(2, 2); blackTexture.SetPixels(new Color[4] { Color.black, Color.black, Color.black, Color.black }); blackTexture.Apply(); dropdownTitleStyle = new GUIStyle() { name = "datasource-dropdown-title", alignment = TextAnchor.MiddleCenter, fontSize = 12, fontStyle = FontStyle.Bold, fixedHeight = 26, border = new RectOffset(1, 1, 1, 1), normal = new GUIStyleState() { textColor = EditorGUIUtility.isProSkin ? Color.white : Color.black } }; menuOptionStyle = new GUIStyle() { name = "datasource-dropdown-option", alignment = TextAnchor.MiddleLeft, fontSize = 12, fontStyle = FontStyle.Normal, fixedHeight = 20, padding = new RectOffset(20, 2, 0, 0), normal = new GUIStyleState() { textColor = EditorGUIUtility.isProSkin ? Color.white : Color.black } }; horizontalBarStyle = new GUIStyle() { normal = { background = blackTexture, scaledBackgrounds = new Texture2D[1] { blackTexture } }, fixedHeight = 1, stretchHeight = false }; if (!string.IsNullOrEmpty(CloudProjectSettings.projectId)) { m_Organization = await GetOrgData(); } SyncProfileGroupTypes(); }
public Queries(OrgData data, IHttpContextAccessor accessor) { Name = "Query"; Field <ADUserType>("my", resolve: context => data.GetDirectoryEntry(accessor.HttpContext.User.Identity.Name.Split("\\")[1])); Field <ADUserType>( "directoryEntry", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "username", Description = "sAMAccountName of the directory entry" } ), resolve: context => data.GetDirectoryEntry(context.GetArgument <string>("username")) ); Field <ListGraphType <PublicUserDataType> >("users", resolve: context => data.GetAPHUsers()); Field <PublicUserDataType>( "user", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "username", Description = "sAMAccountName of the user" } ), resolve: context => data.GetUser(context.GetArgument <string>("username")) ); Field <ListGraphType <MessageType> >( "messages", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "type", Description = "message type" } ), resolve: context => data.GetMessages(accessor.HttpContext.User.Identity.Name.Split("\\")[1], context.GetArgument <string>("type")) ); Field <ListGraphType <QuestionType> >( "questions", resolve: context => data.GetQuestions() ); Field <ListGraphType <QuestionAnalysisType> >( "analyzeQuestion", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "sessionId", Description = "session id" }, new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "questionId", Description = "question id" } ), resolve: context => data.AnalyzeSessionQuestion(context.GetArgument <string>("sessionId"), context.GetArgument <string>("questionId")) ); Field <ListGraphType <StringGraphType> >( "getRespondents", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "sessionId", Description = "session id" }, new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "questionId", Description = "question id" } ), resolve: context => data.GetRespondents(context.GetArgument <string>("sessionId"), context.GetArgument <string>("questionId")) ); Field <QuestionType>( "question", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "id", Description = "question id" } ), resolve: context => data.GetQuestion(context.GetArgument <string>("id")) ); Field <SessionType>( "session", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "id", Description = "session id" } ), resolve: context => data.GetSession(context.GetArgument <string>("id")) ); Field <ListGraphType <SessionType> >( "sessions", resolve: context => data.GetSessions() ); Field <ListGraphType <AnswerType> >( "answers", resolve: context => data.GetAnswers() ); Field <ListGraphType <AnswerType> >( "answersForSessionQuestion", arguments: new QueryArguments( new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "sessionId", Description = "session id" }, new QueryArgument <NonNullGraphType <StringGraphType> > { Name = "questionId", Description = "question id" } ), resolve: context => data.GetAnswers(context.GetArgument <string>("sessionId"), context.GetArgument <string>("questionId")) ); Field <ListGraphType <NewUserType> >( "newUsers", resolve: context => data.GetNewUsers() ); }