public void FillGrid(string strCond, string AorB)
 {
     try
     {
         tbl_MemberMasterBAL objtbl_MemberMasterBAL = new tbl_MemberMasterBAL();
         DataSet             dsdata = objtbl_MemberMasterBAL.GET_REGISTERED_MEMBER(strCond);
         if (dsdata.Tables[0].Rows.Count > 0)
         {
             FieldLength = new int[] { 120, 0, 150, 0, 80, 0, 50, 0, 0 };
             if (AorB == "A")
             {
                 objGlobal.FillListView(LvwDetails_A, dsdata.Tables[0], FieldLength);
                 lblTotalCnt_A.Text = "Total : " + dsdata.Tables[0].Rows.Count;
             }
             else
             {
                 objGlobal.FillListView(LvwDetails_B, dsdata.Tables[0], FieldLength);
                 lblTotalCnt_B.Text = "Total : " + dsdata.Tables[0].Rows.Count;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #2
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         string strCond = "", Caste_Sel = "", Country_Sel = "", State_Sel = "", MaritalStatus_Sel = "";
         if (rdbtnMale.Checked)
         {
             strCond += " AND MM.Gender=0 ";
         }
         else if (rdbtnFemale.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 (Convert.ToString(ddlPAgeFrom.SelectedValue) != Convert.ToString(ddlPAgeTo.SelectedValue))
         {
             strCond += " AND Convert(varchar(4),MM.DateOfBirth,111) Between " + ddlPAgeFrom.SelectedValue + " AND " + ddlPAgeTo.SelectedValue + " ";
         }
         for (int cnt = 1; cnt < LvwCountry.Items.Count; cnt++)
         {
             if (LvwCountry.Items[cnt].Checked)
             {
                 if (Country_Sel == "")
                 {
                     Country_Sel = LvwCountry.Items[cnt].SubItems[LvwCountry.Columns.Count - 1].Text;
                 }
                 else
                 {
                     Country_Sel += "," + LvwCountry.Items[cnt].SubItems[LvwCountry.Columns.Count - 1].Text;
                 }
             }
         }
         if (Country_Sel != "")
         {
             strCond += " AND MM.Country in (" + Country_Sel + ")";
         }
         for (int cnt = 1; cnt < LvwState.Items.Count; cnt++)
         {
             if (LvwState.Items[cnt].Checked)
             {
                 if (State_Sel == "")
                 {
                     State_Sel = LvwState.Items[cnt].SubItems[LvwState.Columns.Count - 1].Text;
                 }
                 else
                 {
                     State_Sel += "," + LvwState.Items[cnt].SubItems[LvwState.Columns.Count - 1].Text;
                 }
             }
         }
         if (State_Sel != "")
         {
             strCond += " AND MM.StateCity in (" + State_Sel + ")";
         }
         for (int cnt = 1; cnt < LvwMaritalStatus.Items.Count; cnt++)
         {
             if (LvwMaritalStatus.Items[cnt].Checked)
             {
                 if (MaritalStatus_Sel == "")
                 {
                     MaritalStatus_Sel = LvwMaritalStatus.Items[cnt].SubItems[LvwMaritalStatus.Columns.Count - 1].Text;
                 }
                 else
                 {
                     MaritalStatus_Sel += "," + LvwMaritalStatus.Items[cnt].SubItems[LvwMaritalStatus.Columns.Count - 1].Text;
                 }
             }
         }
         if (MaritalStatus_Sel != "")
         {
             strCond += " AND MM.MaritalStatus in (" + MaritalStatus_Sel + ")";
         }
         if (dtpFromDate.Value.ToShortDateString() != dtpToDate.Value.ToShortDateString())
         {
             strCond += " AND MM.RegisterDate 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_REGISTERED_MEMBER(strCond);
         if (dsdata.Tables[0].Rows.Count > 0)
         {
             frmReportViewer objReportViewer = new frmReportViewer();
             ReportDocument  cryRpt          = new ReportDocument();
             string          strPath         = "";
             strPath = Application.StartupPath + @"\REPORTS\RegisterReport.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);
     }
 }