Beispiel #1
0
        private void bindData()
        {
            string country, region, city, name, maidenname, surname, femalename, id, Query=null;
             country = Request["country"];
             region = Request["region"];
             city = Request["city"];
             name = Request["name"];
             maidenname = Request["maidenname"];
             surname = Request["surname"];
             femalename = Request["femalename"];
             id = Request["id"];



             Query = "select rid , isnull(country,'') country, isnull(regionCounty,'') regionCounty, isnull(townCity,'') townCity,isnull(deathdate1,'') deathdate1, isnull(message,'') message, isnull(name2,'') name2,isnull(name1,'') name1,isnull(Surname1,'') Surname1, isnull(middlename,'') middlename  from remembrancetdl where active=0 ";

           //  Query = "select iden , isnull(country,'') country, isnull(regionCounty,'') regionCounty, isnull(townCity,'') townCity, isnull(deathdate,'') deathdate, isnull(memorialMessage,'') memorialMessage, isnull(femalefirstname,'') femalefirstname, isnull(deceasedSurname,'') deceasedSurname, isnull(deceasedmaidenname,'') deceasedmaidenname,  case isnull(deceasedfirstname,'') when '' then malefirstname else isnull(deceasedfirstname,'') end as malefirstname  from tbl_remembrance where onlinestatus = 'Y'";
            if (country!="" && country!= null )
            {
                Query = Query + " and country = '" + country + "'";
            }
            if (region != "" && region != null)
            {
                Query = Query + " and regionCounty = '" + region + "'";
            }
            if (city != "" && region != null)
            {
                Query = Query + " and townCity = '" + city + "'";
            }

            if (name != "" && name != null)
            {
                try
                {
                    Query = Query + " and name1 like '%" + name.Replace("'", "''") + "%'";
                }
                catch (Exception ex)
                {
                    
                   
                }
                
            }

            if (surname != "" && surname != null)
            {
                try
                {
                    Query = Query + " and Surname1 like '%" + surname.Replace("'", "''") + "%'";
                }
                catch (Exception ex)
                {
                    

                }
              
            }

            if (maidenname != "" &&  maidenname !=null)
            {
                try
                {
                    Query = Query + " and middlename like '%" + maidenname.Replace("'", "''") + "%'";
                }
                catch (Exception)
                {
                    
                   
                }
                
            }


            if (femalename != "" && femalename != null)
            {
                try
                {
                    Query = Query + " and name2 like '%" + femalename.Replace("'", "''") + "%'";
                }
                catch (Exception ex)
                {
                    
                   
                }
               
            }
            if (id != "" && id !=null)
            {
                try
                {
                    Query = Query + " and rid like '%" + id.Replace("'", "''") + "%'";
                }
                catch (Exception ex)
                {
                    
                   
                }
               
            }

            Query = Query + " order by Surname1";


            DAL.general gn = new DAL.general();
            DataSet ds = gn.getdataset(Query);
            Repeater1.DataSource = ds;
            Repeater1.DataBind();
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            string mailContent = "<table align='center' cellpadding='2' cellspacing='1' bgcolor='#adadad' width='60%'>" +
                         "<tr><td bgcolor='#dcdcdc' colspan='2' align='cener'> Contact us Inquiry Through www.bmdnotices.com</td></tr>" +
                         "<tr bgcolor='#ffffff'><td>Name</td><td>" + txtname.Text + " " + TxtSurname.Text + "</td></tr>" +
                         "<tr bgcolor='#ffffff'><td>Region / County</td><td>" + drlistRegionCounty.SelectedValue.ToString().Trim() + "</td></tr>" +
                         "<tr bgcolor='#ffffff'><td>City / Town</td><td>" + txtcitytown.Text + "</td></tr>" +
                         "<tr bgcolor='#ffffff'><td>Phone</td><td>" + txtPhone.Text + "</td></tr>" +
                         "<tr bgcolor='#ffffff'><td>Email</td><td>" + txtEmail.Text + "</td></tr>" +
                         "<tr bgcolor='#ffffff'><td>Inquiry</td><td>" + txtInquiry.Text + "</td></tr>";


            DAL.general objGen = new DAL.general();
            int f = objGen.Send_Mail("*****@*****.**", "Enquiry through bmdnotices.com", mailContent, "");
            if(f==1)
            {
                Response.Redirect("thankyou.aspx?mess=1");
            }
        }