Example #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            SessionTitle.Text = _session.Title;
            SpeakerName.SetTitle(_session.Speaker.Name, UIControlState.Normal);
            SessionTime.Text = string.Format("{0} - {1}",
                                             _session.Starts.ToLocalTime().ToShortTimeString(),
                                             _session.Ends.ToLocalTime().ToShortTimeString());
            SessionRoom.SetTitle("Room: " + _session.Room, UIControlState.Normal);
            SessionAbstract.Text = _session.Abstract;

            if (!string.IsNullOrEmpty(_session.Speaker.Name))
            {
                SpeakerName.TouchUpInside += delegate
                {
                    NavigationController.PushViewController(
                        new SpeakerViewController(_session.Speaker), true);
                };
            }

            SessionRoom.TouchUpInside += delegate
            {
                NavigationController.PushViewController(
                    new RoomViewController(_session.RoomKey), true);
            };
        }
Example #2
0
        public bool addSessionRoom(SessionRoom room)
        {
            Boolean         result           = false;
            string          connectionString = @"Server=us-cdbr-east-03.cleardb.com;Database=heroku_e9719c4a59b4c8f;Uid=b9ff0a805dbcc5;Pwd=25d16e4a;";
            MySqlConnection conn             = new MySqlConnection(connectionString);

            try
            {
                string query = "UPDATE sessions SET  room = @room WHERE id = @session_id";

                conn.Open();
                MySqlCommand cmd = new MySqlCommand(query, conn);

                cmd.Parameters.AddWithValue("@room", room.Room);
                cmd.Parameters.AddWithValue("@session_id", room.Session_id);

                cmd.Prepare();

                if (cmd.ExecuteNonQuery() == 1)
                {
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                conn.Close();
            }

            return(result);
        }
Example #3
0
        public void Valid_SessionRoom_Create()
        {
            //Arrange
            SessionRoom newSessionRoom = new SessionRoom()
            {
                Name = "test1"
            };

            //convert with automapper
            var newSessionRoomViewModel = Mapper.Map <SessionRoom, SessionRoomViewModel>(newSessionRoom);

            //Act
            var result = (RedirectToRouteResult)objController.Create(newSessionRoomViewModel);


            //convert with automapper
            newSessionRoom = Mapper.Map <SessionRoomViewModel, SessionRoom>(newSessionRoomViewModel);


            //Assert
            _sessionRoomServiceMock.Verify(m => m.Create(newSessionRoom), Times.Never);
            Assert.AreEqual("Index", result.RouteValues["action"]);
        }
        public void CanAddSessionRoom()
        {
            //Arrange
            int         id  = 1;
            SessionRoom emp = new SessionRoom()
            {
                Name = "Room A1"
            };

            _mockRepository.Setup(m => m.Add(emp)).Returns((SessionRoom e) =>
            {
                e.Id = id;
                return(e);
            });


            //Act
            _service.Create(emp);

            //Assert
            Assert.AreEqual(id, emp.Id);
            _mockUnitWork.Verify(m => m.Commit(), Times.Once);
        }
Example #5
0
        public bool addSessionRoom(SessionRoom room)
        {
            Boolean          result = false;
            SQLiteConnection conn   = new SQLiteConnection("Data Source=database.db;Version=3;");

            try
            {
                string query = "UPDATE sessions SET  room = @room WHERE id = @session_id";

                conn.Open();
                SQLiteCommand cmd = new SQLiteCommand(query, conn);

                cmd.Parameters.AddWithValue("@room", room.Room);
                cmd.Parameters.AddWithValue("@session_id", room.Session_id);

                cmd.Prepare();

                if (cmd.ExecuteNonQuery() == 1)
                {
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            finally
            {
                conn.Close();
            }

            return(result);
        }
Example #6
0
 public bool updateSession(int id, SessionRoom room)
 {
     throw new NotImplementedException();
 }