public void FillList()
 {
     try
     {
         string strCond = "", Caste_Sel = "";
         //if (dtpFromDate.Value.ToShortDateString() != dtpToDate.Value.ToShortDateString())
         //{
         strCond += " AND MS.EndDate BETWEEN '" + dtpFromDate.Value.ToString("dd/MMM/yyyy") + "' AND '" + dtpToDate.Value.ToString("dd/MMM/yyyy") + "'";
         //}
         if (strCond == "")
         {
             MessageBox.Show("Please select Something", "Selection Validation", MessageBoxButtons.OK, MessageBoxIcon.Hand);
             return;
         }
         tbl_MemberMasterBAL objtbl_MemberMasterBAL = new tbl_MemberMasterBAL();
         DataSet             dsdata = objtbl_MemberMasterBAL.GET_ExpiredMembership(strCond);
         if (dsdata.Tables[0].Rows.Count > 0)
         {
             lblTotalCnt.Text = "Total : " + Convert.ToString(dsdata.Tables[0].Rows.Count);
             FieldLength      = new int[] { 150, 200, 100, 120, 120, 0, 100, 0, 100, 0, 0, 80, 80, 80, 0 };
             objGlobal.FillListView(LvwDetails, dsdata.Tables[0], FieldLength);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 2
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         string strCond = "", Caste_Sel = "";
         if (dtpFromDate.Value.ToShortDateString() != dtpToDate.Value.ToShortDateString())
         {
             strCond += " AND MS.EndDate BETWEEN '" + dtpFromDate.Value.ToString("dd/MMM/yyyy") + "' AND '" + dtpToDate.Value.ToString("dd/MMM/yyyy") + "'";
         }
         if (Convert.ToString(ddlPAgeFrom.SelectedValue) != Convert.ToString(ddlPAgeTo.SelectedValue))
         {
             strCond += " AND Convert(varchar(4),MM.DateOfBirth,111) Between " + ddlPAgeFrom.SelectedValue + " AND " + ddlPAgeTo.SelectedValue + " ";
         }
         if (rbtnMale.Checked)
         {
             strCond += " AND MM.Gender=0 ";
         }
         else if (rbtnFemale.Checked)
         {
             strCond += " AND MM.Gender=1 ";
         }
         for (int cnt = 0; cnt < LvwCaste.Items.Count; cnt++)
         {
             if (LvwCaste.Items[cnt].Checked)
             {
                 if (Caste_Sel == "")
                 {
                     Caste_Sel = LvwCaste.Items[cnt].SubItems[LvwCaste.Columns.Count - 1].Text;
                 }
                 else
                 {
                     Caste_Sel += "," + LvwCaste.Items[cnt].SubItems[LvwCaste.Columns.Count - 1].Text;
                 }
             }
         }
         if (Caste_Sel != "")
         {
             strCond += " AND MM.Caste in (" + Caste_Sel + ")";
         }
         if (strCond == "")
         {
             MessageBox.Show("Please select Something", "Selection Validation", MessageBoxButtons.OK, MessageBoxIcon.Hand);
             return;
         }
         tbl_MemberMasterBAL objtbl_MemberMasterBAL = new tbl_MemberMasterBAL();
         DataSet             dsdata = objtbl_MemberMasterBAL.GET_ExpiredMembership(strCond);
         if (dsdata.Tables[0].Rows.Count > 0)
         {
             frmReportViewer objReportViewer = new frmReportViewer();
             ReportDocument  cryRpt          = new ReportDocument();
             string          strPath         = "";
             strPath = Application.StartupPath + @"\REPORTS\ExpiredMembership.rpt";
             cryRpt.Load(strPath);
             cryRpt.SetDataSource(dsdata.Tables[0]);
             objReportViewer.RptViewer.ReportSource = cryRpt;
             objReportViewer.RptViewer.Refresh();
             objReportViewer.ShowDialog();
             objReportViewer.Focus();
         }
         else
         {
             MessageBox.Show("No data found", "Data not found", MessageBoxButtons.OK, MessageBoxIcon.Hand);
             return;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }