protected void Button2_Click(object sender, EventArgs e)
 {
     if (!tool.StrIsNullOrEmpty(TextBox2.Text))
     {
         using (dbcms db = new dbcms())
         {
             try
             {
                 db.ExecuteCommand(TextBox2.Text);
             }
             catch (Exception error)
             {
                 tj.Text = TextBox2.Text + " 错误信息:" + error.Message;
             }
             tj.Text = TextBox2.Text + " sql语句执行完毕";
         }
     }
 }
    protected void LinqDataSource2_Inserting(object sender, LinqDataSourceInsertEventArgs e)
    {
        news n = (news)e.NewObject;


        dbcms db = new dbcms();

        try
        {
            n.id = db.news.Max(d => d.id) + 1;
        }
        catch
        {
            n.id = 1;
        }
        n.ndate = DateTime.Now;
        n.ping  = 0;
        n.hit   = 0;
    }
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Insert")
        {
            using (dbcms db = new dbcms())
            {
                link link1  = new link();
                var  footer = ((GridView)sender).FooterRow;
                try
                {
                    link1.id = db.link.Max(d => d.id) + 1;
                }
                catch
                {
                    link1.id = 1;
                }
                link1.name = ((TextBox)footer.Cells[1].FindControl("name")).Text;
                link1.url  = ((TextBox)footer.Cells[2].FindControl("url")).Text;
                link1.logo = ((TextBox)footer.Cells[3].FindControl("logo")).Text;
                link1.demo = ((TextBox)footer.Cells[4].FindControl("demo")).Text;
                try
                {
                    link1.display = Convert.ToInt32(((TextBox)footer.Cells[5].FindControl("dispaly")).Text);
                }
                catch
                {
                    link1.display = 0;
                }
                link1.state = true;
                db.link.InsertOnSubmit(link1);
                db.SubmitChanges();

                GridView1.DataBind();
            }
        }
    }
Beispiel #4
0
 public linkRepository(dbcms _db)
     : base(_db)
 {
 }
Beispiel #5
0
 public favoriteRepository(dbcms _db)
     : base(_db)
 {
 }
Beispiel #6
0
 public clsRepository(dbcms _db)
     : base(_db)
 {
 }
 public newsRepository(dbcms _db)
     : base(_db)
 {
 }
Beispiel #8
0
 public pingRepository(dbcms _db)
     : base(_db)
 {
 }