private void OnHyperLinkMultiNavigate(Websites parameter) { foreach (var show in TvShows) { launcher.LaunchBrowser(show, parameter); } }
private async Task <Websites> AddItemToQueue(WebsiteViewModel model, int index) { using (var context = new PerformancePresentationContext()) { var website = new Websites { Name = model.Name + " - " + index, Url = model.Url, IsDone = false }; context.Websites.Add(website); await context.SaveChangesAsync(); await _azureQueueService.AddItemToQueue(website); return(website); } }
public void ApplyDefaultValues() { var source = ListManager.Instance.ProductSources.FirstOrDefault(x => x.Name.Equals(_name) && x.Category.Name.Equals(Category) && (x.SubCategory == SubCategory || String.IsNullOrEmpty(SubCategory))); if (source == null) { return; } RateType = source.RateType; DefaultRate = source.Rate; Width = source.Width; Height = source.Height; EnableTarget = source.EnableTarget; EnableLocation = source.EnableLocation; EnableRichMedia = source.EnableRichMedia; EnableRate = source.EnableRate; Description = source.Overview; Websites.AddRange(ListManager.Instance.Websites.Where(s => s == source.DefaultWebsite)); UpdateAdditionlaInfo(); }
public async Task <bool> StartStopApp(Application app) { Application application = applicationRepository.GetById(app.Id); string state = ""; if (application.is_running.HasValue && application.is_running.Value == false) { application.is_running = true; state = "Running"; } else { state = "Stopped"; application.is_running = false; } applicationRepository.Edit(application); Websites website = new Websites(); await website.ChangeAppState(application.url, state); return(application.is_running.Value); }
public IgdbApi(UpdatableAppSettings settings) { this.settings = settings; requestLimiterHandler = TimeLimiter .GetFromMaxCountByInterval(4, TimeSpan.FromSeconds(1)) .AsDelegatingHandler(); HttpClient = new HttpClient(requestLimiterHandler); HttpClient.DefaultRequestHeaders.Add("Accept", "application/json"); Games = new Games(this); AlternativeNames = new AlternativeNames(this); InvolvedCompanies = new InvolvedCompanies(this); Genres = new Genres(this); Websites = new Websites(this); GameModes = new GameModes(this); PlayerPerspectives = new PlayerPerspectives(this); Covers = new Covers(this); Artworks = new Artworks(this); Screenshots = new Screenshots(this); AgeRatings = new AgeRatings(this); Collections = new Collections(this); Companies = new Companies(this); }
private void SetupDrag(MouseEventArgs e) { // Get the dragged ListViewItem ListView listView = this.ListWebsites; //use to be sender ListViewItem listViewItem = FindAnchestor <ListViewItem>((DependencyObject)e.OriginalSource); if (listViewItem == null) { return; } Websites dest = (Websites)listView.ItemContainerGenerator.ItemFromContainer(listViewItem); //setup the drag adorner. InitialiseAdorner(listViewItem); //add handles to update the adorner. listView.PreviewDragOver += ListViewDragOver; listView.DragLeave += ListViewDragLeave; listView.DragEnter += ListViewDragEnter; //Console.WriteLine("original source" + e.OriginalSource.ToString()); // Initialize the drag & drop operation DataObject dragData = new DataObject("myFormat", dest); DragDropEffects derp = DragDrop.DoDragDrop(listView, dragData, DragDropEffects.Move); //cleanup listView.PreviewDragOver -= ListViewDragOver; listView.DragLeave -= ListViewDragLeave; listView.DragEnter -= ListViewDragEnter; if (_adorner != null) { AdornerLayer.GetAdornerLayer(listView).Remove(_adorner); _adorner = null; } }
public bool ValidateAsUri(ref Websites dest, ref string message) { Uri tmpUri; string processedDest = dest.Url; if (Regex.IsMatch(dest.Url, @"^[a-zA-Z]\:/[^/].*")) { message = "Filedirectory path detected"; return(false); } if (!processedDest.StartsWith("http://", StringComparison.OrdinalIgnoreCase)) { processedDest = "http://" + processedDest; } if (!Uri.IsWellFormedUriString(processedDest, UriKind.Absolute)) { message = "Invalid URI entered"; } else if (!Uri.TryCreate(processedDest, UriKind.Absolute, out tmpUri) || (tmpUri.Scheme != Uri.UriSchemeHttp && tmpUri.Scheme != Uri.UriSchemeHttps)) { message = "Invalid URI protocol"; } //else if (tmpUri.AbsoluteUri.Split('.').Length < 2) // message = "No domain (.com, .net, etc) entered"; if (message == "") { dest.Url = processedDest; dest.Type = DestinationTypes.URI; return(true); } return(false); }
public async Task <int> OpenWebsitesAsync( int delay, ObservableCollection <Websites> websitesList, CancellationToken token = new CancellationToken()) { await Task.Delay(TimeSpan.FromSeconds(2), token).ConfigureAwait(false); delay = delay * 1000; string url = "http://www.google.com"; float websiteCount = websitesList.Count; for (int i = 0; i < websitesList.Count; i++) { Websites web = websitesList.ElementAt(i); if (web.IsEnabled) { if (web.Type == "") { ValidatePathType(ref web); } try { if (web.Type == DestinationTypes.URI) { System.Diagnostics.Process.Start(web.Url); } //else if (web.Type == DestinationTypes.FileSystem) else { System.Diagnostics.Process.Start(web.Url); } UpdateProgress(i, websiteCount); LblManagerStatus = "Opened path: " + web.Url; web.LastProcessed = DateTime.Now; } catch (Win32Exception ex) { Console.WriteLine(ex.Message); LblManagerStatus = "Failed to open: " + web.Url; } Thread.Sleep(delay); } if (token.IsCancellationRequested) { token.ThrowIfCancellationRequested(); } } WebSiteProgressBar = 0; var client = new HttpClient(); using (var response = await client.GetAsync(url, token).ConfigureAwait(false)) { var data = await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false); return(data.Length); } }
private int GenerateNewID() { return(Websites.Max(site => site.ID) + 1); }
void DeleteSelectedWebsite() { Websites.Remove(Websites.Single(site => site.ID == SelectedWebsite.ID)); SelectedWebsite = null; ResortCollectionView(); }
public IActionResult SaveConfiguration(SaveConfigurationRequest request) { if (String.IsNullOrEmpty(request.WebsiteName)) { request.WebsiteName = ""; } if (String.IsNullOrEmpty(request.WebsiteUrl)) { request.WebsiteUrl = ""; } try { if (request.WebsiteId > 0) { var getExisting = _context.Websites.Where(x => x.Id == request.WebsiteId).FirstOrDefault(); if (getExisting != null) { getExisting.WebsiteName = request.WebsiteName; getExisting.WebsiteUrl = request.WebsiteUrl; _context.SaveChanges(); var getsession = HttpContext.Session.GetSession(); getsession.Website = getExisting; HttpContext.Session.SetSession(getsession); } else { Websites website = new Websites() { WebsiteName = request.WebsiteName, WebsiteUrl = request.WebsiteUrl }; _context.Websites.Add(website); _context.SaveChanges(); var getsession = HttpContext.Session.GetSession(); getsession.Website = website; HttpContext.Session.SetSession(getsession); } } else { Websites website = new Websites() { WebsiteName = request.WebsiteName, WebsiteUrl = request.WebsiteUrl }; _context.Websites.Add(website); _context.SaveChanges(); var getsession = HttpContext.Session.GetSession(); getsession.Website = website; HttpContext.Session.SetSession(getsession); } TempData["MessageType"] = 200; TempData["Message"] = "Website Saved Successfully"; return(RedirectToAction("Index", "Configuration")); } catch (Exception e) { TempData["MessageType"] = 500; TempData["Message"] = "An Error Occured. Please Try Again"; return(RedirectToAction("Index", "Configuration")); } }
internal override void Parse() { if (Websites == null) { Websites = new List <Website>(); } XNamespace serialisationNamespace = SerialisationNamespace; XElement rootElements = Document.Element(GetSchema() + RootElement); foreach (var element in rootElements.Elements(GetSchema() + "Site")) { var site = new Website() { Hostname = new List <string>() }; // get the compute modefrom the instance if (element.Element(GetSchema() + "ComputeMode") != null) { site.ComputeMode = (ComputeMode)Enum.Parse(typeof(ComputeMode), element.Element(GetSchema() + "ComputeMode").Value, true); } // get the name of the site as in xxxx.azurewebsites.net if (element.Element(GetSchema() + "Name") != null) { site.Name = element.Element(GetSchema() + "Name").Value; } // test to see whether the sitehas been enabled if (element.Element(GetSchema() + "Enabled") != null) { site.Enabled = bool.Parse(element.Element(GetSchema() + "Enabled").Value); } // get the underlying webspace that this site is in if (element.Element(GetSchema() + "WebSpace") != null) { site.Webspace = element.Element(GetSchema() + "WebSpace").Value; } // get the usage of this website if (element.Element(GetSchema() + "UsageState") != null) { site.Usage = (WebsiteUsage)Enum.Parse(typeof(WebsiteUsage), element.Element(GetSchema() + "UsageState").Value, true); } // get the state of the website if (element.Element(GetSchema() + "State") != null) { site.State = (WebsiteState)Enum.Parse(typeof(WebsiteState), element.Element(GetSchema() + "State").Value, true); } // get the hostnames using the serialisation namespace // EnabledHostNames [ xmlns:a= ] if (element.Element(GetSchema() + "EnabledHostNames") != null) { foreach (var hostNameElement in element.Element(GetSchema() + "EnabledHostNames"). Elements(serialisationNamespace + "string")) { site.Hostname.Add(hostNameElement.Value); } } // get the state of the website if (element.Element(GetSchema() + "SiteMode") != null) { site.Mode = (SiteMode)Enum.Parse(typeof(SiteMode), element.Element(GetSchema() + "SiteMode").Value, true); } // get the state of the website if (element.Element(GetSchema() + "ComputeMode") != null) { site.ComputeMode = (ComputeMode)Enum.Parse(typeof(ComputeMode), element.Element(GetSchema() + "ComputeMode").Value); } Websites.Add(site); } CommandResponse = Websites; }
public async Task <IActionResult> CreateAndConnect(string tablename, int tableid, int infotype, string currentpath, [Bind("Id,Firstname,Lastname,Organization,Title,Publicationdate,Calldate,Url")] Websites websites) { int id = new int(); String[] url = new String[4]; if (ModelState.IsValid) { _context.Add(websites); await _context.SaveChangesAsync(); List <Websites> allentries = new List <Websites>(); allentries = await _context.Websites.ToListAsync(); foreach (Websites item in allentries) { if (item == websites) { id = websites.Id; } } var relation = new InfoSourcesInRelation { Tablename = tablename, Tableid = tableid, Infotype = infotype, Infosourceid = id }; _context.Add(relation); await _context.SaveChangesAsync(); url = currentpath.Split('/'); return(RedirectToAction(url[3], url[2], new { id = url[4] })); //return RedirectToAction("CreateAndConnect", "InfoSourcesInRelations", new { tablename = tablename, tableid = tableid, infotype = infotype, infosourceid = id, currentpath = currentpath }); } return(View(websites)); }
public static bool CheckForInternetConnection(Websites websites) { string link = string.Empty; if (websites == Websites.Google) { link = "http://www.google.com"; } else if (websites == Websites.Baidu) { link = "http://www.baidu.com"; } else if (websites == Websites.Shimmer) { link = "http://www.shimmersensing.com"; } //// alternative with timeout //// http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.timeout(v=vs.110).aspx //// Create a new 'HttpWebRequest' Object to the mentioned URL. //HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(link); //// Set the 'Timeout' property of the HttpWebRequest to 10 milliseconds. //myHttpWebRequest.Timeout = 10000; //try //{ // // A HttpWebResponse object is created and is GetResponse Property of the HttpWebRequest associated with it // HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse(); // if (myHttpWebResponse.StatusCode.Equals(HttpStatusCode.OK)) // { // return true; // } // else // { // return false; // } //} //catch //{ // return false; //} try { //TODO: Double check operate and tidy //TODO: Timeout using (var client = new WebClient()) { using (var stream = client.OpenRead(link)) { if (stream != null) { stream.Dispose(); return(true); } else { stream.Dispose(); return(false); } } } } catch { return(false); } finally { } }
private void LoadOnlineStrategy(StorageFile listsSourceFile) { SlideHeaders.Clear(); Websites.Clear(); Strengths.Clear(); Categories.Clear(); ProductSources.Clear(); if (!listsSourceFile.ExistsLocal()) { return; } var document = new XmlDocument(); document.Load(listsSourceFile.LocalPath); var node = document.SelectSingleNode(@"/OnlineStrategy"); if (node == null) { return; } foreach (XmlNode childeNode in node.ChildNodes) { switch (childeNode.Name) { case "Header": foreach (XmlAttribute attribute in childeNode.Attributes) { switch (attribute.Name) { case "Value": if (!string.IsNullOrEmpty(attribute.Value) && !SlideHeaders.Contains(attribute.Value)) { SlideHeaders.Add(attribute.Value); } break; } } break; case "Site": foreach (XmlAttribute attribute in childeNode.Attributes) { switch (attribute.Name) { case "Value": if (!string.IsNullOrEmpty(attribute.Value) && !Websites.Contains(attribute.Value)) { Websites.Add(attribute.Value); } break; } } break; case "Strength": foreach (XmlAttribute attribute in childeNode.Attributes) { switch (attribute.Name) { case "Value": if (!string.IsNullOrEmpty(attribute.Value) && !Strengths.Contains(attribute.Value)) { Strengths.Add(attribute.Value); } break; } } break; case "PricingStrategy": foreach (XmlAttribute attribute in childeNode.Attributes) { switch (attribute.Name) { case "Value": if (!string.IsNullOrEmpty(attribute.Value) && !PricingStrategies.Contains(attribute.Value)) { PricingStrategies.Add(attribute.Value); } break; } } break; case "PositionColumn": foreach (XmlAttribute attribute in childeNode.Attributes) { switch (attribute.Name) { case "Value": if (!string.IsNullOrEmpty(attribute.Value) && !ColumnPositions.Contains(attribute.Value)) { ColumnPositions.Add(attribute.Value); } break; } } break; case "DefaultFormula": switch (childeNode.InnerText.ToLower().Trim()) { case "cpm": DefaultFormula = FormulaType.CPM; break; case "investment": DefaultFormula = FormulaType.Investment; break; case "impressions": DefaultFormula = FormulaType.Impressions; break; } break; case "LockedMode": { bool temp; if (Boolean.TryParse(childeNode.InnerText, out temp)) { LockedMode = temp; } } break; case "SpecialLinksEnable": { bool temp; if (Boolean.TryParse(childeNode.InnerText, out temp)) { SpecialLinksEnable = temp; } } break; case "SpecialButtonsGroupName": SpecialLinksGroupName = childeNode.InnerText; break; case "SpecialButtonsGroupLogo": if (string.IsNullOrEmpty(childeNode.InnerText)) { SpecialLinksGroupLogo = null; } else { SpecialLinksGroupLogo = new Bitmap(new MemoryStream(Convert.FromBase64String(childeNode.InnerText))); } break; case "Browser": SpecialLinkBrowsers.Add(childeNode.InnerText); break; case "SpecialButton": var specialLinkButton = new SpecialLinkButton(); GetSpecialButton(childeNode, ref specialLinkButton); if (!String.IsNullOrEmpty(specialLinkButton.Name) && !String.IsNullOrEmpty(specialLinkButton.Type) && specialLinkButton.Paths.Any()) { SpecialLinkButtons.Add(specialLinkButton); } break; case "Targeting": { var productInfo = new ProductInfo { Type = ProductInfoType.Targeting }; productInfo.Deserialize(childeNode); TargetingRecods.Add(productInfo); } break; case "RichMedia": { var productInfo = new ProductInfo { Type = ProductInfoType.RichMedia }; productInfo.Deserialize(childeNode); RichMediaRecods.Add(productInfo); } break; case "Category": var category = new Category(); GetCategories(childeNode, ref category); if (!string.IsNullOrEmpty(category.Name)) { Categories.Add(category); } break; case "Product": var productSource = new ProductSource(); GetProductProperties(childeNode, ref productSource); if (!string.IsNullOrEmpty(productSource.Name)) { ProductSources.Add(productSource); } break; case "Status": foreach (XmlAttribute attribute in childeNode.Attributes) { switch (attribute.Name) { case "Value": if (!Statuses.Contains(attribute.Value)) { Statuses.Add(attribute.Value); } break; } } break; case "DefaultHomeViewSettings": DefaultHomeViewSettings.Deserialize(childeNode); break; case "DefaultDigitalProductSettings": DefaultDigitalProductSettings.Deserialize(childeNode); break; case "DefaultDigitalProductPackageSettings": DefaultDigitalProductPackageSettings.Deserialize(childeNode); break; case "DefaultDigitalStandalonePackageSettings": DefaultDigitalStandalonePackageSettings.Deserialize(childeNode); break; case "DigitalControlsConfiguration": DefaultControlsConfiguration = JsonConvert.DeserializeObject <DigitalControlsConfiguration>(Encoding.Unicode.GetString(Convert.FromBase64String(childeNode.InnerText)), new JsonImageConverter()); break; } } }
public void Deserialize(XmlNode node) { int tempInt; decimal tempDecimal; foreach (XmlAttribute productAttribute in node.Attributes) { switch (productAttribute.Name) { #region Basic Properties case "Name": Name = productAttribute.Value; break; case "UniqueID": Guid tempGuid; if (Guid.TryParse(productAttribute.Value, out tempGuid)) { UniqueID = tempGuid; } break; case "Index": if (int.TryParse(productAttribute.Value, out tempInt)) { Index = tempInt; } break; case "Category": Category = productAttribute.Value; break; case "SubCategory": SubCategory = productAttribute.Value; break; case "RateType": RateType = productAttribute.Value; switch (RateType) { case "0": RateType = "CPM"; break; case "1": RateType = "Fixed"; break; } break; case "Location": Location = productAttribute.Value; break; case "Width": if (int.TryParse(productAttribute.Value, out tempInt)) { Width = tempInt; } else { Width = null; } break; case "Height": if (int.TryParse(productAttribute.Value, out tempInt)) { Height = tempInt; } else { Height = null; } break; case "EnableTarget": { bool temp; if (Boolean.TryParse(productAttribute.Value, out temp)) { EnableTarget = temp; } } break; case "EnableLocation": { bool temp; if (Boolean.TryParse(productAttribute.Value, out temp)) { EnableLocation = temp; } } break; case "EnableRichMedia": { bool temp; if (Boolean.TryParse(productAttribute.Value, out temp)) { EnableRichMedia = temp; } } break; #endregion #region Additional Properties case "UserDefinedName": UserDefinedName = productAttribute.Value; break; case "DurationType": DurationType = productAttribute.Value; break; case "DurationValue": if (int.TryParse(productAttribute.Value, out tempInt)) { DurationValue = tempInt; } else { DurationValue = null; } break; case "Strength1": Strength1 = productAttribute.Value; break; case "Strength2": Strength2 = productAttribute.Value; break; case "MonthlyInvestment": if (Decimal.TryParse(productAttribute.Value, out tempDecimal)) { MonthlyInvestment = tempDecimal; } else { MonthlyInvestment = null; } break; case "MonthlyImpressions": if (Decimal.TryParse(productAttribute.Value, out tempDecimal)) { MonthlyImpressions = tempDecimal; } else { MonthlyImpressions = null; } break; case "MonthlyCPM": if (Decimal.TryParse(productAttribute.Value, out tempDecimal)) { MonthlyCPM = tempDecimal; } else { MonthlyCPM = null; } break; case "TotalInvestment": if (Decimal.TryParse(productAttribute.Value, out tempDecimal)) { TotalInvestment = tempDecimal; } else { TotalInvestment = null; } break; case "TotalImpressions": if (Decimal.TryParse(productAttribute.Value, out tempDecimal)) { TotalImpressions = tempDecimal; } else { TotalImpressions = null; } break; case "TotalCPM": if (Decimal.TryParse(productAttribute.Value, out tempDecimal)) { TotalCPM = tempDecimal; } else { TotalCPM = null; } break; case "DefaultRate": if (Decimal.TryParse(productAttribute.Value, out tempDecimal)) { DefaultRate = tempDecimal; } else { DefaultRate = null; } break; case "Formula": if (int.TryParse(productAttribute.Value, out tempInt)) { Formula = (FormulaType)tempInt; } break; case "InvestmentDetails": InvestmentDetails = productAttribute.Value; break; case "EnableComment": { bool tempBool; if (bool.TryParse(productAttribute.Value, out tempBool)) { EnableComment = tempBool; } } break; case "CommentManualEdit": { bool tempBool; if (bool.TryParse(productAttribute.Value, out tempBool)) { CommentManualEdit = tempBool; } } break; case "ShowCommentTargeting": { bool temp; if (Boolean.TryParse(productAttribute.Value, out temp)) { ShowCommentTargeting = temp; } } break; case "ShowCommentRichMedia": { bool temp; if (Boolean.TryParse(productAttribute.Value, out temp)) { ShowCommentRichMedia = temp; } } break; case "Comment": _userComment = productAttribute.Value; break; case "DescriptionManualEdit": { bool tempBool; if (bool.TryParse(productAttribute.Value, out tempBool)) { DescriptionManualEdit = tempBool; } } break; case "ShowDimensions": { bool temp; if (Boolean.TryParse(productAttribute.Value, out temp)) { ShowDimensions = temp; } } break; case "ShowDescriptionTargeting": { bool temp; if (Boolean.TryParse(productAttribute.Value, out temp)) { ShowDescriptionTargeting = temp; } } break; case "ShowDescriptionRichMedia": { bool temp; if (Boolean.TryParse(productAttribute.Value, out temp)) { ShowDescriptionRichMedia = temp; } } break; case "Description": Description = productAttribute.Value; break; case "UserDescription": _userDescription = productAttribute.Value; break; #endregion #region Show Properties case "ShowFlightDates": { bool tempBool; if (bool.TryParse(productAttribute.Value, out tempBool)) { ShowFlightDates = tempBool; } } break; case "ShowDuration": { bool tempBool; if (bool.TryParse(productAttribute.Value, out tempBool)) { ShowDuration = tempBool; } } break; case "ShowAllPricingMonthly": { bool tempBool; if (bool.TryParse(productAttribute.Value, out tempBool)) { ShowAllPricingMonthly = tempBool; } } break; case "ShowAllPricingTotal": { bool tempBool; if (bool.TryParse(productAttribute.Value, out tempBool)) { ShowAllPricingTotal = tempBool; } } break; case "ShowMonthlyInvestments": { bool tempBool; if (bool.TryParse(productAttribute.Value, out tempBool)) { ShowMonthlyInvestments = tempBool; } } break; case "ShowMonthlyImpressions": { bool tempBool; if (bool.TryParse(productAttribute.Value, out tempBool)) { ShowMonthlyImpressions = tempBool; } } break; case "ShowTotalInvestments": { bool tempBool; if (bool.TryParse(productAttribute.Value, out tempBool)) { ShowTotalInvestments = tempBool; } } break; case "ShowTotalImpressions": { bool tempBool; if (bool.TryParse(productAttribute.Value, out tempBool)) { ShowTotalImpressions = tempBool; } } break; #endregion } } Websites.Clear(); foreach (XmlNode childNode in node.ChildNodes) { switch (childNode.Name) { case "Website": Websites.Add(childNode.InnerText); break; case "PackageRecord": PackageRecord.Deserialize(childNode); break; case "SummaryItem": SummaryItem.Deserialize(childNode); break; case "ProductInfo": var productInfo = new ProductInfo(); productInfo.Deserialize(childNode); AddtionalInfo.Add(productInfo); break; } } }
public async Task <IActionResult> Create(Websites websites) { //([Bind("Id,CreatedBy,DomainUrl,WebsiteName")] Websites websites) if (ModelState.IsValid) { // var userData = _context.AspNetUsers.SingleOrDefault(x => x.UserName == User.Identity.Name); var websitesData = _context.Websites.Where(x => x.CreatedBy == User.Identity.Name).ToList(); for (int i = 0; i < websitesData.Count; i++) { if (websitesData[i].WebsiteName == websites.WebsiteName) { if (websitesData[i].IsDeleted == false) { ModelState.AddModelError(string.Empty, "This website name already exists . Please choose another name .. "); return(View()); } } } _context.Add(websites); _context.SaveChanges(); var websiteID = websites.Id; Widget widget = new Widget(); widget.CreatedDate = DateTime.Now; widget.CreatedBy = User.Identity.Name; widget.Title = websites.WebsiteName + "-Document"; widget.WidgetOrdinal = 0; try { int widgettypeid = _context.WidgetType.SingleOrDefault(x => x.Name == "Document").Id; widget.WidgetTypeId = widgettypeid; } catch { WidgetType widgetType = new WidgetType(); widgetType.Name = "Document"; widgetType.Description = "Base Page for any website"; widgetType.Section = "Body"; _context.Add(widgetType); await _context.SaveChangesAsync(); int widgettypeid = _context.WidgetType.SingleOrDefault(x => x.Name == "Document").Id; widget.WidgetTypeId = widgettypeid; } widget.HtmlBody = "<!DOCTYPE html>" + "< html lang = 'en' >" + "< head >" + "< meta charset = 'UTF-8' >" + "< meta name = 'viewport' content = 'width=device-width, initial-scale=1.0' >" + "< meta http - equiv = 'X-UA-Compatible' content = 'ie=edge' > " + "< title > ${websiteName} </ title >" + "</ head >" + "< body >" + "</ body >" + "</ html >"; _context.Add(widget); await _context.SaveChangesAsync(); UserWebsites userWebsites = new UserWebsites(); userWebsites.WebsiteId = websiteID; userWebsites.UserEmail = User.Identity.Name; _context.Add(userWebsites); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(websites)); }
public ShellViewModel() { SelectedWebsite = Websites.First(); LoadKeywords(); }
public override bool IsUseless() => string.IsNullOrEmpty(OpeningHours) && string.IsNullOrEmpty(ContactPhone) && string.IsNullOrEmpty(Address) && (Websites == null || !Websites.Any()) && string.IsNullOrEmpty(WikipediaContent);
private string GetJsonString(Websites website) { return(JsonConvert.SerializeObject(website)); }
public async Task AddItemToQueue(Websites website) { var queueMessage = new CloudQueueMessage(GetJsonString(website)); await _queue.AddMessageAsync(queueMessage); }