示例#1
0
        public int Insert(dtoSetDetail dtoSetDetail)
        {
            int count = 0;

            try
            {
                string       sql             = "INSERT [dbo].[SetDetail] ([FilmID], [SetID], [RoomID], [TotalSeats], [TotalEmptySeats], [ShowingDate]) VALUES (@FilmID, @SetID, @RoomID, @TotalSeats, @TotalEmptySeats, @ShowingDate)";
                SqlParameter parameterFilmID = new SqlParameter("@FilmID", SqlDbType.Int);
                parameterFilmID.Value = dtoSetDetail.FilmID;
                SqlParameter parameterSetID = new SqlParameter("@SetID", SqlDbType.Int);
                parameterSetID.Value = dtoSetDetail.SetID;
                SqlParameter parameterRoomID = new SqlParameter("@RoomID", SqlDbType.Int);
                parameterRoomID.Value = dtoSetDetail.RoomID;
                SqlParameter parameterTotalSeats = new SqlParameter("@TotalSeats", SqlDbType.Int);
                parameterTotalSeats.Value = dtoSetDetail.TotalSeats;
                SqlParameter parameterTotalEmptySeats = new SqlParameter("@TotalEmptySeats", SqlDbType.Int);
                parameterTotalEmptySeats.Value = dtoSetDetail.TotalEmptySeats;
                SqlParameter parameterShowingDate = new SqlParameter("@ShowingDate", SqlDbType.DateTime);
                parameterShowingDate.Value = dtoSetDetail.ShowingDate;
                count = InsertUpdateDeleteData(sql, new[] { parameterFilmID, parameterSetID, parameterRoomID, parameterTotalSeats, parameterTotalEmptySeats, parameterShowingDate });
            }
            finally
            {
                CloseConnection();
            }
            return(count);
        }
示例#2
0
        public int Insert(dtoSetDetail dtoSetDetail)
        {
            dalSetDetail dal   = new dalSetDetail();
            int          count = dal.Insert(dtoSetDetail);

            return(count);
        }
示例#3
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtFilmID.Text == "" || txtRoomID.Text == "" || txtSetID.Text == "" || txtTotalSeats.Text == "" || dteShowingDate.Text == "")
         {
             throw new Exception("Vui lòng nhập đầy đủ thông tin!");
         }
         else
         {
             dtoSetDetail dtoSet = new dtoSetDetail();
             dtoSet.FilmID          = Convert.ToInt32(txtFilmID.Text);
             dtoSet.SetID           = Convert.ToInt32(txtSetID.Text);
             dtoSet.RoomID          = Convert.ToInt32(txtRoomID.Text);
             dtoSet.ShowingDate     = dteShowingDate.DateTime;
             dtoSet.TotalEmptySeats = Convert.ToInt32(txtTotalSeats.Text);
             dtoSet.TotalSeats      = 0;
             int count = balSetDetail.Insert(dtoSet);
             txtFilmID.Text      = "";
             txtSetID.Text       = "";
             txtRoomID.Text      = "";
             txtTotalSeats.Text  = "";
             dteShowingDate.Text = "";
             BindingData();
             string mess = "Thông tin xuất chiếu đã được thêm thành công!" + "\nSố hàng đã được thêm: " + count.ToString();
             XtraMessageBox.Show(mess, "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
示例#4
0
        public List <dtoSetDetail> GetSetDetails()
        {
            dalSetDetail        dalSetDetail = new dalSetDetail();
            List <dtoSetDetail> listEmp      = new List <dtoSetDetail>();
            DataTable           SetDetails   = dalSetDetail.GetSetDetails();

            for (int i = 0; i < SetDetails.Rows.Count; i++)
            {
                dtoSetDetail SetDetail = new dtoSetDetail();
                DataRow      row       = SetDetails.Rows[i];
                SetDetail.FilmID          = Convert.ToInt32(row[0]);
                SetDetail.SetID           = Convert.ToInt32(row[1]);
                SetDetail.TotalSeats      = Convert.ToInt32(row[2]);
                SetDetail.TotalEmptySeats = Convert.ToInt32(row[3]);
                SetDetail.ShowingDate     = Convert.ToDateTime(row[4]);
                SetDetail.RoomID          = Convert.ToInt32(row[5]);
                listEmp.Add(SetDetail);
            }
            return(listEmp);
        }