Example #1
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                string Caste_Sel = "", Education_Sel = "", Country_Sel = "", State_Sel = "", MaritalStatus_Sel = "", strHeight = "", strWeight = "";
                tbl_MemberMasterSearchProp Objtbl_MemberMasterSearchProp = new tbl_MemberMasterSearchProp();
                Objtbl_MemberMasterSearchProp.sMemberCode   = -1;
                Objtbl_MemberMasterSearchProp.sGender       = (rdbtnMale.Checked == true ? "0" : "1");
                Objtbl_MemberMasterSearchProp.sAgeStart     = ddlPAgeFrom.Text;
                Objtbl_MemberMasterSearchProp.sAgeUpto      = ddlPAgeTo.Text;
                Objtbl_MemberMasterSearchProp.PageNo        = 0;
                Objtbl_MemberMasterSearchProp.RecordCount   = 0;
                Objtbl_MemberMasterSearchProp.sSqlCondition = true;
                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;
                        }
                    }
                }
                Objtbl_MemberMasterSearchProp.sCaste = Caste_Sel;
                if (Caste_Sel == "")
                {
                    MessageBox.Show("Please select any caste", "Caste Selection Validation", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    return;
                }
                Country_Sel = "";
                for (int cnt = 0; cnt < LvwCountry.Items.Count; cnt++)
                {
                    if (LvwCountry.Items[cnt].SubItems[LvwCountry.Columns.Count - 1].Text != "-1")
                    {
                        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;
                            }
                        }
                    }
                }
                Objtbl_MemberMasterSearchProp.sCountry = Country_Sel;
                //if (Country_Sel == "")
                //{
                //    MessageBox.Show("Please select any Country", "Country Selection Validation", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                //    return;
                //}
                for (int cnt = 0; cnt < LvwEducation.Items.Count; cnt++)
                {
                    if (LvwEducation.Items[cnt].SubItems[LvwEducation.Columns.Count - 1].Text != "-1")
                    {
                        if (LvwEducation.Items[cnt].Checked)
                        {
                            if (Education_Sel == "")
                            {
                                Education_Sel = LvwEducation.Items[cnt].SubItems[LvwEducation.Columns.Count - 1].Text;
                            }
                            else
                            {
                                Education_Sel += "," + LvwEducation.Items[cnt].SubItems[LvwEducation.Columns.Count - 1].Text;
                            }
                        }
                    }
                }
                Objtbl_MemberMasterSearchProp.sEducation = Education_Sel;
                //if (Education_Sel == "")
                //{
                //    MessageBox.Show("Please select any Education", "Education Selection Validation", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                //    return;
                //}
                for (int cnt = 0; cnt < LvwMaritalStatus.Items.Count; cnt++)
                {
                    if (LvwMaritalStatus.Items[cnt].SubItems[LvwMaritalStatus.Columns.Count - 1].Text != "-1")
                    {
                        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;
                            }
                        }
                    }
                }
                Objtbl_MemberMasterSearchProp.sMaritalStatus = MaritalStatus_Sel;
                //if (MaritalStatus_Sel == "")
                //{
                //    MessageBox.Show("Please select any Marital Status", "Marital Status Selection Validation", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                //    return;
                //}
                for (int cnt = 0; cnt < LvwState.Items.Count; cnt++)
                {
                    if (LvwState.Items[cnt].SubItems[LvwState.Columns.Count - 1].Text != "-1")
                    {
                        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;
                            }
                        }
                    }
                }
                Objtbl_MemberMasterSearchProp.sStateCity = State_Sel;
                //Objtbl_MemberMasterSearchProp.sSqlCondition

                //if (State_Sel == "")
                //{
                //    MessageBox.Show("Please select any State", "State Selection Validation", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                //    return;
                //}
                int PageCount = 0, RecordCount = 0;
                tbl_MemberMasterBAL objtbl_MemberMasterBAL = new tbl_MemberMasterBAL();
                DataSet             dsdata = objtbl_MemberMasterBAL.Load_ProfileList(Objtbl_MemberMasterSearchProp, ref PageCount, ref RecordCount);
                dsdata.Tables[0].TableName = "dsMainReport";
                frmReportViewer objReportViewer            = new frmReportViewer();
                ReportDocument  cryRpt  = new ReportDocument();
                string          strPath = "";
                if (rbtnFirstPage.Checked)
                {
                    strPath = Application.StartupPath + @"\REPORTS\ProfileReport.rpt";
                }
                else if (rbtnEmail.Checked)
                {
                    strPath = Application.StartupPath + @"\REPORTS\MemberEmailList.rpt";
                }
                else if (rbtnPhoneNumber.Checked)
                {
                    strPath = Application.StartupPath + @"\REPORTS\MemberPhoneNumber.rpt";
                }
                cryRpt.Load(strPath);
                cryRpt.SetDataSource(dsdata.Tables[0]);
                objReportViewer.RptViewer.ReportSource = cryRpt;
                objReportViewer.RptViewer.Refresh();
                objReportViewer.ShowDialog();
                objReportViewer.Focus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
        }