Example #1
0
        private void btnSearch_ProfileHistory_Click(object sender, EventArgs e)
        {
            try
            {
                tbl_MemberMasterProp Objtbl_MemberMasterProp = new tbl_MemberMasterProp();
                Objtbl_MemberMasterProp.MemberCode = 0;
                Objtbl_MemberMasterProp.ProfileID  = txtProfileId_ProfileHistory.Text; // ProfileID;
                Objtbl_MemberMasterProp.isLogedin  = true;
                Objtbl_MemberMasterProp.LoginCode  = 0;

                tbl_MemberMasterBAL Objtbl_MemberMasterBAL = new tbl_MemberMasterBAL();
                DataSet             dsMemberMaster         = Objtbl_MemberMasterBAL.Load_MemberDetails(Objtbl_MemberMasterProp);
                if (dsMemberMaster.Tables[0].Rows.Count > 0)
                {
                    lblBirthYear.Text = Convert.ToString(dsMemberMaster.Tables[0].Rows[0]["DateOfBirth"]);
                    lblName.Text      = Convert.ToString(dsMemberMaster.Tables[0].Rows[0]["MemberName"]);
                    lblCast.Text      = Convert.ToString(dsMemberMaster.Tables[0].Rows[0]["Caste"]);
                }

                int MemberCode = Objtbl_MemberMasterBAL.GetMemberCode(txtProfileId_ProfileHistory.Text);
                LvwDetails.Clear();
                if (rbtnDetails.Checked)
                {
                    strSql  = " Select MM.ProfileID,MM.MemberName,convert(nvarchar,MM.DateofBirth,103) as DateofBirth,MM.MobileNo,MM.MobileNo1,MM.LandlineNo,";
                    strSql += " SM.StateCity,Convert(varchar(4),MM.DateOfBirth,111) as BornYear, Cas.Caste,CASE WHEN MM.Gender = 0 then 'MALE' else 'FEMALE' END AS Gender, ";
                    strSql += " PL.VisitDate";
                    strSql += " from tbl_MemberMaster MM ";
                    strSql += " inner join dbo.tbl_StateCity SM on SM.StateCityCode=MM.StateCity ";
                    strSql += " LEFT OUTER JOIN dbo.tbl_Caste AS Cas ON MM.Caste = Cas.CasteCode  ";
                    strSql += " INNER JOIN tbl_ProfilevisitLog_new PL ON PL.profileid= MM.profileid";
                    strSql += " WHERE MM.isActive IN (1 ,2) and PL.MemberCode = " + MemberCode + " order by PL.VisitDate DESC  ";
                    //strSql += " WHERE MM.isActive IN (1 ,2) and PL.profileid='" + txtProfileId_VisitLog.Text + "' order by PL.VisitDate DESC  ";
                    DataTable dtDetails = objDb.GetDataTable(strSql);
                    if (dtDetails.Rows.Count > 0)
                    {
                        lblTotalCnt.Text = "Total : " + Convert.ToString(dtDetails.Rows.Count);
                        FieldLength      = new int[] { 150, 200, 100, 120, 0, 0, 100, 80, 80, 0, 150 };
                        objGlobal.FillListView(LvwDetails, dtDetails, FieldLength);
                        LvwDetails.CheckBoxes = false;
                    }
                }
                else if (rbtnSummary.Checked)
                {
                    strSql = " SELECT count(*) as Count,Profileid from tbl_ProfilevisitLog_new where MemberCode=" + MemberCode + " group by Profileid order by count(*) desc ";
                    DataTable dtDetails = objDb.GetDataTable(strSql);
                    if (dtDetails.Rows.Count > 0)
                    {
                        lblTotalCnt.Text = "Total : " + Convert.ToString(dtDetails.Rows.Count);
                        FieldLength      = new int[] { 150, 200 };
                        objGlobal.FillListView(LvwDetails, dtDetails, FieldLength);
                        LvwDetails.CheckBoxes = false;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                tbl_MemberMasterProp Objtbl_MemberMasterProp = new tbl_MemberMasterProp();
                Objtbl_MemberMasterProp.MemberCode = 0;
                Objtbl_MemberMasterProp.ProfileID  = txtSearchValue.Text; // ProfileID;
                Objtbl_MemberMasterProp.isLogedin  = true;
                Objtbl_MemberMasterProp.LoginCode  = 0;

                tbl_MemberMasterBAL Objtbl_MemberMasterBAL = new tbl_MemberMasterBAL();
                DataSet             dsMemberMaster         = Objtbl_MemberMasterBAL.Load_MemberDetails(Objtbl_MemberMasterProp);
                if (dsMemberMaster.Tables[0].Rows.Count > 0)
                {
                    lblBirthYear.Text = Convert.ToString(dsMemberMaster.Tables[0].Rows[0]["DateOfBirth"]);
                    lblName.Text      = Convert.ToString(dsMemberMaster.Tables[0].Rows[0]["MemberName"]);
                    lblCast.Text      = Convert.ToString(dsMemberMaster.Tables[0].Rows[0]["Caste"]);

                    //tbl_MemberMasterBAL Objtbl_MemberMasterBAL = new tbl_MemberMasterBAL();
                    int MemberCode = Objtbl_MemberMasterBAL.GetMemberCode(txtSearchValue.Text);
                    LvwDetails.Clear();
                    lblTotalCnt.Text = "";
                    strSql           = " select mm.membercode,MM.ProfileID,MM.MemberName,convert(nvarchar,MM.DateofBirth,103) as DateofBirth,MM.MobileNo,MM.MobileNo1,MM.LandlineNo, ";
                    strSql          += " SM.StateCity,Convert(varchar(4),MM.DateOfBirth,111) as BornYear, Cas.Caste,CASE WHEN MM.Gender = 0 then 'MALE' else 'FEMALE' END AS Gender, ";
                    strSql          += " CASE WHEN dbo.isYetMember(mm.MemberCode, 0) <= 0 THEN 'FREE' ELSE 'PAID' END AS Membership";
                    strSql          += " from tbl_BookmarkList bm";
                    strSql          += " inner join tbl_MemberMaster mm on mm.membercode=bm.membercode ";
                    strSql          += " left join dbo.tbl_StateCity SM on SM.StateCityCode=MM.StateCity ";
                    strSql          += " LEFT OUTER JOIN dbo.tbl_Caste AS Cas ON MM.Caste = Cas.CasteCode ";
                    strSql          += " WHERE MM.isActive IN (1 ,2) and bm.BookmarkedProfile like '%" + MemberCode + "%'";
                    DataTable dtDetails = objDb.GetDataTable(strSql);
                    if (dtDetails.Rows.Count > 0)
                    {
                        lblTotalCnt.Text = "Total : " + Convert.ToString(dtDetails.Rows.Count);
                        FieldLength      = new int[] { 0, 120, 200, 100, 120, 0, 0, 100, 80, 80, 80, 80 };
                        objGlobal.FillListView(LvwDetails, dtDetails, FieldLength);
                        LvwDetails.CheckBoxes = false;
                    }
                    else
                    {
                        MessageBox.Show("Data not found", txtSearchValue.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor = Cursors.WaitCursor;
                string strCode = "";
                if (txtProfileId.Text == "")
                {
                    MessageBox.Show("Please Enter Profile Id", "Profile Id Validation", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtProfileId.Focus();
                    return;
                }
                if (txtProfileId.Text != "")
                {
                    string    strSQl = "select * from tbl_Membermaster where ProfileId='" + txtProfileId.Text.Trim() + "' ";
                    DataTable dt     = objDb.GetDataTable(strSQl);
                    if (dt.Rows.Count > 0)
                    {
                        strCode = Convert.ToString(dt.Rows[0]["MemberCode"]);
                    }
                    else
                    {
                        MessageBox.Show("Please Enter valid Profile Id", "Valid Profile Id", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        txtProfileId.Focus();
                        return;
                    }
                }
                tbl_MemberMasterProp Objtbl_MemberMasterProp = new tbl_MemberMasterProp();
                Objtbl_MemberMasterProp.MemberCode = Convert.ToInt32(strCode);
                Objtbl_MemberMasterProp.ProfileID  = ""; // ProfileID;
                Objtbl_MemberMasterProp.isLogedin  = true;
                Objtbl_MemberMasterProp.LoginCode  = 0;

                tbl_MemberMasterBAL Objtbl_MemberMasterBAL = new tbl_MemberMasterBAL();
                DataSet             dsMemberMaster         = Objtbl_MemberMasterBAL.Load_MemberDetails(Objtbl_MemberMasterProp);

                dsMemberMaster.Tables[0].TableName = "dsMemberMaster";

                tbl_SibblingDetailsProp Objtbl_SibblingDetailsProp = new tbl_SibblingDetailsProp();
                Objtbl_SibblingDetailsProp.MemberCode = Convert.ToInt32(dsMemberMaster.Tables[0].Rows[0]["MemberCode"]);

                tbl_SibblingDetailsBAL Objtbl_SibblingDetailsBAL = new tbl_SibblingDetailsBAL();
                DataSet dsSibbling = Objtbl_SibblingDetailsBAL.Select_Data(Objtbl_SibblingDetailsProp);
                dsSibbling.Tables[0].TableName = "dsSibblingDtl";

                tbl_MemberPhotosBAL  objtbl_MemberPhotosBAL  = new tbl_MemberPhotosBAL();
                tbl_MemberPhotosProp objtbl_MemberPhotosProp = new tbl_MemberPhotosProp();
                objtbl_MemberPhotosProp.MemberCode = Convert.ToInt32(strCode);
                DataSet dsMemberPhotos = objtbl_MemberPhotosBAL.Select_Data(objtbl_MemberPhotosProp);
                dsMemberPhotos.Tables[0].TableName = "dsMemberPhotos";

                // dsMemberMaster.Tables.Add(dsSibbling.Tables[0]);
                //dsMemberMaster.Tables.Add(dsMemberPhotos.Tables[0]);
                frmReportViewer objReportViewer = new frmReportViewer();
                ReportDocument  cryRpt          = new ReportDocument();
                string          strPath         = Application.StartupPath + @"\REPORTS\MemberMaster.rpt";
                cryRpt.Load(strPath);
                DataSet dstest = new DataSet();

                dstest.Tables.Add(dsMemberMaster.Tables[0].Copy());
                //dstest.Tables.Add(dsMemberPhotos.Tables[0].Copy());
                cryRpt.Subreports["Sibbling"].SetDataSource(dsSibbling.Tables[0]);
                //cryRpt.Subreports["MemberPhotos"].SetDataSource(dsMemberPhotos.Tables[0]);

                cryRpt.SetDataSource(dstest);

                objReportViewer.RptViewer.ReportSource = cryRpt;
                objReportViewer.RptViewer.Refresh();
                objReportViewer.ShowDialog();
                objReportViewer.Focus();
                Cursor = Cursors.Default;
            }
            catch (Exception ex)
            {
                MessageBox.Show(Convert.ToString(ex.Message));
                this.objEventLoging.AppErrlog("Error In AnantMatrimony.rfrmQuickReport.btnSearch_Click() " + ex.ToString());
            }
        }
        private void dgvDetails_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                int    intRowNo  = e.RowIndex;
                string strCode   = Convert.ToString(dgvDetails[(int)CI.MemberCode, e.RowIndex].Value);
                string ProfileId = Convert.ToString(dgvDetails[(int)CI.ProfileId, e.RowIndex].Value);

                if (e.ColumnIndex == (int)CI.Edit)
                {
                    this.objEventLoging.AppClickLog("Search", "Edit", ProfileId, strCode, "");
                    //Global.strMemberCode = strCode;
                    frmMemberMaster objMember = new frmMemberMaster();
                    if (Convert.ToString(dgvDetails[(int)CI.Status, e.RowIndex].Value) == "Active")
                    {
                        frmMemberMaster.isActiveStatus = 1;
                    }
                    else if (Convert.ToString(dgvDetails[(int)CI.Status, e.RowIndex].Value) == "Updated")
                    {
                        frmMemberMaster.isActiveStatus = 2;
                    }
                    frmMemberMaster.strMemberCode = strCode;
                    objMember.ShowDialog();
                    txtCurPage.Text = "1";
                    FillData("");
                    ddlSearchBy.SelectedIndex = 0;
                    txtSearchValue.Text       = "";
                }
                else if (e.ColumnIndex == (int)CI.Print)
                {
                    this.objEventLoging.AppClickLog("Search", "Print", ProfileId, strCode, "");
                    //DataTable dsData = new DataTable();
                    //int PageCount = 0;
                    //string strSql = "select MemberCode,ProfileID,ProfileCreatedBy,MemberName,Gender,DateofBirth,TimeofBirth,BirthPlace,MaritalStatus ";
                    //strSql += " from tbl_membermaster where MemberCode=" + strCode;
                    //dsData = objDb.GetDataTable(strSql);

                    tbl_MemberMasterProp Objtbl_MemberMasterProp = new tbl_MemberMasterProp();
                    Objtbl_MemberMasterProp.MemberCode = 0;
                    Objtbl_MemberMasterProp.ProfileID  = ProfileId; // ProfileID;
                    Objtbl_MemberMasterProp.isLogedin  = true;
                    Objtbl_MemberMasterProp.LoginCode  = 0;

                    tbl_MemberMasterBAL Objtbl_MemberMasterBAL = new tbl_MemberMasterBAL();
                    DataSet             dsMemberMaster         = Objtbl_MemberMasterBAL.Load_MemberDetails(Objtbl_MemberMasterProp);

                    dsMemberMaster.Tables[0].TableName = "dsMemberMaster";

                    tbl_SibblingDetailsProp Objtbl_SibblingDetailsProp = new tbl_SibblingDetailsProp();
                    Objtbl_SibblingDetailsProp.MemberCode = Convert.ToInt32(dsMemberMaster.Tables[0].Rows[0]["MemberCode"]);

                    tbl_SibblingDetailsBAL Objtbl_SibblingDetailsBAL = new tbl_SibblingDetailsBAL();
                    DataSet dsSibbling = Objtbl_SibblingDetailsBAL.Select_Data(Objtbl_SibblingDetailsProp);
                    dsSibbling.Tables[0].TableName = "dsSibblingDtl";


                    tbl_MemberPhotosBAL  objtbl_MemberPhotosBAL  = new tbl_MemberPhotosBAL();
                    tbl_MemberPhotosProp objtbl_MemberPhotosProp = new tbl_MemberPhotosProp();
                    objtbl_MemberPhotosProp.MemberCode = Convert.ToInt32(strCode);
                    DataSet dsMemberPhotos = objtbl_MemberPhotosBAL.Select_Data(objtbl_MemberPhotosProp);
                    dsMemberPhotos.Tables[0].TableName = "dsMemberPhotos";

                    // dsMemberMaster.Tables.Add(dsSibbling.Tables[0]);
                    //dsMemberMaster.Tables.Add(dsMemberPhotos.Tables[0]);
                    frmReportViewer objReportViewer = new frmReportViewer();
                    ReportDocument  cryRpt          = new ReportDocument();
                    string          strPath         = Application.StartupPath + @"\REPORTS\MemberMaster.rpt";
                    cryRpt.Load(strPath);
                    DataSet dstest = new DataSet();

                    dstest.Tables.Add(dsMemberMaster.Tables[0].Copy());
                    //dstest.Tables.Add(dsMemberPhotos.Tables[0].Copy());
                    cryRpt.Subreports["Sibbling"].SetDataSource(dsSibbling.Tables[0]);
                    //cryRpt.Subreports["MemberPhotos"].SetDataSource(dsMemberPhotos.Tables[0]);

                    cryRpt.SetDataSource(dstest);

                    objReportViewer.RptViewer.ReportSource = cryRpt;
                    objReportViewer.RptViewer.Refresh();
                    objReportViewer.ShowDialog();
                    objReportViewer.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }