protected void Button1_Click(object sender, EventArgs e) { users new_one = new users(); new_one.Nickname = TextBox1.Text; new_one.Password = TextBox2.Text; all_dataEntities temp = new all_dataEntities(); if (temp.users.Find(TextBox1.Text, @"^(?!\s*$).+") == null) { temp.users.Add(new_one); } else { alert.Text = "This nickname already used."; } temp.SaveChanges(); HttpCookie myCookie = new HttpCookie("User"); myCookie["Nickname"] = new_one.Nickname; myCookie["Pass"] = new_one.Password; myCookie.Expires = DateTime.Now.AddDays(1d); Response.Cookies.Add(myCookie); Session["Nickname"] = TextBox1.Text; Response.Redirect("/Default.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["Exit"] == "true") { Response.Cookies["User"].Expires = DateTime.Now.AddDays(-1); Session.Abandon(); Response.Redirect("Default.aspx"); } else { try { if (Session["Nickname"] != null) { Label1.Text = "Hello " + Session["Nickname"].ToString(); } else { string Co_n = Request.Cookies["User"]["Nickname"]; string Co_p = Request.Cookies["User"]["Pass"]; using (all_dataEntities a = new all_dataEntities()) { if (a.users.Find(Co_n, Co_p) != null) { Session["Nickname"] = Co_n; } } Label1.Text = "Hello " + Session["Nickname"].ToString(); } } catch (Exception) { } } }
protected void Button1_Click(object sender, EventArgs e) { if (Request.QueryString["Article"] != null) { current.Name_of_recepie = Name.Text; current.Recepie = Rec.Text; a.recepies.Attach(current); var entry = a.Entry(current); entry.Property(y => y.Recepie).IsModified = true; entry.Property(y => y.Name_of_recepie).IsModified = true; } else { a = new all_dataEntities(); current = new recepies(); current.Name_of_recepie = Name.Text; current.Recepie = Rec.Text; current.Author = Session["Nickname"].ToString(); current.ID = a.recepies.Count(); a.recepies.Add(current); } a.SaveChanges(); Response.Redirect("Default.aspx"); }
protected void Page_Load(object sender, EventArgs e) { all_dataEntities a = new all_dataEntities(); var query = from recepies in a.recepies select recepies; List<recepies> ass = new List<recepies>(); foreach(var item in query) { ass.Add(item); } Repeater1.DataSource = ass; Repeater1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { all_dataEntities a = new all_dataEntities(); var query = from recepies in a.recepies select recepies; List <recepies> ass = new List <recepies>(); foreach (var item in query) { ass.Add(item); } Repeater1.DataSource = ass; Repeater1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { all_dataEntities a = new all_dataEntities(); var query = from recepies in a.recepies select recepies; List<recepies> data = new List<recepies>(); foreach (var item in query) { data.Add(item); } int s = Convert.ToInt32(Request.QueryString["Article"]); Label1.Text = data[s].Name_of_recepie; Label2.Text = data[s].Recepie; }
protected void Page_Load(object sender, EventArgs e) { all_dataEntities a = new all_dataEntities(); var query = from recepies in a.recepies select recepies; List <recepies> data = new List <recepies>(); foreach (var item in query) { data.Add(item); } int s = Convert.ToInt32(Request.QueryString["Article"]); Label1.Text = data[s].Name_of_recepie; Label2.Text = data[s].Recepie; }
protected void Button1_Click(object sender, EventArgs e) { all_dataEntities a = new all_dataEntities(); if (a.users.Find(TextBox1.Text, TextBox2.Text) != null) { HttpCookie myCookie = new HttpCookie("User"); myCookie["Nickname"] = TextBox1.Text; myCookie["Pass"] = TextBox2.Text; myCookie.Expires = DateTime.Now.AddDays(1d); Response.Cookies.Add(myCookie); Session["Nickname"] = TextBox1.Text; Response.Redirect("/Default.aspx"); } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "UpdateMsg", " $('#NoMatchRegister').toggleClass('hidden');", true); } }
protected void Button1_Click(object sender, EventArgs e) { users new_one = new users(); new_one.Nickname = TextBox1.Text; new_one.Password = TextBox2.Text; all_dataEntities temp = new all_dataEntities(); if (temp.users.Find(TextBox1.Text, @"^(?!\s*$).+") == null) { temp.users.Add(new_one); } else alert.Text = "This nickname already used."; temp.SaveChanges(); HttpCookie myCookie = new HttpCookie("User"); myCookie["Nickname"] = new_one.Nickname; myCookie["Pass"] = new_one.Password; myCookie.Expires = DateTime.Now.AddDays(1d); Response.Cookies.Add(myCookie); Session["Nickname"] = TextBox1.Text; Response.Redirect("/Default.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (Session["Nickname"] != null) { if (Request.QueryString["Article"] != null) { a = new all_dataEntities(); c = Convert.ToInt32(Request.QueryString["Article"]); current = a.recepies.First(n => n.ID == c); if (!IsPostBack) { Rec.Text = current.Recepie; Name.Text = current.Name_of_recepie; } } } else { Rec.Enabled = false; Button1.Enabled = false; Name.Enabled = false; alert.Text = "Please, log in , we need to know who you are!"; } }