private void displaySite(UrlClass site) { if (site == null) { txtSiteUrl.Enabled = false; txtSiteUrl.Text = ""; } else { txtSiteUrl.Enabled = true; txtSiteUrl.Text = site.Url; } }
private void populateInitialKeywordList() { UrlClass selectedSite = siteList.GetSelectedSite(); //TODO: Handle this failure mode better if (selectedSite == null) { return; } List <string> keywords = _keywordManager.GetKeywordList(selectedSite.Url); txtKeywords.Text = string.Join(Convert.ToChar(10).ToString(), keywords.ToArray()); }
public void PopulateDatasourceList(UrlClass site) { DataTable dt; if (site == null) { ddlDatasources.Items.Clear(); return; } dt = DB.Ds_GetPageDatasourceList(site.Id); ddlDatasources.DataSource = dt; ddlDatasources.DataTextField = "DisplayName"; ddlDatasources.DataValueField = "Id"; ddlDatasources.DataBind(); }
public UrlClass GetUrl(int urlId) { SqlCommand cmd; DataSet ds; UrlClass u; cmd = _dbConn.GetStoredProcedureCommand("Url_GetUrl"); cmd.Parameters.AddWithValue("@UrlId", urlId); ds = _dbConn.GetDataSet(cmd); if (ds.Tables[0].Rows.Count == 0) { return(null); } u = new UrlClass(); DataMapper.PopulateObject(u, ds, null, null); return(u); }
private void cmdAdd_Click(object sender, EventArgs e) { UrlClass newSite; IList <UrlClass> cachedSites; newSite = new UrlClass(); newSite.UserId = _userId; newSite.Url = "http://"; _db.ORManager.SaveOrUpdate(newSite); //These will definitely be cached because we saved them when the list loaded cachedSites = SessionCache.GetSiteList(Session); cachedSites.Add(newSite); //Add the new list item and select it lstSites.Items.Add(new ListItem(newSite.Url, newSite.Id.ToString())); lstSites.SelectedIndex = lstSites.Items.Count - 1; displaySite(newSite); }
public UrlClass GetSelectedSite() { int? selectedSiteId; UrlClass selectedSite = null; IList <UrlClass> pages; selectedSiteId = GetSelectedSiteId(); if (selectedSiteId == null) { return(null); } //Try to load the site from the cache pages = SessionCache.GetSiteList(Session); if (pages != null) { foreach (UrlClass currPage in pages) { if (currPage.Id == selectedSiteId) { selectedSite = currPage; break; } } } //If the site isn't cached, load the site if (selectedSite == null) { _log.Debug("Couldn't find the site in the cache"); selectedSite = _db.ORManager.Get <UrlClass>(selectedSiteId); } else { _log.Debug("The site was found in the cache, no need to load from the database"); } return(selectedSite); }
public UrlClass[] GetUserUrls(Guid userId) { SqlCommand cmd; DataSet ds; object[] objects; UrlClass[] urls; cmd = _dbConn.GetStoredProcedureCommand("Urls_GetUserUrls"); cmd.Parameters.AddWithValue("@UserId", userId); ds = _dbConn.GetDataSet(cmd); if (ds.Tables[0].Rows.Count == 0) { return(new UrlClass[0]); } objects = DataMapper.CreateObjects(ds, typeof(UrlClass)); urls = new UrlClass[objects.Length]; objects.CopyTo(urls, 0); return(urls); }
public void TestMethod() { string st = UrlClass.GetValue(); Assert.IsNotEmpty(st); }
static void Main(string[] args) { string st = UrlClass.GetValue(); }
public string Post([FromBody] UrlClass value) { return(this._urlService.GetShort(value.Url)); }
public ApiXmlObject() { urlClass = new UrlClass(); }