コード例 #1
0
		// This method is invoked when the application has loaded its UI and its ready to run
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{

		dataSource = new EmployeeDataSource(this);
		@delegate = new EmployeeListDelegate(this);
		tableviewEmployee.DataSource = dataSource;
		tableviewEmployee.Delegate = @delegate;
		alertDelegate = new CallAlert (this);

			//System.MissingMethodException: Method not found: 'Default constructor not found...ctor() of CorporateDirectory1.Employee'.
			var e = new Employee();
			e.Firstname = "a"; e.Work=1; e.Mobile=2; e.Lastname="b";e.Department="c";e.Email="@";
			var f = e.Firstname; var g = e.Work; var h=e.Mobile; var i=e.Lastname; var j=e.Department; var k=e.Email;
			
			using (var db = new SQLiteClient.SQLiteConnection("phonebook")) {
				// Perform strongly typed queries
			    var users = db.Query<Employee>("SELECT Firstname, Lastname, Work, Mobile, Department, Email FROM Phonebook ORDER BY Lastname", 1000);
			    
				listData = users.ToList();
			}
			
			
			window.MakeKeyAndVisible ();
			return true;
		}
コード例 #2
0
ファイル: Main.cs プロジェクト: conceptdev/Corp411
        // This method is invoked when the application has loaded its UI and its ready to run
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            tableviewEmployee.DataSource = new EmployeeDataSource(this);
            tableviewEmployee.Delegate = new EmployeeListDelegate(this);

            #if ORM
            using (var db = new SQLiteClient.SQLiteConnection("phonebook")) {
                db.Open();

                // Perform strongly typed queries
                var users = db.Query<Employee>("SELECT Firstname, Lastname, Work, Mobile, Department, Email FROM Phonebook ORDER BY Lastname", 1000);

                listData = users.ToList();
            }
            #else
            listData = new List<Employee>();
            // System.Data test code from http://monotouch.net/Documentation/System.Data
            var sd = new SystemDataHelper("phonebook");
            var connection = sd.GetConnection();
            using (var cmd = connection.CreateCommand())
            {
                connection.Open ();
                cmd.CommandText = "SELECT Firstname, Lastname, Work, Mobile, Department, Email " +
                    "FROM Phonebook ORDER BY Lastname";

                using (var reader = cmd.ExecuteReader ())
                {
                        while (reader.Read ())
                    {
                        var emp = new Employee();
                        emp.Firstname = (string)reader["Firstname"];
                        emp.Lastname = (string)reader["Lastname"];
                        emp.Work = (string)reader["Work"];
                        emp.Mobile = (string)reader["Mobile"];
                        emp.Department = (string)reader["Department"];
                        emp.Email = (string)reader["Email"];
                        Console.WriteLine("Column {0}",reader["Lastname"]);
                        listData.Add(emp);
                    }
                }
            }
            #endif
            window.MakeKeyAndVisible ();
            return true;
        }