/// <summary> /// Checks if custom url is exists in system /// </summary> /// <param name="partialCustomUrl">Partial Custom Url with out domain</param> /// <returns></returns> public static bool ValidateCustomUrl(string partialCustomUrl) { if (!string.IsNullOrEmpty(partialCustomUrl)) { using (CustomUrlTableAdapter adapter = new CustomUrlTableAdapter()) { using (MasterDataSet.CustomUrlDataTable table = adapter.GetCustomUrls(null, null, partialCustomUrl, partialCustomUrl)) { if (table.Count > 0) { return(false); } else { Organization org = null; string segment = RemoveSchemeFormUri(partialCustomUrl); if (segment.Contains("-")) { org = OrganizationProvider.GetOrganizationByPseudoId(segment.Split('-')[0]); } else { org = OrganizationProvider.GetOrganizationByPseudoId(segment); } if (org == null) { MasterDataSet.CustomUrlRow row = GetCustomUrl(segment); if (row != null) { org = OrganizationProvider.GetOrganization(row.OrganizationId); } } return(org == null); } } } } return(false); }
private object DeleteOrganization(string id) { Micajah.Common.Bll.Organization org = null; Guid orgid = Guid.Empty; if (Guid.TryParseExact(id, "N", out orgid)) { org = OrganizationProvider.GetOrganization(orgid); } else { org = OrganizationProvider.GetOrganizationByPseudoId(id); } if (org == null) { return(new HttpResult("Organization not found", HttpStatusCode.NotFound)); } if (org.Deleted) { return(new HttpResult("Organization already inactive", HttpStatusCode.NotModified)); } OrganizationProvider.DeleteOrganization(org.OrganizationId); return(new HttpResult("Organization " + org.Name + " deleted", HttpStatusCode.OK)); }