ASP.NET Page /Admin/Jobs.aspx.cs (C#)
1: using System;  
2: using System.Collections.Generic;  
3: using QuizNetOnline.Logic;  
4: using Microsoft.ApplicationBlocks.Data;  
5:   
6:   
7: public partial class Jobs : System.Web.UI.Page  
8: {  
9:     protected void Page_Load(object sender, EventArgs e)  
10:     {  
11:         if (Session["Validated"] == null || (bool)Session["Validated"] == false)  
12:             Response.Redirect("Default.aspx");  
13:   
14:         //this.SqlDataSource1.ConnectionString = ConnectionObj.GetConnection().ConnectionString;  
15:   
16:     }  
17:   
18:     protected void click_cmdRaiseError(object sender, EventArgs e)  
19:     {  
20:         throw new Exception("Throw new Exception success");  
21:     }  
22:   
23:     protected void click_cmdCalcLatLong(object sender, EventArgs e)  
24:     {  
25:         QuizNetSystem quizNetSystem=new QuizNetSystem();  
26:         Topic topic=new Topic();  
27:         List<Result> results = quizNetSystem.GetAllResults(topic);  
28:   
29:         UserLocation userLocation = new UserLocation("192.168.1.10");  
30:   
31:         results.ForEach(delegate(Result result)  
32:         {  
33:             if (result.Latitude == 0)  
34:             {  
35:                 userLocation = new UserLocation(result.IpAddress.ToString());  
36:                 result.Latitude = userLocation.Latitude;  
37:                 result.Longitude = userLocation.Longitude;  
38:                 result.CountryCode = userLocation.CountryName;  
39:                 result.Location = userLocation.City + "," + userLocation.RegionName + "," + userLocation.CountryName;  
40:                 result.Save(false, userLocation,new SqlWrapper());  
41:             }  
42:         });  
43:   
44:     }  
45: }  

.NET Documentation Tool is © 2002 - 2009 Winnersh Triangle Web Solutions Limited.