public int CompareTo(object obj) { ViewSettings otherViewSettings = obj as ViewSettings; if (Name.CompareTo(otherViewSettings.Name) == 0 && EnableSSL.CompareTo(otherViewSettings.EnableSSL) == 0 && Host.CompareTo(otherViewSettings.Host) == 0 && Port.CompareTo(otherViewSettings.Port) == 0 && UserEmail.CompareTo(otherViewSettings.UserEmail) == 0 && UserPassword.CompareTo(otherViewSettings.UserPassword) == 0 && SenderName.CompareTo(otherViewSettings.SenderName) == 0 && SenderEmail.CompareTo(otherViewSettings.SenderEmail) == 0 && RecieverEmail.CompareTo(otherViewSettings.RecieverEmail) == 0 && MessageSubject.CompareTo(otherViewSettings.MessageSubject) == 0 && MessageBody.CompareTo(otherViewSettings.MessageBody) == 0 && SiteUrl.CompareTo(otherViewSettings.SiteUrl) == 0 && TableClassID.CompareTo(otherViewSettings.TableClassID) == 0 && CompareValue.CompareTo(otherViewSettings.CompareValue) == 0 && TimeStartSettings.CompareTo(otherViewSettings.TimeStartSettings) == 0 && NotNullColumn.CompareTo(otherViewSettings.NotNullColumn) == 0 && ColumnToCompare.CompareTo(otherViewSettings.ColumnToCompare) == 0) { return(0); } return(1); }
private async Task <bool> ValidateSiteAddress() { if (String.IsNullOrEmpty(SiteUrl)) { var dialog = Acumatica.Core.Ioc.Container.Default.GetInstance <IMessageDialogService>(); dialog.Title = "Address Missing"; dialog.Content = "Please enter your Acumatica site address before your continue. This information is provided by your system administrator."; dialog.Buttons = MessageDialogButtons.OK; await dialog.ShowAsync(); return(false); } else if (!Uri.IsWellFormedUriString(SiteUrl, UriKind.Absolute) || !(SiteUrl.StartsWith("http://", StringComparison.CurrentCultureIgnoreCase) || SiteUrl.StartsWith("https://", StringComparison.CurrentCultureIgnoreCase))) { var dialog = Acumatica.Core.Ioc.Container.Default.GetInstance <IMessageDialogService>(); dialog.Title = "Invalid Address"; dialog.Content = "Please enter a valid address (ex: http://erp.acumatica.com)"; dialog.Buttons = MessageDialogButtons.OK; await dialog.ShowAsync(); return(false); } { return(true); } }
public Configuration() { SiteUrl = Environment.GetEnvironmentVariable("PnPTests_SiteUrl"); if (string.IsNullOrEmpty(SiteUrl)) { throw new ConfigurationErrorsException("Please set PnPTests_SiteUrl environment variable, or run Run-Tests.ps1 in the build root folder"); } else { SiteUrl = SiteUrl.TrimEnd(new[] { '/' }); } var credLabel = Environment.GetEnvironmentVariable("PnPTests_CredentialManagerLabel"); if (string.IsNullOrEmpty(credLabel)) { var username = Environment.GetEnvironmentVariable("PnPTests_Username"); var password = Environment.GetEnvironmentVariable("PnPTests_Password"); if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password)) { Credentials = new PSCredential(username, ConvertFromBase64String(password)); } } else { Credentials = PnP.PowerShell.Commands.Utilities.CredentialManager.GetCredential(credLabel); } if (Credentials == null) { throw new ConfigurationErrorsException("Please set PnPTests_CredentialManagerLabel or PnPTests_Username and PnPTests_Password, or run Run-Tests.ps1 in the build root folder"); } }
public void sendSMS(string PhoneNumber, string content) { try { string UserId, Password, SenderID, SiteUrl; SiteUrl = ConfigurationManager.AppSettings[Constants.SiteUrl]; UserId = ConfigurationManager.AppSettings[Constants.UserId]; Password = ConfigurationManager.AppSettings[Constants.Password]; SenderID = ConfigurationManager.AppSettings[Constants.SenderID]; SiteUrl = SiteUrl.Replace(Constants.userId_Hash, UserId); SiteUrl = SiteUrl.Replace(Constants.password_Hash, Password); SiteUrl = SiteUrl.Replace(Constants.senderID_Hash, SenderID); SiteUrl = SiteUrl.Replace(Constants.smsContent_Hash, content); SiteUrl = SiteUrl.Replace(Constants.receipientNo_Hash, PhoneNumber); WebRequest request = HttpWebRequest.Create(SiteUrl); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream s = (Stream)response.GetResponseStream(); StreamReader readstream = new StreamReader(s); string datastring = readstream.ReadToEnd(); response.Close(); //response.Dispose(); s.Close(); readstream.Close(); } catch (Exception ex) { //To not break page if email not sent //Handle Exception Helper.LogError(ex); } }
private void startButton_Click(object sender, EventArgs e) { SiteUrl = site.Text; bw.WorkerReportsProgress = true; bw.WorkerSupportsCancellation = true; bw.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged); if (isNmap) { bw.DoWork += new DoWorkEventHandler(bw_DoWorkNmap); } else { if (string.IsNullOrEmpty(SiteUrl)) { MessageBox.Show("You need to provide a base url.", "Error"); return; } else if (SiteUrl.EndsWith(".xml")) { MessageBox.Show("Please select the file for directory enumeration.", "Error"); return; } bw.DoWork += new DoWorkEventHandler(bw_DoWorkDirbust); } bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted); beginTest(); }
private static XmlDocument GetXmlRequest(SiteUrl itemUrl, Uri uri) { using (MemoryStream ms = new MemoryStream()) { using (XmlTextWriter writer = new XmlTextWriter(ms, Encoding.ASCII)) { writer.WriteStartDocument(true); writer.WriteStartElement("methodCall"); writer.WriteElementString("methodName", "pingback.ping"); writer.WriteStartElement("params"); writer.WriteStartElement("param"); writer.WriteStartElement("value"); writer.WriteElementString("string", itemUrl.ToString()); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteStartElement("param"); writer.WriteStartElement("value"); writer.WriteElementString("string", uri.ToString()); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndElement(); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(ms); return(xmlDocument); } } }
//============================================================================= Helper methods /// <summary> /// Creates the first path of the url, without properties and parameters /// </summary> private string GetItemUrlBase() { // short url format that contains only the id if (ContentId > 0) { return($"{SiteUrl}/{SERVICE_NAME}/content({ContentId})"); } // regular url that contains the content path var path = Path.TrimStart('/'); // collection or item url if (!IsCollectionRequest) { var lastSlash = path.LastIndexOf('/'); if (lastSlash > 0) { var path1 = path.Substring(0, lastSlash); var path2 = path.Substring(lastSlash + 1); path = $"{path1}('{path2}')"; } else { path = $"('{path}')"; } } return($"{SiteUrl.TrimEnd('/')}/{SERVICE_NAME}/{path}"); }
public Site Get(int Id) { Site site = null; using (DbCommand cmd = _db.GetSqlStringCommand(SiteQueries.GetSite)) { _db.AddInParameter(cmd, "@SiteId", DbType.Int32, Id); using (IDataReader reader = _db.ExecuteReader(cmd)) { while (reader.Read()) { site = ReadertoSite(reader); break; } reader.NextResult(); while (reader.Read()) { SiteUrl siteUrl = ReadertoSiteUrl(reader); if (site != null) { site.Urls.Add(siteUrl); } } return(site); } } }
public IQueryable <Site> GetAll() { var sites = new List <Site>(); using (DbCommand cmd = _db.GetSqlStringCommand(SiteQueries.GetSites)) { using (IDataReader reader = _db.ExecuteReader(cmd)) { while (reader.Read()) { sites.Add(ReadertoSite(reader)); } reader.NextResult(); while (reader.Read()) { SiteUrl siteUrl = ReadertoSiteUrl(reader); var site = sites.FirstOrDefault(a => a.Id == siteUrl.SiteId); if (site != null) { site.Urls.Add(siteUrl); } } } } return(sites.AsQueryable()); }
//============================================================================= Helper methods /// <summary> /// Creates the first path of the url, without properties and parameters /// </summary> private string GetItemUrlBase() { // short url format that contains only the id if (ContentId > 0) { return(string.Format("{0}/{1}/content({2})", SiteUrl, SERVICE_NAME, ContentId)); } // regular url that contains the content path var path = Path.TrimStart('/'); // collection or item url if (!IsCollectionRequest) { var lastSlash = path.LastIndexOf('/'); if (lastSlash > 0) { var path1 = path.Substring(0, lastSlash); var path2 = path.Substring(lastSlash + 1); path = string.Format("{0}/('{1}')", path1, path2); } else { path = string.Format("('{0}')", path); } } return(string.Format("{0}/{1}/{2}", SiteUrl.TrimEnd('/'), SERVICE_NAME, path)); }
private string GetSiteUrlAdmin() { var arrString = SiteUrl.Split("."); arrString[0] += "-admin"; string siteUriAdmin = string.Join(".", arrString); return(siteUriAdmin); }
public void DeleteSiteUrl(SiteUrl url) { using (DbCommand cmd = _db.GetSqlStringCommand(SiteQueries.DeleteSiteUrl)) { _db.AddInParameter(cmd, "@SiteurlId", DbType.Int32, url.Id); _db.AddInParameter(cmd, "@UpdatedBy", DbType.String, url.UpdatedBy); _db.ExecuteNonQuery(cmd); } }
public void WhenIFillInThePortalFormForAChildPortal(string portalAlias, string portalTitle) { SiteManagementPage.ChildRadioButton.Click(); Thread.Sleep(4000); SiteManagementPage.SiteAliasField.Value = SiteUrl.Replace("http://", "") + "/" + portalAlias; SiteManagementPage.SiteNameField.Value = portalTitle; SiteManagementPage.PortalTemplateSelectList.Refresh(); SiteManagementPage.PortalTemplateSelectList.Select("Default Website - English (United States)"); Thread.Sleep(3000); }
public SiteUrl FeedbackPage(FeedbackType feedback, string localizationKey, SiteUrl redirect) { var parameters = new Dictionary <string, string> { { "key", localizationKey }, { "url", redirect } }; return(new SiteUrl(this.Domain, this.HttpPort, false, "Dxt-Admin", "Feedback", feedback.ToString(), null, parameters)); }
private async Task <IActionResult> GetUrlAsFile(string id, string format, SiteUrl siteUrl) { var bytes = await _dataContainerConverterService.ToAnyFormat(JsonConvert.DeserializeObject <DataContainer>(siteUrl.JsonData), format); var restuls = new FileContentResult(bytes, new MediaTypeHeaderValue($"application/{format}")) { FileDownloadName = id + "." + format }; return(restuls); }
public void PostSiteUrl_IncorrectUser_ShouldReturnBadRequest() { var url = new SiteUrl { OsmUserId = "1" }; _controller.SetupIdentity("2"); var results = _controller.PostSiteUrl(url).Result as BadRequestObjectResult; Assert.IsNotNull(results); }
public ActionResult AddUrl(SiteUrl item) { try { item.CreatedBy = HttpContext.User.Identity.Name; var returnUrl = siteRepository.AddSiteUrl(item); return(Json(returnUrl)); } catch (Exception ex) { return(Json("failure")); } }
public ActionResult DeleteUrl(SiteUrl item) { try { item.UpdatedBy = HttpContext.User.Identity.Name; siteRepository.DeleteSiteUrl(item); return(Json("success")); } catch (Exception ex) { return(Json("failure")); } }
public void PutSiteUrl_ItemNotInDatabase_ShouldReturnBadRequest() { var siteUrl = new SiteUrl { Id = "42", OsmUserId = "42" }; _israelHikingRepository.GetUrlById(siteUrl.Id).Returns((SiteUrl)null); var results = _controller.PutSiteUrl(siteUrl.Id, siteUrl).Result as NotFoundResult; Assert.IsNotNull(results); _israelHikingRepository.DidNotReceive().Update(Arg.Any <SiteUrl>()); }
public void GetImage_UrlInDatabase_ShouldCreateIt() { var siteUrl = new SiteUrl { Id = "1", JsonData = JsonConvert.SerializeObject(new DataContainer()) }; _repository.GetUrlById(siteUrl.Id).Returns(siteUrl); var results = _controller.GetImage(siteUrl.Id).Result as FileContentResult; Assert.IsNotNull(results); }
public void PutSiteUrl_ItemDoesNotBelongToUSer_ShouldReturnBadRequest() { var siteUrl = new SiteUrl { Id = "42", OsmUserId = "42" }; _israelHikingRepository.GetUrlById(siteUrl.Id).Returns(siteUrl); _controller.SetupIdentity("1"); var results = _controller.PutSiteUrl(siteUrl.Id, siteUrl).Result as BadRequestObjectResult; Assert.IsNotNull(results); _israelHikingRepository.DidNotReceive().Update(Arg.Any <SiteUrl>()); }
private async void ExecuteForgotPasswordCommand() { if (await ValidateSiteAddress()) { if (!SiteUrl.EndsWith("/")) { SiteUrl = SiteUrl + "/"; } var baseUri = new Uri(SiteUrl); var forgotPasswordUri = new Uri(String.Format("{0}Frames/PasswordRemind.aspx?ReturnUrl={1}Main.aspx&Target={1}Frames%2fLogin.aspx", SiteUrl, baseUri.AbsolutePath)); await Acumatica.Core.Ioc.Container.Default.GetInstance <IUriLauncherService>().LaunchUriAsync(forgotPasswordUri); } }
public void DeleteSiteUrl_ItemNotInDatabase_ShouldRemoveIt() { var siteUrl = new SiteUrl { Id = "42", OsmUserId = "42" }; _israelHikingRepository.GetUrlById(siteUrl.Id).Returns(siteUrl); _controller.SetupIdentity(siteUrl.OsmUserId); _controller.DeleteSiteUrl(siteUrl.Id).Wait(); _israelHikingRepository.Received(1).Delete(siteUrl); _controller.Dispose(); }
public void PutSiteUrl_ItemBelongsToUSer_ShouldUpdateIt() { var siteUrl = new SiteUrl { Id = "1", OsmUserId = "1" }; _israelHikingRepository.GetUrlById(siteUrl.Id).Returns(siteUrl); _controller.SetupIdentity(siteUrl.OsmUserId); var results = _controller.PutSiteUrl(siteUrl.Id, siteUrl).Result as OkObjectResult; Assert.IsNotNull(results); _israelHikingRepository.Received(1).Update(Arg.Any <SiteUrl>()); }
public override DeployUnitInfo GetUnitInfo(bool refreshUnitStatus) { var siteInfo = base.GetUnitInfo(refreshUnitStatus); if ((UnitStatus)_lastUnitStatus == UnitStatus.NotFound) { siteInfo.Version = new DeployedVersion { VersionNumber = "0.0.0.0" }; } siteInfo.Url = SiteUrl.Replace("localhost", HostNameUtil.GetFullHostName()); siteInfo.Status = (UnitStatus)_lastUnitStatus; return(siteInfo); }
void bw_DoWorkDirbust(object sender, DoWorkEventArgs e) { if (!SiteUrl.EndsWith("/")) { SiteUrl += "/"; } IEnumerable <string> items = new DirectoryEnumerationUtility(_fileLocation).PreLoad(); Parallel.ForEach(items, new ParallelOptions { MaxDegreeOfParallelism = 10 }, async(currentItem) => { FileStatusObject returnedTaskTResult = await new AttackHelper().AttackAsync(SiteUrl + currentItem); Thread thread = new Thread(() => pushData(returnedTaskTResult)); thread.Start(); }); }
public async Task <IActionResult> InvoiceDetail(string invoiceId) { var model = new InvoiceDetailModel { Data = await _invoicesServiceClient.GetInvoiceAsync(MerchantId, invoiceId) }; var files = await _invoicesServiceClient.GetFileInfoByInvoiceAsync(model.Data.InvoiceId); model.Files = files.Select(i => new FileModel(i)).ToList(); if (model.Data.Status != InvoiceStatus.Paid.ToString()) { model.InvoiceUrl = $"{SiteUrl.TrimEnd('/')}/invoice/{model.Data.InvoiceId}"; model.QRCode = $@"https://chart.googleapis.com/chart?chs=220x220&chld=L|2&cht=qr&chl={model.InvoiceUrl}"; } return(View(model)); }
public async Task <IActionResult> PutSiteUrl(string id, [FromBody] SiteUrl siteUrl) { var siteUrlFromDatabase = await _repository.GetUrlById(id); if (siteUrlFromDatabase == null) { return(NotFound()); } if (siteUrlFromDatabase.OsmUserId != User.Identity.Name) { return(BadRequest("You can't update someone else's share!")); } siteUrlFromDatabase.Title = siteUrl.Title; siteUrlFromDatabase.Description = siteUrl.Description; await _repository.Update(siteUrlFromDatabase); return(Ok(siteUrlFromDatabase)); }
private async Task <bool> IsSpam(TrackBackDto trackBack, ItemDto item) { string response; using (HttpClient client = new HttpClient()) { response = await client.GetStringAsync(trackBack.Url); } if (string.IsNullOrEmpty(response)) { return(false); } SiteUrl postUrl = this.urlBuilder.Post.Permalink(item); return(!response.ToLowerInvariant().Contains(postUrl)); }
public SiteUrl AddSiteUrl(SiteUrl url) { using (DbCommand cmd = _db.GetSqlStringCommand(SiteQueries.AddSiteUrl)) { _db.AddInParameter(cmd, "@Url", DbType.String, url.Url); _db.AddInParameter(cmd, "@SiteId", DbType.Int32, url.SiteId); _db.AddInParameter(cmd, "@CreatedBy", DbType.String, url.CreatedBy); using (IDataReader reader = _db.ExecuteReader(cmd)) { while (reader.Read()) { return(ReadertoSiteUrl(reader)); } } } return(url); }