コード例 #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            var       dtType       = cmbDateType.SelectedItem as DateType;
            string    prvsYeardate = dtPicker.Value.AddYears(-1).ToString("yyyy-MM-dd");
            DataTable dt           = new DataTable();
            string    filterString = GetFilterstring().Replace(" OR (ServiceNameId=1 AND ServiceTypeId=1  AND Donordate <= '#" + prvsYeardate + "#')", "") + " AND Mobile is null";

            if (cmbDateType.Enabled == true && dtType.Id != 3)
            {
                filterString = filterString + " OR (" + GetFilterForMonthlyAnnadanam() + " AND Mobile is null)";
            }
            var DonorList = oDonorRepository.GetAllasDataTable().Select(filterString);

            if (DonorList.Count() != 0)
            {
                DataView view = new DataView(DonorList.CopyToDataTable());
                dt = view.ToTable(false, "Address", "Surname", "NameOn", "DistrictName", "City", "Pin", "State", "Country", "ServiceTypeId", "MR_NO");
                dt.Columns.Add("ServiceType");
                foreach (DataRow dr in dt.Rows)
                {
                    dr["ServiceType"] = lstServiceType[Convert.ToInt32(dr["ServiceTypeId"])].Name;
                }
                DonorReportDataSet drs = new DonorReportDataSet();
                drs.Tables.Add(dt);
                AddressForm oAddressForm = new AddressForm(dt);
                oAddressForm.Show();
            }
            else
            {
                MessageBox.Show("Donors were not found for the selected filters");
            }
        }
コード例 #2
0
 private void button3_Click(object sender, EventArgs e)
 {
     var dtType = cmbDateType.SelectedItem as DateType;
     string prvsYeardate = dtPicker.Value.AddYears(-1).ToString("yyyy-MM-dd");
     DataTable dt = new DataTable();
     string filterString = GetFilterstring().Replace(" OR (ServiceNameId=1 AND ServiceTypeId=1  AND Donordate <= '#" + prvsYeardate + "#')", "") + " AND Mobile is null";
     var DonorList = oDonorRepository.GetAllasDataTable().Select(filterString);
     if (DonorList.Count() != 0)
     {
         DataView view = new DataView(DonorList.CopyToDataTable());
         dt = view.ToTable(false, "DoorNo", "Mandal", "Surname", "NameOn", "DistrictName", "City", "Pin", "State", "Country", "ServiceTypeId", "MR_NO");
         dt.Columns.Add("ServiceType");
         foreach (DataRow dr in dt.Rows)
         {
             dr["ServiceType"] = lstServiceType[Convert.ToInt32(dr["ServiceTypeId"])].Name;
         }
         DonorReportDataSet drs = new DonorReportDataSet();
         drs.Tables.Add(dt);
         AddressForm oAddressForm = new AddressForm(dt);
         oAddressForm.Show();
     }
     else
         MessageBox.Show("Donors were not found for the selected filters");
 }