Exemple #1
0
    protected void delete_ServerClick(object sender, EventArgs e)
    {
        var result = from t in mf.UserInfor
                     where t.UserId == int.Parse(search.Value.ToString())
                     select t;

        mf.UserInfor.DeleteAllOnSubmit(result);
        mf.SubmitChanges();

        Bind();
    }
Exemple #2
0
    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>");
        }
    }
Exemple #3
0
    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");
    }
Exemple #4
0
    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 AddProduct1_ServerClick(object sender, EventArgs e)
 {
     info.GoodsId    = 1;
     info.Name       = "曼特宁咖啡";
     info.Price      = 40;
     info.Qty        = 1;
     info.TotalPrice = 40;
     mf.Goods.InsertOnSubmit(info);
     mf.SubmitChanges();
 }
Exemple #7
0
    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");
    }
Exemple #8
0
    protected void 修改_ServerClick(object sender, EventArgs e)
    {
        var results = from r in mf.UserInfor
                      where r.UserName == UserName.Value
                      select r;

        if (results != null)
        {
            foreach (UserInfor r in results)
            {
                r.Sex     = Sex.Value;
                r.Birth   = Birth.Value;
                r.Address = Address.Value;
                r.Email   = Email.Value;
            }
            mf.SubmitChanges();
        }
    }
    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");
        }
    }