Ejemplo n.º 1
0
        public void btnSearch_Click()
        {
            DateTime dtFrom = DateTime.Now;
            DateTime dtTo = DateTime.Now;
            if (dfFrom.IsEmpty)
                dtFrom = new DateTime(2000, 12, 31);
            else
                dtFrom = dfFrom.SelectedDate;
            if (dfTo.IsEmpty)
                dtTo = DateTime.Now;
            else
                dtTo = dfTo.SelectedDate;
            if (dtFrom > dtTo)
            {
                X.Msg.Alert("Error", "From Date must smaller than End Date").Show();
                return;
            }

            SuratkeluarQuery skQ = new SuratkeluarQuery();
            skQ.SelectAll();
            if (dtFrom == dtTo)
            {
                skQ.Where(skQ.Tanggal == dtFrom && skQ.Judul.Like("%" + txtJudul.Text.Trim() + "%")
                    && skQ.Keterangan.Like("%" + txtKeterangan.Text.Trim() + "%") && skQ.Nomor.Like("%" + txtNomorSurat.Text.Trim() +
                    "%") && skQ.Kepada.Like("%" + txtPenerima.Text.Trim() + "%"));
            }
            else
            {
                skQ.Where(skQ.Tanggal.Between(dtFrom,dtTo) && skQ.Judul.Like("%" + txtJudul.Text.Trim() + "%")
                    && skQ.Keterangan.Like("%" + txtKeterangan.Text.Trim() + "%") && skQ.Nomor.Like("%" + txtNomorSurat.Text.Trim() +
                    "%") && skQ.Kepada.Like("%" + txtPenerima.Text.Trim() + "%"));
            }

            DataTable dt = skQ.LoadDataTable();
            this.storeOutbox.DataSource = dt;
            this.storeOutbox.DataBind();
        }
Ejemplo n.º 2
0
 public DataTable GetOutbox()
 {
     DataTable dt = new DataTable();
     SuratkeluarQuery smQ = new SuratkeluarQuery();
     smQ.SelectAll();
     dt = smQ.LoadDataTable();
     return dt;
 }