Page 164 - ระบบสารสนเทศเพื่อการบริหารจัดการเอกสารอิเล็กทรอนิกส์ (e-Document)
P. 164

ห้องสมุดกรมพัฒนาที่ดิน
                                                                                                        ค- 51




                          string YMD1 = Request.Form["ddlDolY"] + Request.Form["ddlDolM"] +
                  Request.Form["ddlDolD"];
                          string YMD2 = Request.Form["ddlDolY2"] + Request.Form["ddlDolM2"] +
                  Request.Form["ddlDolD2"];

                          if (!YMD1.Contains("na") && !YMD2.Contains("na"))
                              sSql += " AND (Deputy.Deputy_YMD >= N'" + YMD1 + "') AND
                  (Deputy.Deputy_YMD <= N'" + YMD2 + "')";
                              sSql += " Order By Deputy.Deputy_YMD";
                          if (cbSortStyle.Checked)
                              sSql += " desc";
                          DbMgt table = new DbMgt(str);
                          MyDataSet ds = new MyDataSet(table.exReader(sSql));
                          lblCountA.Text = "ข้อมูลที่ค้นพบ ตามเงื่อนไข มีจ านวน " +
                  ds.RecordCount().ToString("#,##0") + " รายการ";
                          DbDeputy.SelectCommand = sSql;
                          Session["SQL"] = sSql;
                          GridView1.DataBind();
                      }

                      protected void BtnSe_Click(object sender, EventArgs e)
                      {
                          reQuery();
                      }
                      protected void reQueryOnSortAndPaging()
                      {
                          string sSql = Session["SQL"].ToString();
                          DbDeputy.SelectCommand = sSql;
                          GridView1.DataBind();
                          DbMgt table = new DbMgt(str);
                          MyDataSet ds = new MyDataSet(table.exReader(sSql));
                      }
                      protected void BtnCe_Click(object sender, EventArgs e)
                      {
                          string sSql = "";
                          txtDeputyNumSe.Text = "";
                          txtDeputyTitleSe.Text = "";

                          FormDDL ddl = new FormDDL(str);
                          string sToday = ut.CurrentYYYYMMDD();
                          string sD = sToday.Substring(6, 2);
                          string sM = sToday.Substring(4, 2);
                          string sY = sToday.Substring(0, 4);
                          lblDolD.Text = ddl.createDDLD("ddlDolD", sD, "", "", false);
                          lblDolM.Text = ddl.createDDLM("ddlDolM", sM, "", "", false);
                          lblDolY.Text = ddl.createDDLY("ddlDolY", 2018, 2030, sY, "", "",
                  false);
                          lblDolD2.Text = ddl.createDDLD("ddlDolD2", sD, "", "", false);
                          lblDolM2.Text = ddl.createDDLM("ddlDolM2", sM, "", "", false);
                          lblDolY2.Text = ddl.createDDLY("ddlDolY2", 2018, 2030, sY, "", "",
                  false);

                      }

                      protected void GridView1_PageIndexChanged(object sender, EventArgs e)
                      {
                          reQueryOnSortAndPaging();
                      }
   159   160   161   162   163   164   165   166   167   168   169