private NewOrganizationsResponse GetOrganizations(string api_token, string inst_key = "") { LoginProvider lp = new LoginProvider(); ApiUser hdUser = new ApiUser(api_token); Micajah.Common.Bll.OrganizationCollection orgsMc = lp.GetOrganizationsByLoginId(hdUser.LoginId); List <Organization> orgs = new List <Organization>(orgsMc.Count); string org_key = ""; foreach (Micajah.Common.Bll.Organization orgMc in orgsMc) { try { var torg = new Organization(orgMc, lp.GetLoginInstances(hdUser.LoginId, orgMc.OrganizationId)); orgs.Add(torg); if (torg.Instances[0].Key == inst_key) { org_key = torg.Key; } } catch { } } var org = new NewOrganizationsResponse { organizations = orgs }; if (!string.IsNullOrEmpty(inst_key)) { org.organization = org_key; org.instance = inst_key; org.api_token = api_token; } var o = from element in org.organizations orderby element.is_trial select element; o = from element in o orderby element.is_expired select element; org.organizations = o.ToList(); return(org); }
public object Any(Organizations request) { Micajah.Common.Bll.Providers.LoginProvider lp = new Micajah.Common.Bll.Providers.LoginProvider(); ApiUser hdUser = new ApiUser(request.api_token); Micajah.Common.Bll.OrganizationCollection orgsMc = lp.GetOrganizationsByLoginId(hdUser.LoginId); List <Organization> orgs = new List <Organization>(orgsMc.Count); foreach (Micajah.Common.Bll.Organization orgMc in orgsMc) { try { orgs.Add(new Organization(orgMc, lp.GetLoginInstances(hdUser.LoginId, orgMc.OrganizationId))); } catch { } } return(orgs); }