protected void OnPaging(object sender, GridViewPageEventArgs e) { GV_Assessment.PageIndex = e.NewPageIndex; DataTable nTable = Assessment_Data.GetList(Convert.ToInt16(Session["EmployeeKey"])); GV_Assessment.DataSource = nTable; GV_Assessment.DataBind(); }
private void LoadData() { string nKey = this.Request["key"]; DateTime time = new DateTime(); if (nKey != "0") { time = DateTime.ParseExact(nKey, "dd/MM/yyyy HH:mm:ss", CultureInfo.CurrentCulture); } if (Session["EmployeeKey"].ToInt() == 0) { Response.Write("<script >alert('Vui lòng chọn xã viên trước!')</script>"); string nUrl = "<script>CloseOnReload()</script>"; ClientScript.RegisterStartupScript(this.GetType(), "closeWindow", nUrl); return; } DateTime currenttime = DateTime.Now; if (nKey == "0" && !(bool)Session["created"]) { nKey = currenttime.ToString("MM/dd/yyyy"); Assessment_Data.CreatNewInfo("", int.Parse(Session["CooperativeKey"].ToString()), Convert.ToInt16(Session["EmployeeKey"])); txtDatetime.Text = ""; DataTable nTable = Assessment_Data.GetListInfo("", Convert.ToInt16(Session["EmployeeKey"])); GV_Assessment.DataSource = nTable; GV_Assessment.DataBind(); Session["created"] = true; Session["createddatetime"] = currenttime; } else { if (nKey == "0") { //time = DateTime.ParseExact(Session["createddatetime"].ToString(), "dd/MM/yyyy", CultureInfo.CurrentCulture); txtDatetime.Text = ""; nKey = ""; } else { txtDatetime.Text = time.ToString("MM/dd/yyyy"); //nKey = time.ToString("MM/dd/yyyy"); Session["created"] = false; } DataTable nTable = Assessment_Data.GetListInfo(txtDatetime.Text, Convert.ToInt16(Session["EmployeeKey"])); GV_Assessment.DataSource = nTable; GV_Assessment.DataBind(); //Session["created"] = false; } }
private void LoadData() { txtfromDatetime.Text = "01/01/2013"; txttoDatetime.Text = DateTime.Now.ToString("dd/MM/yyyy"); DataTable nTable = Assessment_Data.GetList(Convert.ToInt16(Session["EmployeeKey"])); GV_Assessment.DataSource = nTable; if (nTable.Rows.Count == 0) { nTable.Rows.Add(default(DateTime));// Đất Kim loại nặng } GV_Assessment.DataBind(); }
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 = Assessment_Data.GetList(Convert.ToInt16(Session["EmployeeKey"]), dtfrom, dtto); GV_Assessment.DataSource = nTable; if (nTable.Rows.Count == 0) { nTable.Rows.Add(default(DateTime));// Đất Kim loại nặng } GV_Assessment.DataBind(); }
protected void GrDelete(object sender, CommandEventArgs e) { try { int mKey = int.Parse(e.CommandArgument.ToString()); Assessment_Info info = new Assessment_Info(mKey); info.Delete(); DataTable nTable = Assessment_Data.GetList(Convert.ToInt16(Session["EmployeeKey"])); GV_Assessment.DataSource = nTable; GV_Assessment.DataBind(); } catch { Response.Write("<script >alert('Có lỗi gì đó vui lòng thử lại!')</script>"); } }