protected void Button_Click(object sender, EventArgs e) { if (Page.IsValid) { TextBox TBId = (TextBox)LV1.FindControl("TBId"); TextBox TBCat = (TextBox)LV1.FindControl("TBCat"); string _Id = TBId.Text; string _Categorie = TBCat.Text; TBId.Text = String.Empty; TBCat.Text = String.Empty; string query = "insert into Categorie values (@id, @gen);"; SqlConnection con = new SqlConnection(@"Data Source=(LocalDb)\v11.0;AttachDbFilename='C:\Users\Iulian\Documents\Visual Studio 2013\WebSites\WebSite5\App_Data\aspnet-WebSite5-2eb0dc8c-e5d7-47c5-adc9-8695639eb6ae.mdf';Initial Catalog=aspnet-WebSite5-2eb0dc8c-e5d7-47c5-adc9-8695639eb6ae;Integrated Security=True"); con.Open(); try { SqlCommand com = new SqlCommand(query, con); com.Parameters.AddWithValue("id", _Id); com.Parameters.AddWithValue("gen", _Categorie); com.ExecuteScalar(); } catch { } finally { con.Close(); } } }
protected void btnSearch_Click(object sender, EventArgs e) { NewsServiceClient newsSvc = new NewsServiceClient(); string searchOption = searchBox.Text; var listOfStrings = new List <AdminClientApp.NewsSVC.New>(); AdminClientApp.NewsSVC.New[] newsArr = listOfStrings.ToArray(); if (rbtnTenNews.Checked == true) { newsArr = newsSvc.GetTenNews(searchOption); } if (rtbnSimilar.Checked == true) { newsArr = newsSvc.GetSimilarNews(searchOption); } if (rtbnPositive.Checked == true) { newsArr = newsSvc.GetNBestPossitive(searchOption); } if (rtbnNegative.Checked == true) { newsArr = newsSvc.GetNBestNegative(searchOption); } LV1.DataSource = newsArr; LV1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); con.Open(); SqlCommand cmd = new SqlCommand("select * from Student", con); SqlDataReader rd = cmd.ExecuteReader(); LV1.DataSource = rd; LV1.DataBind(); con.Close(); }
protected void Button_Click(object sender, EventArgs e) { if (Page.IsValid) { TextBox TBTitle = (TextBox)LV1.FindControl("TBTitle"); TextBox TBCategorie = (TextBox)LV1.FindControl("TBCategorie"); TextBox TBDescriere = (TextBox)LV1.FindControl("TBDescriere"); TextBox TBAutor = (TextBox)LV1.FindControl("TBAutor"); TextBox TBData = (TextBox)LV1.FindControl("TBData"); TextBox TBImagine = (TextBox)LV1.FindControl("TBImagine"); TextBox TBCatch = (TextBox)LV1.FindControl("TBCatch"); TextBox TBLink = (TextBox)LV1.FindControl("TBLink"); int val = 0; string _Titlu = TBTitle.Text; string _Gen = val.ToString(); string _Descriere = TBDescriere.Text; string _Autor = TBAutor.Text; string _Data = DateTime.Today.ToString(); string _Imagine = TBImagine.Text; string _Catch = TBCatch.Text; string _Link = TBLink.Text; string query = "INSERT into Stiri" + "(Gen_stire,Titlu,Descriere,Autor,Data,Imagine,Catchphrase,Link) VALUES (@Categorie,@Titlu,@Descriere,@Autor,@Data,@Imagine,@Catch,@Link);" + "SELECT CAST(scope_identity() AS int)"; SqlConnection con = new SqlConnection(@"Data Source=(LocalDb)\v11.0;AttachDbFilename='C:\Users\Iulian\Documents\Visual Studio 2013\WebSites\WebSite5\App_Data\aspnet-WebSite5-2eb0dc8c-e5d7-47c5-adc9-8695639eb6ae.mdf';Initial Catalog=aspnet-WebSite5-2eb0dc8c-e5d7-47c5-adc9-8695639eb6ae;Integrated Security=True"); con.Open(); try { SqlCommand com = new SqlCommand(query, con); com.Parameters.AddWithValue("Categorie", _Gen); com.Parameters.AddWithValue("Titlu", _Titlu); com.Parameters.AddWithValue("Descriere", _Descriere); com.Parameters.AddWithValue("Autor", _Autor); com.Parameters.AddWithValue("Data", _Data); com.Parameters.AddWithValue("Imagine", _Imagine); com.Parameters.AddWithValue("Catch", _Catch); com.Parameters.AddWithValue("Link", _Link); com.ExecuteScalar(); } catch (Exception ex) { } finally { con.Close(); } } }
protected void Button_Click(object sender, EventArgs e) { if (Page.IsValid && Request.Params["Id"] != null && Page.IsPostBack) { TextBox TBTitle = (TextBox)LV1.FindControl("TBTitle"); TextBox TBCategorie = (TextBox)LV1.FindControl("TBCategorie"); TextBox TBDescriere = (TextBox)LV1.FindControl("TBDescriere"); TextBox TBAutor = (TextBox)LV1.FindControl("TBAutor"); TextBox TBData = (TextBox)LV1.FindControl("TBData"); TextBox TBImagine = (TextBox)LV1.FindControl("TBImagine"); TextBox TBCatch = (TextBox)LV1.FindControl("TBCatch"); TextBox TBLink = (TextBox)LV1.FindControl("TBLink"); int ID = int.Parse(Request.Params["Id"].ToString()); string _Titlu = TBTitle.Text; string _Gen = TBCategorie.Text; string _Descriere = TBDescriere.Text; string _Autor = TBAutor.Text; string _Data = TBData.Text; string _Imagine = TBImagine.Text; string _Catch = TBCatch.Text; string _Link = TBLink.Text; SqlConnection con = new SqlConnection(@"Data Source=(LocalDb)\v11.0;AttachDbFilename='C:\Users\Iulian\Documents\Visual Studio 2013\WebSites\WebSite5\App_Data\aspnet-WebSite5-2eb0dc8c-e5d7-47c5-adc9-8695639eb6ae.mdf';Initial Catalog=aspnet-WebSite5-2eb0dc8c-e5d7-47c5-adc9-8695639eb6ae;Integrated Security=True"); con.Open(); try { string query2 = "UPDATE Stiri " + " SET Gen_stire = @Categorie, Titlu = @Titlu, Descriere = @Descriere, Autor = @Autor, Data = @Data, Imagine = @Imagine, Catchphrase = @Catch, Link = @Link" + " Where Id = @id"; SqlCommand com2 = new SqlCommand(query2, con); com2.Parameters.AddWithValue("id", ID); com2.Parameters.AddWithValue("Categorie", _Gen); com2.Parameters.AddWithValue("Descriere", _Descriere); com2.Parameters.AddWithValue("Autor", _Autor); com2.Parameters.AddWithValue("Data", _Data); com2.Parameters.AddWithValue("Imagine", _Imagine); com2.Parameters.AddWithValue("Titlu", _Titlu); com2.Parameters.AddWithValue("Catch", _Catch); com2.Parameters.AddWithValue("Link", _Link); com2.ExecuteNonQuery(); } catch (Exception ex) { } finally { con.Close(); } } }
protected void Page_Load(object sender, EventArgs e) { UserInfoLogic usersList = new UserInfoLogic(); List <UserInfoItem> AllUsers = new List <UserInfoItem>(); AllUsers = usersList.GetAllData(); LV1.DataSource = AllUsers; LV1.DataBind(); LV2.DataSource = AllUsers; LV2.DataBind(); DV1.DataSource = AllUsers; DV1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { TextBox TBTitle = (TextBox)LV1.FindControl("TBTitle"); TextBox TBCategorie = (TextBox)LV1.FindControl("TBCategorie"); TextBox TBDescriere = (TextBox)LV1.FindControl("TBDescriere"); TextBox TBAutor = (TextBox)LV1.FindControl("TBAutor"); TextBox TBData = (TextBox)LV1.FindControl("TBData"); TextBox TBImagine = (TextBox)LV1.FindControl("TBImagine"); TextBox TBCatch = (TextBox)LV1.FindControl("TBCatch"); TextBox TBLink = (TextBox)LV1.FindControl("TBLink"); int ID = int.Parse(Request.Params["Id"].ToString()); string query = "Select *" + "From Stiri where Id= @Id"; SqlConnection con = new SqlConnection(@"Data Source=(LocalDb)\v11.0;AttachDbFilename='C:\Users\Iulian\Documents\Visual Studio 2013\WebSites\WebSite5\App_Data\aspnet-WebSite5-2eb0dc8c-e5d7-47c5-adc9-8695639eb6ae.mdf';Initial Catalog=aspnet-WebSite5-2eb0dc8c-e5d7-47c5-adc9-8695639eb6ae;Integrated Security=True"); con.Open(); try { SqlCommand com = new SqlCommand(query, con); com.Parameters.AddWithValue("Id", ID); SqlDataReader reader = com.ExecuteReader(); while (reader.Read()) { TBTitle.Text = reader["Titlu"].ToString(); TBCategorie.Text = reader["Gen_stire"].ToString(); TBDescriere.Text = reader["Descriere"].ToString(); TBAutor.Text = reader["Autor"].ToString(); TBData.Text = DateTime.Parse(reader["Data"].ToString()).ToShortDateString(); TBImagine.Text = reader["Imagine"].ToString(); TBCatch.Text = reader["Catchphrase"].ToString(); TBLink.Text = reader["Link"].ToString(); } } catch (Exception ex) { } finally { con.Close(); } } }
public Tree_Model() { var n = new LV1 { Value = "A", }; n.Children.Add(new LV2() { Value = "B" }); RootNodes.Add(n); RootNodes.Add(n); RootNodes.Add(n); RootNodes.Add(n); RootNodes.Add(n); }
private void go() { if (mode == findmode.List) { SQL = "SELECT customerId As ID, customerName As Name, deviceType As Device, customerPhone As Phone, Left(description,50) As Description" + " FROM list WHERE customerName LIKE ?"; } /*else if (mode == findmode.Category) * { * SQL = "SELECT CategoryID, CategoryName, Left(Description,50) As Description" + * " FROM categories WHERE CategoryName LIKE ?"; * }*/ else { return; } try { cmd.Parameters.Clear(); cmd.CommandText = SQL; cmd.Parameters.AddWithValue("@param", txtSearch.Text + "%"); reader = cmd.ExecuteReader(); g.find.Changed = false; My.LVLoad(LV1, reader, true); if (LV1.Items.Count > 0) { LV1.Focus(); LV1.Items[0].Selected = true; } if (reader != null) { reader.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string searchOption = searchBox.Text; NewsServiceClient newsSvc = new NewsServiceClient(); AdminClientApp.NewsSVC.New[] newsArr = newsSvc.GetTenNews(searchOption); LV1.DataSource = newsArr; LV1.DataBind(); int[] userIDs = new int[5] { 1, 2, 3, 4, 5 }; Random random = new Random(); int index = random.Next(0, userIDs.Length); int userID = userIDs[index]; Session["userID"] = userID; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { HttpChannel chnl = new HttpChannel(); try { ChannelServices.RegisterChannel(chnl, false); } catch (RemotingException ex) { //all good, nobody cares, but we log it } mgr = (INewsManager)Activator.GetObject(typeof(INewsManager), "http://localhost:1234/NewsManager.soap"); LV1.DataSource = mgr.getLastTenNews(); LV1.DataBind(); } }
void GotDlcList(object sender, PDL e) { string PlData = e.DlcListData; if (Strings.InStr(PlData, "cell__title") > 0) { string[] Spl1, Spl2, Spl3, Spl4; string TmpTitle, TmpURL, TmpImgUrl, TmpType, TmpPlatForm; if (Strings.InStr(PlData, "paginator-control__end paginator-control__arrow-navigation internal-app-link ember-view") > 0) { pageNum = pageNum + 1; htmBuffer = htmBuffer + PlData; PDL1.GetDlcList(titleID, titleRgn, pageNum); } else { htmBuffer = htmBuffer + PlData; LV1.BeginUpdate(); LV1.Items.Clear(); Spl1 = Regex.Split(htmBuffer, "desktop-presentation__grid-cell__base"); for (int i = 1; i < Information.UBound(Spl1) + 1; i++) { Spl2 = Regex.Split(Spl1[i], "grid-cell__footer"); if (Strings.InStr(Spl2[0], "class=\"grid-cell__title\">") > 0) { Spl3 = Regex.Split(Spl2[0], "class=\"grid-cell__title\">"); Spl4 = Regex.Split(Spl3[1], "<"); } else { Spl3 = Regex.Split(Spl2[0], "<span title=\""); Spl4 = Regex.Split(Spl3[1], "\""); } TmpTitle = Strings.Trim(Spl4[0]); TmpTitle = WebUtility.HtmlDecode(TmpTitle); Spl3 = Regex.Split(Spl2[0], "a href=\""); Spl4 = Regex.Split(Spl3[1], "\""); TmpURL = "https://store.playstation.com" + Strings.Trim(Spl4[0]); Spl3 = Regex.Split(Spl2[0], "img src=\"http"); Spl4 = Regex.Split(Spl3[1], "\""); TmpImgUrl = "http" + Strings.Trim(Spl4[0]); Spl3 = Regex.Split(Spl2[0], "left-detail--detail-2\">"); Spl4 = Regex.Split(Spl3[1], "<"); TmpType = Strings.Trim(Spl4[0]); TmpType = WebUtility.HtmlDecode(TmpType); Spl3 = Regex.Split(Spl2[0], "left-detail--detail-1\">"); Spl4 = Regex.Split(Spl3[1], "<"); TmpPlatForm = Strings.Trim(Spl4[0]); TmpPlatForm = WebUtility.HtmlDecode(TmpPlatForm); if (isAllowed(TmpType)) { string[] TmpItem = { TmpTitle, TmpType, TmpPlatForm, TmpURL, TmpImgUrl }; var LvItem = new ListViewItem(TmpItem); LV1.Items.Add(LvItem); } } LV1.EndUpdate(); } } else { AppLog("ERROR: No HTML content found."); } }
protected TreePathVertice AddAdHocVertice(PointD point, TreePathVertice.VerticeType type) { TreePathVertice V1, V2; if (_vertices.TryGetValue(point.HashName, out V1) == false) { /** * Having ensured that our vertice does not already exist, * we are either adding an origin or destination. * * we need to add the vertice itself (V1), as well as an additional one (V2) on the closest * line segment (L) to the new vertice. * * The vertices at the end of (L) will have each other as neighbors. Since we are * essentially splitting (L) into two segments, */ /** clear any that exist of the given type */ ClearAdHocVertices(type); /** create our new vertice */ V1 = new TreePathVertice(point, type); _vertices.Add(V1.HashName, V1); /** find closest point on the closest line for a second vertice */ Double closestDistance; Line L; PointD closestPoint = m_Lines.ClosestPointTo(point, out L, out closestDistance); DebugLogText(LogLevel.DEBUG, "Added ad-hoc vertice of type {0} at point {1} closest to line [[{2}]] at {3} pixels", type, point, L, closestDistance); if (closestPoint != null) { /** if the closest vertice doesn't exist yet, we will create it, and split the line L */ if (_vertices.TryGetValue(closestPoint.HashName, out V2) == false) { /** get the vertices on the line we are about to split */ TreePathVertice LV1, LV2; if (_vertices.TryGetValue(L.P1.HashName, out LV1) == false || _vertices.TryGetValue(L.P2.HashName, out LV2) == false) { throw new Exception("Vertices on original lines should exist"); } /** create our new vertice on the split line */ V2 = new TreePathVertice(closestPoint, type); _vertices.Add(V2.HashName, V2); /** fix up neighbors */ LV1.TryReplaceNeighbor(LV2, V2); LV2.TryReplaceNeighbor(LV1, V2); V2.TryAddNeighbor(LV1); V2.TryAddNeighbor(LV2); V2.TryAddNeighbor(V1); V1.TryAddNeighbor(V2); /** replace L with two new lines L1 and L2 */ Line l1 = new Line(L.P1, closestPoint); Line l2 = new Line(closestPoint, L.P2); m_Lines.Remove(L); m_Lines.Add(l1); m_Lines.Add(l2); } else { V1.TryAddNeighbor(V2); V2.TryAddNeighbor(V1); } } } // DumpVertices(); return(V1); }
void GotDlcList(object sender, PDL e) { string PlData = e.DlcListData; string[] Spl1, Spl2, Spl3, Spl4; string TmpTitle, TmpURL, TmpImgUrl, TmpType, TmpPlatForm; if (PlData.Contains("{\"bucket\":\"")) { LV1.BeginUpdate(); LV1.Items.Clear(); Spl1 = Regex.Split(PlData, "{\"bucket\":\""); for (int i = 1; i < Spl1.Length; i++) { if (Spl1[i].Contains("\"top_category\":\"add_on\"") || Spl1[i].Contains("\"top_category\":\"avatar\"") || Spl1[i].Contains("\"top_category\":\"theme\"") || Spl1[i].Contains("\"top_category\":\"game_content\"")) { Spl3 = Regex.Split(Spl1[i], ",\"name\":\""); Spl4 = Regex.Split(Spl3[1], "\""); TmpTitle = Spl4[0].Trim(); TmpTitle = WebUtility.HtmlDecode(TmpTitle); TmpTitle = Regex.Replace(TmpTitle, "[^a-zA-Z0-9 -<>&,]", ""); Spl3 = Regex.Split(Spl1[i], "/999/"); Spl4 = Regex.Split(Spl3[1], "/"); switch (Spl4[0].Trim().Substring(0, 1)) { case "U": titleRgn = "en-us"; break; case "E": titleRgn = "en-gb"; break; case "I": titleRgn = "en-us"; break; default: titleRgn = "ja-jp"; break; } TmpURL = "https://store.playstation.com/" + titleRgn + "/product/" + Spl4[0].Trim(); Spl3 = Regex.Split(Spl1[i], "\"url\":\""); Spl4 = Regex.Split(Spl3[1], "\""); TmpImgUrl = Spl4[0].Trim(); Spl3 = Regex.Split(Spl1[i], "\"top_category\":\""); Spl4 = Regex.Split(Spl3[1], "\""); TmpType = Spl4[0].Trim().ToUpper(); TmpPlatForm = ""; string[] TmpItem = { TmpTitle, TmpType, TmpPlatForm, TmpURL, TmpImgUrl }; var LvItem = new ListViewItem(TmpItem); LV1.Items.Add(LvItem); } } LV1.EndUpdate(); } else if (PlData.Contains("\">Content</")) { LV1.BeginUpdate(); LV1.Items.Clear(); if (PlData.Contains("<h1>")) { Spl1 = Regex.Split(PlData, "<h1>"); Spl2 = Regex.Split(Spl1[1], "</h1>"); Text = WebUtility.HtmlDecode(Spl2[0].Trim()); } Spl1 = Regex.Split(PlData, "\">Content</"); Spl2 = Regex.Split(Spl1[1], "</table>"); Spl1 = Regex.Split(Spl2[0], "<a href=\""); for (int i = 1; i < Spl1.Length; i++) { if (Spl1[i].Contains("<td>DLC</td>") || Spl1[i].Contains("<td>Avatar</td>") || Spl1[i].Contains("<td>Theme</td>") || Spl1[i].Contains("<td>Unknown</td>")) { Spl3 = Regex.Split(Spl1[i], ">"); Spl4 = Regex.Split(Spl3[1], "<"); TmpTitle = Spl4[0].Trim(); TmpTitle = WebUtility.HtmlDecode(TmpTitle); TmpTitle = Regex.Replace(TmpTitle, "[^a-zA-Z0-9 -<>&,]", ""); Spl3 = Regex.Split(Spl1[i], "cell\">"); Spl4 = Regex.Split(Spl3[1], "<"); switch (Spl4[0].Trim().Substring(0, 1)) { case "U": titleRgn = "en-us"; break; case "E": titleRgn = "en-gb"; break; case "I": titleRgn = "en-us"; break; default: titleRgn = "ja-jp"; break; } TmpURL = "https://store.playstation.com/" + titleRgn + "/product/" + Spl4[0].Trim(); TmpImgUrl = ""; TmpType = "Unknown"; if (Spl1[i].Contains("<td>DLC</td>")) { TmpType = "DLC"; } if (Spl1[i].Contains("<td>Avatar</td>")) { TmpType = "Avatar"; } if (Spl1[i].Contains("<td>Theme</td>")) { TmpType = "Theme"; } TmpPlatForm = ""; string[] TmpItem = { TmpTitle, TmpType, TmpPlatForm, TmpURL, TmpImgUrl }; var LvItem = new ListViewItem(TmpItem); LV1.Items.Add(LvItem); } } LV1.EndUpdate(); } else { AppLog("ERROR: No HTML content found."); } }
void GotSearch(object sender, PDL e) { string PlData = e.SearchData; string[] Spl1, Spl3, Spl4; string TmpTitle, TmpURL, TmpImgUrl, TmpID, TmpPlatForm; if (PlData.Contains("{\"bucket\":\"")) { LV1.BeginUpdate(); LV1.Items.Clear(); Spl1 = Regex.Split(PlData, "{\"bucket\":\""); for (int i = 1; i < Spl1.Length; i++) { if (Spl1[i].Contains("\"top_category\":\"downloadable_game\"")) { Spl3 = Regex.Split(Spl1[i], "\"short_name\":\""); Spl4 = Regex.Split(Spl3[1], "\""); TmpTitle = Spl4[0].Trim(); TmpTitle = WebUtility.HtmlDecode(TmpTitle); TmpTitle = Regex.Replace(TmpTitle, "[^a-zA-Z0-9 -<>&,]", ""); Spl3 = Regex.Split(Spl1[i], "/999/"); Spl4 = Regex.Split(Spl3[1], "/"); switch (Spl4[0].Trim().Substring(0, 1)) { case "U": titleRgn = "en-us"; break; case "E": titleRgn = "en-gb"; break; case "I": titleRgn = "en-us"; break; default: titleRgn = "ja-jp"; break; } TmpURL = "https://store.playstation.com/" + titleRgn + "/product/" + Spl4[0].Trim(); TmpID = "GAME"; Spl3 = Regex.Split(Spl1[i], "\"url\":\""); Spl4 = Regex.Split(Spl3[1], "\""); TmpImgUrl = Spl4[0].Trim(); TmpPlatForm = ""; string[] TmpItem = { TmpTitle, TmpID, TmpPlatForm, TmpURL, TmpImgUrl }; var LvItem = new ListViewItem(TmpItem); LV1.Items.Add(LvItem); if (Spl1[i].Contains("-CUSA") && TmpURL.Contains("-PPSA")) { Spl3 = Regex.Split(Spl1[i], "-CUSA"); Spl4 = Regex.Split(Spl3[1], "_00"); String cusaId = Spl4[0].Trim(); Spl3 = Regex.Split(TmpURL, "-PPSA"); Spl4 = Regex.Split(Spl3[1], "_00"); String ppsaId = Spl4[0].Trim(); TmpURL = TmpURL.Replace("-PPSA" + ppsaId, "-CUSA" + cusaId); string[] TmpItem1 = { TmpTitle + " [CUSA" + cusaId + "]", TmpID, TmpPlatForm, TmpURL, TmpImgUrl }; var LvItem1 = new ListViewItem(TmpItem1); LV1.Items.Add(LvItem1); } } } LV1.EndUpdate(); } else { AppLog("Nothing found in search."); } }