public static void CreateAddAndDelete()
        {
            OAuthTokens tokens = Configuration.GetTokens();

            string      testListIgnore = "test-list-ignore";
            TwitterUser myUser         = TwitterAccount.VerifyCredentials(tokens).ResponseObject;
            var         userIdToAdd    = TwitterUser.Show(tokens, userName).ResponseObject.Id;

            var listResponse = TwitterList.Show(tokens, testListIgnore);

            if (listResponse.Result == RequestResult.FileNotFound)
            {
                // Create the new list
                listResponse = TwitterList.New(tokens, myUser.ScreenName, testListIgnore, false, "Testing Twitterizer");
                Assert.That(listResponse.Result == RequestResult.Success);
            }

            // Add a user
            var addMemberResponse = TwitterList.AddMember(tokens, myUser.ScreenName, testListIgnore, userIdToAdd);

            Assert.That(addMemberResponse.Result == RequestResult.Success);

            // Remove the user
            var removeMemberResponse = TwitterList.RemoveMember(tokens, myUser.ScreenName, testListIgnore, userIdToAdd);

            Assert.That(removeMemberResponse.Result == RequestResult.Success);

            // Delete the list
            listResponse = TwitterList.Delete(tokens, myUser.ScreenName, testListIgnore, null);
            Assert.That(listResponse.Result == RequestResult.Success);
        }
        internal static CommandResult ShowRateLimitDetails()
        {
            if (!IsInitiated)
            {
                return(CommandResult.NotInitiated);
            }

            var v = new VerifyCredentialsOptions();

            v.UseSSL = true;

            var Response = TwitterAccount.VerifyCredentials(Tokens, v);

            if (Response.Result == RequestResult.Success)
            {
                TwitterUser  acc    = Response.ResponseObject;
                RateLimiting status = Response.RateLimiting;

                Form.AppendLineToOutput("Screenname     : " + acc.ScreenName);
                Form.AppendLineToOutput("Hourly limit   : " + status.Total);
                Form.AppendLineToOutput("Remaining hits : " + status.Remaining);
                Form.AppendLineToOutput("Reset time     : " + status.ResetDate.ToLocalTime() + " (" + DateTime.Now.ToUniversalTime().Subtract(status.ResetDate).Duration().TotalMinutes + " mins left)");

                return(CommandResult.Success);
            }
            else
            {
                HandleTwitterizerError <TwitterUser>(Response);
                return(CommandResult.Failure);
            }
        }
Esempio n. 3
0
    protected void VerifyButton_Click(object sender, EventArgs e)
    {
        ResultLabel.Visible = true;

        OAuthTokens tokens = new OAuthTokens()
        {
            AccessToken       = AKTextBox.Text,
            AccessTokenSecret = ASTextBox.Text,
            ConsumerKey       = CKTextBox.Text,
            ConsumerSecret    = CSTextBox.Text
        };

        TwitterResponse <TwitterUser> twitterResponse = TwitterAccount.VerifyCredentials(tokens);

        if (twitterResponse.Result == RequestResult.Success)
        {
            ResultLabel.Text     = string.Format("Success! Verified as {0}", twitterResponse.ResponseObject.ScreenName);
            ResultLabel.CssClass = "ResultLabelSuccess";
        }
        else
        {
            ResultLabel.Text     = string.Format("Failed! \"{0}\"", twitterResponse.ErrorMessage ?? "Not Authorized.");
            ResultLabel.CssClass = "ResultLabelFailed";
        }
    }
Esempio n. 4
0
        public LoginProfile ProcessAuthoriztion(HttpContext context, IDictionary <string, string> @params)
        {
            if (!string.IsNullOrEmpty(context.Request["denied"]))
            {
                return(LoginProfile.FromError(new Exception("Canceled at provider")));
            }

            if (string.IsNullOrEmpty(context.Request["oauth_token"]))
            {
                var reqToken = OAuthUtility.GetRequestToken(TwitterKey, TwitterSecret, context.Request.GetUrlRewriter().AbsoluteUri);
                var url      = OAuthUtility.BuildAuthorizationUri(reqToken.Token).ToString();
                context.Response.Redirect(url, true);
                return(null);
            }

            var requestToken = context.Request["oauth_token"];
            var pin          = context.Request["oauth_verifier"];

            var tokens = OAuthUtility.GetAccessToken(TwitterKey, TwitterSecret, requestToken, pin);

            var accesstoken = new OAuthTokens
            {
                AccessToken       = tokens.Token,
                AccessTokenSecret = tokens.TokenSecret,
                ConsumerKey       = TwitterKey,
                ConsumerSecret    = TwitterSecret
            };

            var account = TwitterAccount.VerifyCredentials(accesstoken).ResponseObject;

            return(ProfileFromTwitter(account));
        }
Esempio n. 5
0
        private void button2_Click(object sender, EventArgs e)
        {
            string             pin = textBox_PIN.Text;
            OAuthTokenResponse res = OAuthUtility.GetAccessToken(
                ConsumerKey, ConsumerSecret, oatr.Token, pin);
            string AccessToken       = res.Token;
            string AccessTokenSecret = res.TokenSecret;

            textBox_Output.Text += "Accesss Token: " + AccessToken + " Have gotten\r\n";
            textBox_Output.Text += "Accesss Token Secret: " + AccessTokenSecret + " Have gotten\r\n";
            result = new ExtendedOAuthTokens().Create(AccessToken, AccessTokenSecret, "");
            bool error    = false;
            int  trycount = 0;

            do
            {
                try
                {
                    var a = TwitterAccount.VerifyCredentials(result.OAuthTokens).ResponseObject.ScreenName;
                    result.UserName = a;
                    error           = false;
                }
                catch { error = true; }
                finally
                {
                    trycount++;
                }
            }while(error && trycount < 5);
            if (error)
            {
                MessageBox.Show("Failed to get your account data.please try later.");
                this.Close();
            }
            button3.Enabled = true;
        }
Esempio n. 6
0
        public ColumnData ToColumnData()
        {
            var _Track  = String.Join(",", ts.StreamOptions.Track);
            var _Follow = String.Join(",", ts.StreamOptions.Follow);

            if (back == null)
            {
                return(new ColumnData()
                {
                    AccountName = TwitterAccount.VerifyCredentials(ts.Tokens).ResponseObject.ScreenName, Tille = this.Text, Track = _Track, Follow = _Follow, ColumnType = st, Image = "null"
                });
            }
            else
            {
                var save = Application.StartupPath + "/Settings/" + this.Text[0] + ".bmp";
                //try
                {
                    using (var str = new FileStream(save, FileMode.OpenOrCreate, FileAccess.Write))
                    {
                        back.Save(str, ImageFormat.Png);
                    }
                }
                //catch { } // 握りつぶす
                return(new ColumnData()
                {
                    AccountName = TwitterAccount.VerifyCredentials(ts.Tokens).ResponseObject.ScreenName, Tille = this.Text, Track = _Track, Follow = _Follow, ColumnType = st, Image = "Settings/" + this.Text[0] + ".bmp"
                });
            }
        }
Esempio n. 7
0
        public void VerifyCredentials()
        {
            OAuthTokens tokens = Configuration.GetTokens();

            var response = TwitterAccount.VerifyCredentials(tokens, new VerifyCredentialsOptions
            {
                IncludeEntities = true
            });

            Assert.IsNotNull(response, "response is null");
            Assert.IsTrue(response.Result == RequestResult.Success, response.ErrorMessage);
            Assert.IsNotNull(response.ResponseObject, response.ErrorMessage);
        }
Esempio n. 8
0
        public static void VerifyCredentials()
        {
            OAuthTokens tokens = Configuration.GetTokens();

            var response = TwitterAccount.VerifyCredentials(tokens, new VerifyCredentialsOptions
            {
                IncludeEntities = true
            });

            Assert.IsNotNull(response);
            Assert.That(response.Result == RequestResult.Success);
            Assert.IsNotNull(response.ResponseObject);
        }
Esempio n. 9
0
        public static void TwitteStatus(String message)
        {
            OAuthTokens         tokens  = Configuration.GetTokens();
            StatusUpdateOptions options = new StatusUpdateOptions();

            var response = TwitterAccount.VerifyCredentials(tokens, new VerifyCredentialsOptions
            {
                IncludeEntities = true,
                UseSSL          = true
            });



            TwitterStatus newStatus = TwitterStatus.Update(tokens, message, options).ResponseObject;
        }
Esempio n. 10
0
        /// <summary>
        /// Determines whether [is token valid] [the specified consumer app ident].
        /// </summary>
        /// <param name="token">The token.</param>
        /// <returns>
        ///     <c>true</c> if [is token valid] [the specified consumer app ident]; otherwise, <c>false</c>.
        /// </returns>
        public bool IsTokenValid(OAuthToken token)
        {
            try
            {
                var verify = TwitterAccount.VerifyCredentials(
                    new OAuthTokens
                {
                    ConsumerKey       = token.ConsumerKey,
                    ConsumerSecret    = token.ConsumerSecret,
                    AccessToken       = token.Token,
                    AccessTokenSecret = token.TokenSecret
                });

                return(verify.ResponseObject != null);
            }
            catch (TwitterizerException)
            {
                return(false);
            }
            catch (ArgumentException)
            {
                return(false);
            }
        }
Esempio n. 11
0
    }//end of InitializePagingVars()
		
	protected void Page_PreRender(object sender, EventArgs e)
    {
		try
		{
			//code will load and initialize the JavaScript SDK with all standard options
			if (!Page.ClientScript.IsClientScriptBlockRegistered("facebook_api"))
               	Page.ClientScript.RegisterClientScriptInclude("facebook_api", String.Format("http://connect.facebook.net/{0}/all.js", "en_US"));
 
           	if (!Page.ClientScript.IsStartupScriptRegistered("facebook_api_init"))
				Page.ClientScript.RegisterStartupScript(typeof(string), "facebook_api_init", String.Format("FB.init({{appId: '{0}', status: true, cookie: true, xfbml: true, oauth: true }});", "574005609290762"), true);
 
           	if (!Page.ClientScript.IsStartupScriptRegistered("facebook_login"))
           	{
               	string facebookLogin = String.Format("function fblogin() {{ FB.login(function(response) {{ if (response.authResponse) {{ {0} }} else {{ {1} }}}}, {{ scope: '{2}' }});}}", this.Page.ClientScript.GetPostBackEventReference(this.Page, "FacebookLogin", false), this.Page.ClientScript.GetPostBackEventReference(this.Page, "FacebookLogout", false), "publish_stream,email");
				
               	Page.ClientScript.RegisterStartupScript(typeof(string), "facebook_login", facebookLogin, true);
           	}//end of if
 
           	if (!Page.ClientScript.IsStartupScriptRegistered("facebook_logout"))
           	{
               	string facebookLogout = String.Format("function fblogout() {{ FB.logout(function(response) {{ {0} }}); }}", this.Page.ClientScript.GetPostBackEventReference(this.Page, "FacebookLogout", false));
               	Page.ClientScript.RegisterStartupScript(typeof(string), "facebook_logout",
                  facebookLogout, true);
           	}//end of if
			
			FacebookApp facebookApp = new FacebookApp();//holds an object of the FB
				
			//checks if the user is connected to the session
			if (facebookApp.Session != null && facebookApp.AccessToken != null)
			{
				var facebookUser = facebookApp.Api("me") as JsonObject;//holds the object of the user
	
				//checks if the the user has submited a condolence		
				if(panCondoloncesThankYou.Visible == false)
					//displays the Condolace section
					panLeaveCondolence.Style.Add("display", "block");
				else
					//closes the Leave Condolence section
					panLeaveCondolence.Style.Add("display", "none");
					
				//removes the socail and user text boxes as the user is now already sign in
				//and turns on the label of the user and displays the logout button
				panCondolenceSocialOption.Visible = false;
				panConEnterNameEmail.Visible = false;
				panConNameEmail.Visible = true;
				panLogOutFB.Visible = true;
				
				//checks if there is a user name 
				if (facebookUser.ContainsKey("username") && facebookUser["username"] != null)
					lblConnectedUser.Text = facebookUser["username"].ToString();

				//checks if there is a name from FB	
				if (facebookUser.ContainsKey("name") && facebookUser["name"] != null)		
					//displays the name from FB
					lblConnectedName.Text = facebookUser["name"].ToString();
				
				//checks if there is a email from FB
				if (facebookUser.ContainsKey("email") && facebookUser["email"] != null)
					//displays the email from FB
					lblConnectedEmail.Text = facebookUser["email"].ToString();
					
				//sets the which social network the user is usiing
				hfObituaryCondolenceSocialNetwork.Value = "1";
			}//end of if
			else
			{
				//adds the Social Options and allow the user to enter their own email
				//and removes the FB Logout and email
				panCondolenceSocialOption.Visible = true;
				panConEnterNameEmail.Visible = true;
				panConNameEmail.Visible = false;
				panLogOutFB.Visible = false;
		
				//resets all of the social fields
				lblConnectedUser.Text = "";
				lblConnectedName.Text = "";
				lblConnectedEmail.Text = "";
				hfObituaryCondolenceSocialNetwork.Value = "0";
			}//end of else
			
			//checks if the user is logged into twitter
			if (Request["oauth_token"] != null)
			{
				Session["TwitterRequestToken"] = Request["oauth_token"].ToString();
                Session["TwitterPin"] = Request["oauth_verifier"].ToString();
 
                var tokens = OAuthUtility.GetAccessToken(
                    ConfigurationManager.AppSettings["consumerKey"],
                    ConfigurationManager.AppSettings["consumerSecret"],
                    Session["TwitterRequestToken"].ToString(),
                    Session["TwitterPin"].ToString());
 
                OAuthTokens oatAccess = new OAuthTokens()
					{
						AccessToken = tokens.Token,
						AccessTokenSecret = tokens.TokenSecret,
						ConsumerKey = ConfigurationManager.AppSettings["consumerKey"],
						ConsumerSecret = ConfigurationManager.AppSettings["consumerSecret"]
					};
 
 				TwitterResponse<TwitterUser> twitterResponse = TwitterAccount.VerifyCredentials(oatAccess);//holds the response that has come from twitter with if this is a good token
 
                if (twitterResponse.Result == RequestResult.Success)
				{
                   //We now have the credentials, so make a call to the Twitter API.
					HtmlMeta hmTwitter = new HtmlMeta();//holds the meta takes that will go into the header
			    	HtmlHead head = (HtmlHead)Page.Header;//holds the reference of the Header
										
					//removes the socail and user text boxes as the user is now already sign in
					//and turns on the label of the user
					panCondolenceSocialOption.Visible = false;
					panConEnterNameEmail.Visible = false;
					panConNameEmail.Visible = true;
					
					//sets the which social network the user is usiing
					hfObituaryCondolenceSocialNetwork.Value = "2";
													
					//sets the username and actully name
					lblConnectedUser.Text = twitterResponse.ResponseObject.ScreenName;
					lblConnectedName.Text = twitterResponse.ResponseObject.Name;

					//define an HTML meta twitter:creator in the header 
					hmTwitter.Name = "twitter:creator";
					hmTwitter.Content = lblConnectedUser.Text;
					hmTwitter.Controls.Add(hmTwitter);
					
					//because twitter does not allow access to the email address this should not be display
					panConnectedEmail.Visible = false;
				}//end of if
			}//end of if
				

                DataTable dtObituaryDetails = null;
                if (panSidebarLinks.Visible)
                    dtObituaryDetails = DAL.getRow("", "WHERE  = '" + General.ObituaryStatus.Published.ToString() + "' AND  = " + hfObituaryID.Value);//holds the Obituary details
                else
                    dtObituaryDetails = DAL.getRow("", "WHERE  = " + hfObituaryID.Value);//holds the Obituary details
								
				//checks if there is any details for this obituary
				if (dtObituaryDetails != null && dtObituaryDetails.Rows.Count > 0)
				{
					int intIndexServiceID = 0;//holds the unquie id of the row
					string strLastFHID = "";//holds what is the last FHID
					string strShareDescription = "";//holds the description that will share to the world
					DataTable dtImage = DAL.getRow("","Where  = " + hfObituaryID.Value + " Order by ");//holds the Images for this Obituary
					DataTable dtObitService = DAL.getRow("", "WHERE  = " + hfObituaryID.Value + " Order by , , ");//gets all services for this obituary
					DataTable dtObitFlowers = DAL.getRow("", "WHERE  = " + hfObituaryID.Value + " AND  = 1 Order by , ");//holds the Flower Recipient
					DataTable dtObitCards = DAL.queryDbTable("SELECT , ,  + ' ' +   FROM  WHERE  = " + hfObituaryID.Value + " AND  = 1");

					//checks if there is any images to display
					if(dtImage.Rows.Count > 0)
						//sets an iframe to display the image slider as the image slider uses a advance jquery
						//the DNN does not run
						litImageSlider.Text = "<iframe id='iframeImageSlider' src='/ImageSlider.aspx?=" + hfObituaryID.Value + "' scrolling='no'></iframe>";

                    //checks if this is PrePla or Memorial n if so then change the text for Leave Condolence
                    if (dtObituaryDetails.Rows[0][""].ToString() == ((int)General.ObituaryType.PrePlan).ToString() || dtObituaryDetails.Rows[0][""].ToString() == ((int)General.ObituaryType.Memorial).ToString())
                    {
                        hlLeaveCondolence.Text = "Leave a Condolence or Message";
                        lblNoOfCondolences.Text = " Condolences or Messages";
						panLeaveCondolenceTitleLeft.CssClass += " divLeaveCondolenceMmemoralTitleLeft";
                    }//end of if
					
					//checks if this user is logged in and they have not logged into a soical network
					//get there there details instead of typing it in
					if(Session[""] != null && panConNameEmail.Visible == false)
					{
						DataTable dtUserDetails = DAL.getRow("", "WHERE  = " + Session[""].ToString());//holds the this user detail that is logged in
						
						//sets the users name and email to tell the user that this is what is going to be displayed
						lblConnectedName.Text = dtUserDetails.Rows[0][""].ToString() + " " + dtUserDetails.Rows[0][""].ToString();
						lblConnectedEmail.Text = dtUserDetails.Rows[0][""].ToString();
						lblReminderEmail.Text = dtUserDetails.Rows[0][""].ToString();
																		
						//displays the user name and email to tell the user who the are login in as
						panConNameEmail.Visible = true;
						//lblReminderEmail.Visible = true;
						panConEnterNameEmail.Visible = false;
						panCondolenceSocialOption.Visible = false;                        
					}//end of if

					//sets the condolences, the number of them for this Obituary and paging
			        BindDesignsPanel();
					
					//sets the on Click for the link Leave Condolence to turn it off and on
					hlLeaveCondolence.Attributes.Add("onClick", "javascript:toggleLayer('" + panLeaveCondolence.ClientID + "', '', '');");
                    hlSectionCondolence.Attributes.Add("onClick", "javascript:toggleLayer('" + panLeaveCondolence.ClientID + "', '', '');" + panLeaveCondolence.ClientID + ".scrollIntoView(true);");
					
					//sets the basis settings
					lblName.Text = dtObituaryDetails.Rows[0][""].ToString() + ", "  + dtObituaryDetails.Rows[0][""].ToString() + " " + dtObituaryDetails.Rows[0][""].ToString();
					lblPrintName.Text = dtObituaryDetails.Rows[0][""].ToString() + ", "  + dtObituaryDetails.Rows[0][""].ToString() + " " + dtObituaryDetails.Rows[0][""].ToString();
					
					//sets the sidebar name of the user
                    lblShareForName.Text = dtObituaryDetails.Rows[0][""].ToString() + " " + dtObituaryDetails.Rows[0][""].ToString();
					lblReminderForName.Text = dtObituaryDetails.Rows[0][""].ToString() + " " + dtObituaryDetails.Rows[0][""].ToString();
					lblReminderForName2.Text = dtObituaryDetails.Rows[0][""].ToString() + " " + dtObituaryDetails.Rows[0][""].ToString();
					
					//sets the title of the page
					Page.Title = "The Obituaries - Details for " + dtObituaryDetails.Rows[0][""].ToString() + " " + dtObituaryDetails.Rows[0][""].ToString();
					
					//sets the flower FH sidebar
					panFlowersFH.Visible = Convert.ToBoolean(dtObituaryDetails.Rows[0][""].ToString());
					
					//checks if there is a FHID
                    if (Convert.ToInt32(dtObituaryDetails.Rows[0][""].ToString()) > 0)
                    {
                        //sets the FHID for this flower request
                        hlFlowerFH.NavigateUrl += dtObituaryDetails.Rows[0][""].ToString() + "&oid=" + hfObituaryID.Value;
                        chkFuneralHome.Text = " All announcements from <strong>" + DAL.queryDbScalar("SELECT  FROM  WHERE  = '" + dtObituaryDetails.Rows[0][""].ToString() + "'") + "</strong>";
                    }//end of if
                    else
                        //removes the Flowers FH is there is no FHID to use
                        panFlowersFH.Visible = chkFuneralHome.Visible = false;
					
					//sets the Anotehr Address URL for flowers and cards	
					hlSendCardsAnotherAddress.NavigateUrl = "/Obituaries/sympathycards.aspx?ObituariesID=" + hfObituaryID.Value;
					hlSendFlowersAnotherAddress.NavigateUrl = "/Obituaries/flower.aspx?person=2&FHPID=0&oid=" + hfObituaryID.Value;
					
					//checks if there is any flowsers 
					if(dtObitFlowers.Rows.Count > 0)
					{
						//sets the flowers recipient in the sidebar
						dlFlowerRecipient.DataSource = dtObitFlowers;
						dlFlowerRecipient.DataBind();
					}//end of if
					else
						//removes the 'or' flowers from view
                        panFlowersOr.Visible = false;
											
					//checks if there is any cards 
					if (dtObitCards != null && dtObitCards.Rows.Count > 0)
					{
						//sets the card recipient in the sidebar
						rpCardReceiver.DataSource = dtObitCards;
						rpCardReceiver.DataBind();
					}//end of if
					else
						//removes the 'or' card from view
						panCardOr.Visible = false;
						
					//resets lblBirthDateAndPassingDate
					lblBirthDateAndPassingDate.Text = "";
		
					//checks if there is a birth date
					if(!string.IsNullOrEmpty(dtObituaryDetails.Rows[0][""].ToString()))
						lblBirthDateAndPassingDate.Text += Convert.ToDateTime(dtObituaryDetails.Rows[0][""].ToString()).ToString("MMMM dd, yyyy");
						
					//checks that there must be both a birth\death date for - to display
					if(!string.IsNullOrEmpty(dtObituaryDetails.Rows[0][""].ToString()) && !string.IsNullOrEmpty(dtObituaryDetails.Rows[0][""].ToString())) 
						lblBirthDateAndPassingDate.Text += " - ";
						
					//checks if there is a death date or a is this a pre-plan obituarie
					if(!string.IsNullOrEmpty(dtObituaryDetails.Rows[0][""].ToString()))
						//sets the death year
						lblBirthDateAndPassingDate.Text += Convert.ToDateTime(dtObituaryDetails.Rows[0][""].ToString()).ToString("MMMM dd, yyyy");
						
					//checks if there is any text in the lblBirthDateAndPassingDate
					//in order to add it to the print version
					if(!string.IsNullOrEmpty(lblBirthDateAndPassingDate.Text))
						lblPrintBirthDateAndPassingDate.Text = lblBirthDateAndPassingDate.Text;
						
					//sets the twitter sharing for this obituery
					hlShareTwiiter.NavigateUrl = "https://twitter.com/share?url=" + Server.UrlEncode("http://theobituaries.ca/Obituaries.aspx?ObituariesID=" + hfObituaryID.Value) + "&text=Obituary for " + lblName.Text;
					
					//sets the linkin sharing for this obituery
					ltlLinkin.Text = "<script type='IN/Share' data-url='" + Server.UrlEncode("http://theobituaries.ca/Obituaries.aspx?ObituariesID=" + hfObituaryID.Value) + "'></script>";
					
					//checks if strShareDescription has any content
					if(string.IsNullOrEmpty(strShareDescription))
						//uses a default text as to not have DNN text display on the user's condolences
						strShareDescription = "A condolence for " + dtObituaryDetails.Rows[0][""].ToString() + " "  + dtObituaryDetails.Rows[0][""].ToString();
					
					//sets the Facebook sharing for this obituery
					litFB.Text = "<iframe src='http://www.facebook.com/plugins/like.php?href=http%3A%2F%2F" + Request.Url.Host + "%2FObituaries.aspx%3FObituariesID%3D" + hfObituaryID.Value + "&amp;send=false&amp;layout=button_count&amp;width=60&amp;show_faces=false&amp;font&amp;colorscheme=light&amp;action=like&amp;height=21&amp;appId=574005609290762' scrolling='no' frameborder='0' style='overflow:hidden;height:21px;' allowTransparency='true'></iframe>";
								  
					HtmlMeta hmFB = new HtmlMeta();//holds the meta takes that will go into the header
				    HtmlHead head = (HtmlHead)Page.Header;//holds the reference of the Header
					
                    lnkSendCardToFuneralHome.Visible = false;

                    if (dtObituaryDetails.Rows[0][""].ToString() == "True" && !string.IsNullOrEmpty(dtObituaryDetails.Rows[0][""].ToString()) && dtObituaryDetails.Rows[0][""].ToString() != "0")
                    {
                        lnkSendCardToFuneralHome.NavigateUrl = "/Obituaries/sympathycards.aspx?ObituariesID=" + hfObituaryID.Value + "&FuneralHomeID=" + dtObituaryDetails.Rows[0][""].ToString();
                        lnkSendCardToFuneralHome.Visible = true;
                    }//end of if

                    if (!string.IsNullOrEmpty(dtObituaryDetails.Rows[0][""].ToString()))
                        hfObituaryCreatorEmail.Value = DAL.queryDbScalar("SELECT  FROM  WHERE  = '" + dtObituaryDetails.Rows[0][""].ToString() + "'");
						
					//resets litObituaryServices
					litObituaryServices.Text = "";
							
					//checks if there is any sevices
					if(dtObitService.Rows.Count > 0)
					{
						//goes around adding the services of the Obituary
						foreach (DataRow drObitService in dtObitService.Rows)
						{
							//checks if there is a FHID or or  is the different
							//this is different from the next one as this will skip the whole row
							if(Convert.ToInt32(drObitService[""].ToString()) != 0 || Convert.ToInt32(drObitService[""].ToString()) == 0 && strLastFHID != drObitService[""].ToString())
							{ 
								//checks if the last FHID or  is the different
								if(strLastFHID != drObitService[""].ToString() || Convert.ToInt32(drObitService[""].ToString()) == 0 && strLastFHID != drObitService[""].ToString())
								{
									DataTable dtFHDetails = DAL.getRow("", "WHERE  = " + Convert.ToInt32(drObitService[""].ToString()));//holds the Funeral Home details
						
									//checks if this is a the first service
									//as there is not last service yet
									if(!string.IsNullOrEmpty(strLastFHID))			
										//create a ends the last serivce 
										litObituaryServices.Text += "</div>";
									
									//starts a new one
									litObituaryServices.Text += "<div class='customContainer divObiturayDetailsServiceContainer'>" + 
										"<div class='customLeft divObiturayDetailsServiceLeft'>";
										
											//checks if this FH is in the database and if it is a partner
											if (dtFHDetails != null && dtFHDetails.Rows.Count > 0)
											{
												string strSearchItemMap = "";//holds the map of the search itme
												
												//checks if there is a address to search for the google map
												if(!string.IsNullOrEmpty(dtFHDetails.Rows[0][""].ToString()) && !string.IsNullOrEmpty(dtFHDetails.Rows[0][""].ToString()) && !string.IsNullOrEmpty(dtFHDetails.Rows[0][""].ToString()))
												{
													//checks if there is a already a location that the user wants to use
													if(dtFHDetails.Rows[0][""] == null || string.IsNullOrEmpty(dtFHDetails.Rows[0][""].ToString().Trim()))					
														//adds the funcation that will activate the google map hidden
														strSearchItemMap = "getLocationHiddenGeo(&quot;" + dtFHDetails.Rows[0][""].ToString().Replace("'", "&lsquo;").Replace("\"", "&quot;") + "," + dtFHDetails.Rows[0][""].ToString().Replace("'", "&lsquo;").Replace("\"", "&quot;") + "," + dtFHDetails.Rows[0][""] + "&quot;,&quot;" + dtFHDetails.Rows[0][""].ToString().Replace("'", "&lsquo;").Replace("\"", "&quot;") + "&quot;,43.64100156269233,-79.38599562435303);";
													else
														//adds funcation that will activate the google map hidden what the user want to display
														strSearchItemMap = "getLocationHiddenGeo(&quot;" + dtFHDetails.Rows[0][""].ToString().Replace("'", "&lsquo;").Replace("\"", "&quot;") + "," + dtFHDetails.Rows[0][""].ToString().Replace("'", "&lsquo;").Replace("\"", "&quot;") + "," + dtFHDetails.Rows[0][""] + "&quot;,&quot;" + dtFHDetails.Rows[0][""].ToString().Replace("'", "&lsquo;").Replace("\"", "&quot;") + "&quot;," + dtFHDetails.Rows[0][""] + ");";
												}//end of if
																								
												//loads the ability to display the map
                                                if (panSidebarLinks.Visible)
                                                    litObituaryServices.Text += "<a href='javascript:void(0);' onClick='" + strSearchItemMap + "toggleLayer(&quot;divHiddenHeaderMap&quot;,&quot;divGrayBG&quot;,&quot;&quot;);getDocID(&quot;lblHiddenMapName&quot;).innerHTML=&quot;Location for " + dtFHDetails.Rows[0][""].ToString().Replace("'", "&lsquo;").Replace("\"", "&quot;") + " - " + dtFHDetails.Rows[0][""].ToString().Replace("'", "&lsquo;").Replace("\"", "&quot;") + ", " + dtFHDetails.Rows[0][""].ToString() + "&quot;;'><img alt='Map' src='/Portals/_default/skins/Obit/Images/obits-map.jpg' /></a>";
                                                else
                                                    litObituaryServices.Text += "<img alt='Map' src='/Portals/_default/skins/Obit/Images/obits-map.jpg' />";
											}//end of if
											//displays a custom FH that the user has create
											else
												litObituaryServices.Text += "<a href='javascript:void(0);' onClick='getLocationHiddenGeo(&quot;" + drObitService[""].ToString().Replace("'", "&lsquo;").Replace("\"", "&quot;") + "," + drObitService[""].ToString().Replace("'", "&lsquo;").Replace("\"", "&quot;") + "," + drObitService[""] + "&quot;,&quot;" + drObitService[""].ToString().Replace("'","&lsquo;").Replace("\"","&quot;") + "&quot;,43.64100156269233,-79.38599562435303);toggleLayer(&quot;divHiddenHeaderMap&quot;,&quot;divGrayBG&quot;,&quot;&quot;);getDocID(&quot;lblHiddenMapName&quot;).innerHTML=&quot;Location for " + drObitService[""].ToString().Replace("'","&lsquo;").Replace("\"","&quot;") + " - " + drObitService[""].ToString().Replace("'","&lsquo;").Replace("\"","&quot;") + ", " + drObitService[""].ToString() + "&quot;;'><img alt='Map' src='/Portals/_default/skins/Obit/Images/obits-map.jpg' /></a>";
												
										litObituaryServices.Text += "</div>" + 
										"<div class='customRight divObiturayDetailsServiceRight'>";
											
												//checks if this FH is in the database and if it is a partner
												if (dtFHDetails != null && dtFHDetails.Rows.Count > 0)
												{
													//checks if this is a Publish FH or non
                                                    if (dtFHDetails.Rows[0][""].ToString() == "1" && panSidebarLinks.Visible)
														litObituaryServices.Text += "<a href='/FuneralHome.aspx?FuneralHomeId=" + dtFHDetails.Rows[0][""].ToString() + "'>" + 
															dtFHDetails.Rows[0][""].ToString() + 
														"</a>";
													else
														litObituaryServices.Text += "<label class='lblObituaryFHServiceName'>" +
															dtFHDetails.Rows[0][""].ToString() + 
														"</label>";
													
													litObituaryServices.Text += "<div class='divObiturayServiceLocation'>" +
														dtFHDetails.Rows[0][""].ToString() + ", " + dtFHDetails.Rows[0][""].ToString() + ", " + dtFHDetails.Rows[0][""].ToString() + ", " + dtFHDetails.Rows[0][""].ToString() + 
													"</div>";
												}//end of if
												//displays a custom FH that the user has create
												else
												{
													//checks if there is a custom name for this custom FH
													if(!string.IsNullOrEmpty(drObitService[""].ToString()))
														litObituaryServices.Text += "<label class='lblObituaryFHServiceName'>" +
															drObitService[""].ToString() + 
														"</label>" +
														"<div class='divObiturayServiceLocation'>";
													else
														//beacuse divObiturayServiceLocation has a padding this will move
														//make the address not appeaeal with the map icon this wll fix it
														litObituaryServices.Text += "<div class='divObiturayServiceNoCustomLocationName'>";
														
													litObituaryServices.Text += drObitService[""].ToString() + ", " + drObitService[""].ToString() + ", " + drObitService[""].ToString() + ", " + drObitService[""].ToString() + 
													"</div>";
												}//end of else
												 
											//sets the link to open the location and start the service detail div
											litObituaryServices.Text += "<a href='#service-location-" + intIndexServiceID + "' class='toggle-location scroll-show'>Open Location</a>" + 
										"</div>" + 
										"<div class='customFooter divObiturayDetailsServiceFooter'></div>";
									
									//checks if this row is a FH or a custom address
									//and then updates the strLastFHID
									if(Convert.ToInt32(drObitService[""].ToString()) == 0)
										strLastFHID = drObitService[""].ToString();
									else
										strLastFHID = drObitService[""].ToString();
								}//end of if
								
								//displays the details of the service
								litObituaryServices.Text += "<div class='divObiturayServiceDateTime'>" + 
									"<div class='divObiturayServiceDate'>" + 
										"<label>" + Convert.ToDateTime(drObitService[""].ToString()).ToString("dddd, MMMM d, yyyy") + "</label>" + 
									"</div>" + 
									"<div class='divObiturayServiceTime'>" + 
										"<label><strong>"; 
				
									//checks which Obituary Service Type is this and displays it
									switch(Convert.ToInt32(drObitService[""].ToString()))
									{
										case 0:
											litObituaryServices.Text += "Visitation";
										break;
										case 1:
											litObituaryServices.Text += "Funeral Service";
										break;
										case 2:
											litObituaryServices.Text += "Graveside Service";
										break;
										case 3:
											litObituaryServices.Text += "Memorial Service";
										break;
										case 4:
											litObituaryServices.Text += "Non Commemorative Funeral";
										break;
										case 6:
											litObituaryServices.Text += "Celebration of Life";
										break;
										default:
											litObituaryServices.Text += drObitService[""].ToString();
										break;										
									}//end of switch
										
									//displays the service start time
									litObituaryServices.Text += " - " + Convert.ToDateTime(drObitService[""].ToString()).ToString("h:mm tt");
									
									//checks if there is a service end time
									if(!string.IsNullOrEmpty(drObitService[""].ToString()) && drObitService[""].ToString() != "00:00:00")
										//displays the service end time
										litObituaryServices.Text += " - " + Convert.ToDateTime(drObitService[""].ToString()).ToString("h:mm tt");
									
								//end the details of the service
								litObituaryServices.Text += "</strong></label>" + 
									"</div>" + 
								"</div>";
								
								intIndexServiceID++;
							}//end of if
						}//end of foreach
						
						//closes the last service
						litObituaryServices.Text += "</div>";
					}//end of if
					else
						//remvoes the service section from display	
						panObituaryServices.Visible = false;
				}//end of if
			//}//end of if				
		}//end of try
        catch (Exception ex)
        {
            lblMainError.Text = ex.Message;// + " " + ex.StackTrace;
            lblMainError.Visible = true;
        }//end of catch
    }//end of Page_PreRender()