protected void btnSubmit_ServerClick(object sender, EventArgs e) { MyCoffeeDataContext mf = new MyCoffeeDataContext(ConfigurationManager.ConnectionStrings["MyCoffeeConnectionString"].ToString()); Users info = new Users(); String name = txtUserName.Value.Trim().ToString(); String pwd = Password1.Value.Trim().ToString(); String email = Email.Value.Trim().ToString(); String pwd2 = Password2.Value.Trim().ToString(); if (pwd == pwd2) { info.UserName = name; info.PassWord = pwd; info.Email = email; mf.Users.InsertOnSubmit(info); mf.SubmitChanges(); Session["UserName"] = name; Session["pwd"] = pwd; Response.Redirect("~/UserLogin.aspx"); } else { Response.Write("<script>alter('密码两次不一样!');</script>"); } }
protected void Button1_ServerClick(object sender, EventArgs e) { MyCoffeeDataContext mf = new MyCoffeeDataContext(); String name = UserName.Value.Trim().ToString(); String pwd = Password.Value.Trim().ToString(); var result = from v in mf.Users where v.UserName == name && v.PassWord == pwd select v; if (result.Count() > 0) { if (name == "Admin") { Session["UserName"] = name; Session["pwd"] = pwd; Response.Redirect("~/AdminPage.aspx"); } else { Session["UserName"] = name; Session["pwd"] = pwd; Response.Redirect("~/MemberPage.aspx"); } } }
protected void submint_ServerClick(object sender, EventArgs e) { MyCoffeeDataContext mf = new MyCoffeeDataContext(ConfigurationManager.ConnectionStrings["MyCoffeeConnectionString"].ToString()); String name = UserName.Value.Trim().ToString(); String context = txtArea.Value.ToString(); Context info = new Context(); info.UserName = name; info.Context1 = context; mf.Context.InsertOnSubmit(info); mf.SubmitChanges(); Response.Redirect("~/Contact.aspx"); }
protected void Button1_ServerClick(object sender, EventArgs e) { MyCoffeeDataContext mf = new MyCoffeeDataContext(); var result1 = from u in mf.Users where u.UserName == Text1.Value select u; foreach (Users s in result1) { s.PassWord = Password1.Value = Password2.Value; } mf.SubmitChanges(); Response.Redirect("~/UserLogin.aspx"); }
protected void Add_ServerClick(object sender, EventArgs e) { MyCoffeeDataContext mf = new MyCoffeeDataContext(ConfigurationManager.ConnectionStrings["MyCoffeeConnectionString"].ToString()); Product info = new Product(); info.ProductId = int.Parse(ProductId.Value.ToString()); info.Name = Name.Value; info.ListPrice = int.Parse(ListPrice.Value.ToString()); info.UnitCost = int.Parse(UnitCost.Value.ToString()); info.Descn = Descn.Value; info.Qty = int.Parse(Qty.Value.ToString()); mf.Product.InsertOnSubmit(info); mf.SubmitChanges(); Response.Redirect("~/Admin.aspx"); }
protected void Add_ServerClick(object sender, EventArgs e) { MyCoffeeDataContext mf = new MyCoffeeDataContext(ConfigurationManager.ConnectionStrings["MyCoffeeConnectionString"].ToString()); UserInfor info = new UserInfor(); info.UserId = int.Parse(UserId.Value.ToString()); info.UserName = Name.Value; info.Sex = Sex.Value; info.Birth = Birth.Value; info.Address = Address.Value; info.Email = Email.Value; info.prority = int.Parse(prority.Value.ToString()); mf.UserInfor.InsertOnSubmit(info); mf.SubmitChanges(); Response.Redirect("UserInforA.aspx"); }
protected void Change_ServerClick(object sender, EventArgs e) { MyCoffeeDataContext mf = new MyCoffeeDataContext(); var results = from r in mf.Product where r.ProductId == int.Parse(ProductId.Value.ToString()) select r; if (results != null) { foreach (Product r in results) { r.Name = Name.Value; r.ListPrice = int.Parse(ListPrice.Value.ToString()); r.UnitCost = int.Parse(UnitCost.Value.ToString()); r.Descn = Descn.Value; r.Qty = int.Parse(Qty.Value.ToString()); } mf.SubmitChanges(); Response.Redirect("~/Admin.aspx"); } }
protected void AddProduct_ServerClick(object sender, EventArgs e) { MyCoffeeDataContext mf = new MyCoffeeDataContext(ConfigurationManager.ConnectionStrings["MyCoffeeConnectionString"].ToString()); Goods info = new Goods(); }