コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            lbl_hit.Text = Global.TotalNumberOfUsers.ToString();
            GenelDataContext db = new GenelDataContext();
            var item            = from b in db.tbl_Books
                                  select b;
            int num = 0;

            foreach (var z in item)
            {
                num++;
            }
            Label1.Text = num.ToString();
        }
コード例 #2
0
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            GenelDataContext db = new GenelDataContext();

            for (int i = 0; i < GridView1.Rows.Count; i++)
            {
                if (((CheckBox)GridView1.Rows[i].Cells[0].FindControl("CheckBox1")).Checked)
                {
                    var item = from m in db.tbl_Messages
                               where m.MessageID == int.Parse(GridView1.Rows[i].Cells[1].Text)
                               select m;
                    foreach (var z in item)
                    {
                        z.state = "Readed";
                        db.SubmitChanges();
                        GridView1.DataBind();
                    }
                }
            }
        }
コード例 #3
0
        protected void LinkButton1_Click(object sender, EventArgs e)
        {
            GenelDataContext db = new GenelDataContext();

            for (int i = 0; i < GridView1.Rows.Count; i++)
            {
                if (((CheckBox)GridView1.Rows[i].Cells[0].FindControl("CheckBox_Select")).Checked)
                {
                    var item = from o in db.tbl_orders
                               where o.OrderID == int.Parse(GridView1.Rows[i].Cells[1].Text)
                               select o;
                    foreach (var z in item)
                    {
                        z.State      = "Done";
                        z.FinishDate = DateTime.Now;
                        db.SubmitChanges();
                        GridView1.DataBind();
                    }
                }
            }
        }