コード例 #1
0
        public ActionResult AddCinemaHall(CinemaHallModel model)
        {
            _cinemaHallServices = new CinemaHallServices();
            _cinemaHallServices.InsertCinemaHall(model);

            return(RedirectToAction("ListCinemaHall"));
        }
コード例 #2
0
        public static bool AreFreePositions(int seanceID, int hallID)
        {
            int             count = cs.GetActualCinemaHallState(seanceID).Count();
            CinemaHallModel ch    = cs.GetCinemaHall(hallID);

            return(count < ch.Rows * ch.Positions);
        }
コード例 #3
0
        public CinemaHallModel GetCinemaHallById(int id)
        {
            _theaterServices = new TheaterServices();
            var model = new CinemaHallModel();

            using (SqlConnection con = new SqlConnection(connect))
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("GetCinemaHallById", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@id", id);
                _adapter = new SqlDataAdapter(cmd);
                _ds      = new DataSet();
                _adapter.Fill(_ds);
                if (_ds.Tables.Count > 0 && _ds.Tables[0].Rows.Count > 0)
                {
                    model.Id          = Convert.ToInt32(_ds.Tables[0].Rows[0]["Id"]);
                    model.Theater     = _theaterServices.GetTheaterByCinemaHall(model.Id);
                    model.Number      = Convert.ToInt32(_ds.Tables[0].Rows[0]["Number"]);
                    model.CountPlaces = Convert.ToInt32(_ds.Tables[0].Rows[0]["Count_places"]);
                    model.CountRows   = Convert.ToInt32(_ds.Tables[0].Rows[0]["Count_rows"]);
                }
            }
            return(model);
        }
コード例 #4
0
        public IList <CinemaHallModel> GetCinemaHallList()
        {
            _theaterServices = new TheaterServices();
            IList <CinemaHallModel> cinemaHallList = new List <CinemaHallModel>();

            _ds = new DataSet();

            using (SqlConnection con = new SqlConnection(connect))
            {
                con.Open();
                SqlCommand cmd = new SqlCommand("GetAllCinemaHall", con);
                cmd.CommandType = CommandType.StoredProcedure;
                _adapter        = new SqlDataAdapter(cmd);
                _adapter.Fill(_ds);
                if (_ds.Tables.Count > 0)
                {
                    for (int i = 0; i < _ds.Tables[0].Rows.Count; i++)
                    {
                        CinemaHallModel obj = new CinemaHallModel();
                        obj.Id          = Convert.ToInt32(_ds.Tables[0].Rows[i]["Id"]);
                        obj.Theater     = _theaterServices.GetTheaterByCinemaHall(obj.Id);
                        obj.Number      = Convert.ToInt32(_ds.Tables[0].Rows[i]["Number"]);
                        obj.CountPlaces = Convert.ToInt32(_ds.Tables[0].Rows[i]["Count_places"]);
                        obj.CountRows   = Convert.ToInt32(_ds.Tables[0].Rows[i]["Count_rows"]);
                        cinemaHallList.Add(obj);
                    }
                }
            }

            return(cinemaHallList);
        }
コード例 #5
0
 public void InsertCinemaHall(CinemaHallModel model)
 {
     using (SqlConnection con = new SqlConnection(connect))
     {
         con.Open();
         SqlCommand cmd = new SqlCommand("AddCinemaHall", con);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@id_movie_theater", model.Theater.Id);
         cmd.Parameters.AddWithValue("@number", model.Number);
         cmd.Parameters.AddWithValue("@count_places", model.CountPlaces);
         cmd.Parameters.AddWithValue("@count_rows", model.CountRows);
         cmd.ExecuteNonQuery();
     }
 }
コード例 #6
0
        public AktualizujRezerwacje(ReservationPositionData pos) : this()
        {
            this.pos = pos;
            using (ClientServiceClient cs = new ClientServiceClient())
            {
                CinemaHallModel temp = cs.GetCinemaHall(pos.HallID);
                for (int i = 0; i < temp.Rows; i++)
                {
                    rzedy.Add(i);
                }
                for (int i = 0; i < temp.Positions; i++)
                {
                    miejsca.Add(i);
                }

                RowComboBox.ItemsSource       = rzedy;
                PositionComboBox.ItemsSource  = miejsca;
                RowComboBox.SelectedItem      = pos.Row;
                PositionComboBox.SelectedItem = pos.Position;
            }
        }
コード例 #7
0
 public ActionResult EditCinemaHall(CinemaHallModel model)
 {
     _cinemaHallServices = new CinemaHallServices();
     _cinemaHallServices.UpdateCinemaHall(model);
     return(RedirectToAction("ListCinemaHall"));
 }