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

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




                              if (!YMD1.Contains("na") && !YMD2.Contains("na"))
                  sSql += " AND Letter.Letter_YMD >= N'" + YMD1 + "' AND Letter.Letter_YMD <=
                  N'" + YMD2 + "'";
                                  sSql += ") ";
                                  sSql += " Order By Letter.Letter_YMD";
                              if (cbSortStyle.Checked)
                                  sSql += " desc";
                          }
                          else
                          {
                              if (!YMD3.Contains("na") && !YMD4.Contains("na"))
                  sSql += " AND Letter.Letter_RecDate >= N'" + YMD3 + "' AND
                  Letter.Letter_RecDate <= N'" + YMD4 + "'";
                                  sSql += ") ";
                                  sSql += " Order By Letter.Letter_RecDate";
                              if (cbSortStyle1.Checked)
                                  sSql += " desc";
                          }

                          DBLetter.SelectCommand = sSql;
                          Session["SQL"] = sSql;
                          DBLetter.DataBind();
                          DbMgt table = new DbMgt(str);
                          MyDataSet ds = new MyDataSet(table.exReader(sSql));
                          lblCountA.Text = "หนังสือเวียนที่ค้นพบ ตามเงื่อนไข มีจ านวน " +
                  ds.RecordCount().ToString("#,##0") + " รายการ";

                      }

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

                      protected void GridView1_PageIndexChanged(object sender, EventArgs e)
                      {
                          reQueryOnSortAndPaging();
                      }


                      protected void GridView1_Sorted(object sender, EventArgs e)
                      {
                          reQueryOnSortAndPaging();
                      }

                      protected void GridView1_RowDataBound(object sender,
                  GridViewRowEventArgs e)
                      {
                          if (e.Row.RowType == DataControlRowType.DataRow)
                          {
   126   127   128   129   130   131   132   133   134   135   136