public JsonResult GetOrganizationById(int id) { orgService = new OrganizationServices(); var response = orgService.GetOrganizationById(id); return(Json(response, JsonRequestBehavior.AllowGet)); }
public string Organization2(string id) { int recordId = 0; var entity = new Organization(); bool skippingCache = FormHelper.GetRequestKeyValue("skipCache", false); List <string> messages = new List <string>(); if (int.TryParse(id, out recordId)) { entity = OrganizationServices.GetDetail(recordId, skippingCache); } else if (ServiceHelper.IsValidCtid(id, ref messages)) { entity = OrganizationServices.GetDetailByCtid(id, skippingCache); } else { return("ERROR - Invalid request. Either provide a CTID which starts with 'ce-' or the number. "); } //HttpContext.Server.ScriptTimeout = 300; if (entity.Id == 0) { return("ERROR - Invalid request - the record was not found. "); } ActivityServices.SiteActivityAdd("Organization", "View", "Detail", string.Format("User viewed Organization: {0} ({1})", entity.Name, entity.Id), 0, 0, recordId); string jsonoutput = JsonConvert.SerializeObject(entity, JsonHelper.GetJsonSettings()); HttpContext.Current.Response.ContentType = "application/json"; HttpContext.Current.Response.ContentEncoding = Encoding.UTF8; return(jsonoutput); }
public void BuildData() { data = new DataBuilder(contextBuilder) .CreateDummyOrganization().CreateDummyTerm().CreateDummyUserWithRoleToOrganization(RoleEnum.SuperAdmin); //data.createDummySchool() data.CreateDummySchool(data.organizationBuilder.organization.Id, false, false, true, false, 50); organizationServices = new OrganizationServices(contextBuilder.GetContext()); List <Organization> subOrganizations = organizationServices.GetSubOrganisations(data.organization.Id); List <Organization> classrooms = organizationServices.GetSubOrganisations(data.organization.Id) .Where(i => i.OrganTypeId == AppSettings.OrganizationTypeId.Classroom || i.OrganTypeId == AppSettings.OrganizationTypeId.ClassroomWithoutBranch).ToList(); data.CreateListDummyUserInRangeWithRoleToOrganization(subOrganizations.Where(i => i.OrganTypeId == AppSettings.OrganizationTypeId.School).FirstOrDefault(), RoleEnum.LeaderTeacher, 1); //Kullanacagim rehber ogretmeni sakliyorum leaderTeacher = data.user; students = new List <User>(); foreach (Organization item in classrooms) { students.AddRange(data.CreateListDummyUserInRangeWithRoleToOrganization(item, RoleEnum.Student, 1)); data.SetAccessClassroom(leaderTeacher, item.Id); } }
public bool AddRemoveService(int id, long organizationId, int serviceId, bool value) { StudentContext db = new StudentContext(); OrganizationServices orgService = db.OrganizationServices.SingleOrDefault(s => s.Id == id && s.OrganizationId == organizationId && s.ServiceId == serviceId); if (orgService != null) { orgService.StatusId = value ? 1 : 2; orgService.UpdatedBy = _userStatistics.UserId; orgService.UpdatedOn = DateTime.Now; } else { orgService = new OrganizationServices { StatusId = value ? 1 : 2, ServiceId = serviceId, OrganizationId = organizationId, InsertedBy = _userStatistics.UserId, InsertedOn = DateTime.Now, UpdatedOn = DateTime.Now }; db.OrganizationServices.Add(orgService); } db.SaveChanges(); return(true); }
// public ActionResult Organization(string id, string name = "") { //Organization entity = new Organization(); int orgId = 0; var entity = new Organization(); string refresh = Request.Params["refresh"]; bool skippingCache = FormHelper.GetRequestKeyValue("skipCache", false); List <string> messages = new List <string>(); if (int.TryParse(id, out orgId)) { entity = OrganizationServices.GetDetail(orgId, skippingCache); } else if (ServiceHelper.IsValidCtid(id, ref messages)) { entity = OrganizationServices.GetDetailByCtid(id, skippingCache); } else { SetPopupErrorMessage("ERROR - Enter the ctid which starts with 'ce' or Enter the id "); return(RedirectToAction("Index", "Home")); } if (entity.Id == 0) { SetPopupErrorMessage("ERROR - the requested Organization record was not found "); return(RedirectToAction("Index", "Home")); } ActivityServices.SiteActivityAdd("Organization", "View", "Detail", string.Format("User viewed Organization: {0} ({1})", entity.Name, entity.Id), 0, 0, orgId); return(View("~/Views/Detail/Detail.cshtml", entity)); }
// public JsonResult GetOrganizations(List <int> organizationIDs) { //Get the data var organizations = new List <MicroProfile>(); organizations = OrganizationServices.GetMicroProfile(organizationIDs); return(JsonHelper.GetJsonWithWrapper(organizations, true, "", null)); }
public SchoolBuilder(ContextBuilder contextBuilder) { this.contextBuilder = contextBuilder; this.userBuilder = new UserBuilder(contextBuilder.GetContext()); this.organizationServices = new OrganizationServices(contextBuilder.GetContext()); this.settingsServices = new SettingsServices(contextBuilder.GetContext()); CreateAlternativeSchool(); }
public static Organization ResolveAgentByCtid(string ctid) { Organization entity = OrganizationServices.GetSummaryByCtid(ctid); if (entity != null && entity.Id > 0) { } return(entity); }
// public JsonResult GetOrganizationDataForSelectedMicrosearchItems(List <int> organizationIDs) { var rawResults = new List <OrganizationSummary>(); var results = new List <MainSearchResult>(); foreach (var id in organizationIDs) { rawResults.Add(SimpleMap <OrganizationSummary>(OrganizationServices.GetBasic(id))); } results = new SearchServices().ConvertOrganizationResults(rawResults, 0, "organization").Results; return(JsonResponse(results, true, "", null)); }
public void BuildData() { contextBuilder.ClearAllContext(); organizationServices = new OrganizationServices(contextBuilder.GetContext()); //Create Data data = new DataBuilder(contextBuilder) .CreateDummyUser() .CreateOrganizationByType(OrganTypeEnum.Classroom) .SetRol(RoleEnum.Personnel); this.personnelUser = data.user; data.userBuilder.SetTemperament(contextBuilder.GetContext(), personnelUser.Id, 330); }
public void OrganizationOld(string id) { int recordId = 0; var entity = new Organization(); bool skippingCache = FormHelper.GetRequestKeyValue("skipCache", false); List <string> messages = new List <string>(); if (int.TryParse(id, out recordId)) { entity = OrganizationServices.GetDetail(recordId, skippingCache); } else if (ServiceHelper.IsValidCtid(id, ref messages)) { entity = OrganizationServices.GetDetailByCtid(id, skippingCache); } else { messages.Add("ERROR - Invalid request. Either provide a CTID which starts with 'ce-' or the number. "); } //HttpContext.Server.ScriptTimeout = 300; if (entity.Id == 0) { messages.Add("ERROR - Invalid request - the record was not found. "); } if (messages.Any()) { SendResponse(messages); //HttpContext.Current.Response.Clear(); //HttpContext.Current.Response.AppendHeader( "Access-Control-Allow-Origin", "*" ); //HttpContext.Current.Response.ContentType = "application/json"; //HttpContext.Current.Response.Write( messages ); //HttpContext.Current.Response.End(); } else { //map to new ActivityServices.SiteActivityAdd("Organization", "View", "Detail", string.Format("User viewed Organization: {0} ({1})", entity.Name, entity.Id), 0, 0, recordId); string jsonoutput = JsonConvert.SerializeObject(entity, JsonHelper.GetJsonSettings()); SendResponse(jsonoutput); //HttpContext.Current.Response.Clear(); //HttpContext.Current.Response.AppendHeader( "Access-Control-Allow-Origin", "*" ); //HttpContext.Current.Response.ContentType = "application/json"; //HttpContext.Current.Response.Write( jsonoutput ); //HttpContext.Current.Response.End(); } }
/// <summary> /// Initializes a new instance of the <see cref="StreakServices"/> class. /// </summary> /// <param name="apiKey">The API key.</param> /// <param name="apiBaseUrl">The API base URL.</param> /// <param name="includeRawResponse">if set to <c>true</c> [include raw JSON response from Streak API].</param> public StreakServices(string apiKey, string apiBaseUrl, bool includeRawResponse) { Users = new UserServices(apiKey, apiBaseUrl, includeRawResponse); Pipelines = new PipelineServices(apiKey, apiBaseUrl, includeRawResponse); Boxes = new BoxServices(apiKey, apiBaseUrl, includeRawResponse); Stages = new StageServices(apiKey, apiBaseUrl, includeRawResponse); Fields = new FieldServices(apiKey, apiBaseUrl, includeRawResponse); Contacts = new ContactServices(apiKey, apiBaseUrlv2, includeRawResponse); Organizations = new OrganizationServices(apiKey, apiBaseUrlv2, includeRawResponse); Tasks = new TaskServices(apiKey, apiBaseUrl, includeRawResponse); Files = new FileServices(apiKey, apiBaseUrl, includeRawResponse); Threads = new ThreadServices(apiKey, apiBaseUrl, includeRawResponse); Comments = new CommentServices(apiKey, apiBaseUrl, includeRawResponse); Snippets = new SnippetServices(apiKey, apiBaseUrl, includeRawResponse); }
public ActionResult V3() { var vm = new CompareItemSummary(); string credentialCompare = ""; string orgCompare = ""; string asmtCompare = ""; string loppCompare = ""; var lists = GetSessionItems(); foreach (var item in lists) { switch (item.Type) { case "credential": var entity = CredentialServices.GetCredentialForCompare(item.Id); vm.Credentials.Add(entity); ActivityServices.SiteActivityAdd("Credential", "View", "Compare", string.Format("User doing compare on Credential: {0} ({1})", entity.Name, entity.Id), 0, 0, entity.Id); break; case "organization": var org = OrganizationServices.GetDetail(item.Id); vm.Organizations.Add(org); ActivityServices.SiteActivityAdd("Organization", "View", "Compare", string.Format("User doing compare on Organization: {0} ({1})", org.Name, org.Id), 0, 0, org.Id); break; case "assessment": var asmt = AssessmentServices.GetDetail(item.Id); vm.Assessments.Add(asmt); ActivityServices.SiteActivityAdd("Assessment", "View", "Compare", string.Format("User doing compare on Assessment: {0} ({1})", asmt.Name, asmt.Id), 0, 0, asmt.Id); break; case "learningopportunity": var lopp = LearningOpportunityServices.GetDetail(item.Id); vm.LearningOpportunities.Add(lopp); ActivityServices.SiteActivityAdd("LearningOpportunity", "View", "Compare", string.Format("User doing compare on Learning opportunity: {0} ({1})", lopp.Name, lopp.Id), 0, 0, lopp.Id); break; default: break; } } return(View("CompareV3", vm)); }
public void BuildData() { contextBuilder.ClearAllContext(); organizationServices = new OrganizationServices(contextBuilder.GetContext()); //Create Data dataBuilder = new DataBuilder(contextBuilder) .CreateDummyOrganization() .CreateDummyTerm() .CreateDummyUserWithRoleToOrganization(RoleEnum.Operator); dataBuilder.CreateDummySchool(dataBuilder.organizationBuilder.organization.Id, true, true, true, true, 3); organizationServices = new OrganizationServices(contextBuilder.GetContext()); List <Organization> subOrganizations = organizationServices.GetSubOrganisations(dataBuilder.organization.Id); List <User> operatorUsers = new List <User>(); foreach (Organization item in subOrganizations) { if (item.OrganTypeId == AppSettings.OrganizationTypeId.School) { dataBuilder.CreateListDummyUserInRangeWithRoleToOrganization(item, RoleEnum.LeaderTeacher, 1); } else if (item.OrganTypeId == AppSettings.OrganizationTypeId.Classroom || item.OrganTypeId == AppSettings.OrganizationTypeId.ClassroomWithoutBranch) { dataBuilder.CreateListDummyUserInRangeWithRoleToOrganization(item, RoleEnum.Student, 20); dataBuilder.SetRoleToOrganization(dataBuilder.user, item, RoleEnum.LeaderTeacher); //data.createListDummyUserWithRoleToOrganization(item, RoleEnum.LeaderTeacher); } } foreach (Organization item in subOrganizations) { operatorUsers = dataBuilder.CreateListDummyUserInRangeWithRoleToOrganization(item, RoleEnum.Operator, 1); } operatorUser = operatorUsers[0]; dataBuilder.userBuilder.SetTemperament(contextBuilder.GetContext(), operatorUser.Id, 160); }
public AccountController() { //todo: use DI UserManager = System.Web.HttpContext.Current.GetOwinContext().GetUserManager <ApplicationUserManager>(); _organizationServices = new OrganizationServices(); }