예제 #1
0
        protected void OnPaging(object sender, GridViewPageEventArgs e)
        {
            GV_Accident.PageIndex = e.NewPageIndex;
            DataTable nTable = Accident_Data.GetList();

            GV_Accident.DataSource = nTable;
            GV_Accident.DataBind();
        }
예제 #2
0
        protected void cmdView_Click1(object sender, ImageClickEventArgs e)
        {
            DateTime  dtfrom = DateTime.ParseExact(txtfromDatetime.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            DateTime  dtto   = DateTime.ParseExact(txttoDatetime.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            DataTable nTable = Accident_Data.GetList(dtfrom, dtto);

            GV_Accident.DataSource = nTable;
            GV_Accident.DataBind();
        }
예제 #3
0
        public void LoadData()
        {
            DataTable nTable = Accident_Data.GetList();

            GV_Accident.DataSource = nTable;
            GV_Accident.DataBind();
            DateTime dt = DateTime.Now;

            txtfromDatetime.Text = "01/01/2013";
            txttoDatetime.Text   = DateTime.Now.ToString("dd/MM/yyyy");
        }
예제 #4
0
 protected void GrDelete(object sender, CommandEventArgs e)
 {
     try
     {
         int          mKey = int.Parse(e.CommandArgument.ToString());
         Harvest_Info info = new Harvest_Info(mKey);
         if ((DateTime.Now - info.DateOn).TotalDays > 7)
         {
             Response.Write("<script >alert('Dữ liệu đã quá 7 ngày, không được phép xóa!')</script>");
         }
         else
         {
             info.Delete();
             DataTable nTable = Accident_Data.GetList();
             GV_Accident.DataSource = nTable;
             GV_Accident.DataBind();
         }
     }
     catch
     {
         Response.Write("<script >alert('Có lỗi gì đó vui lòng thử lại!')</script>");
     }
 }