/// <summary>
 /// 添加放映厅
 /// </summary>
 /// <param name="cvh"></param>
 /// <returns></returns>
 public bool AddVideoHall(CommonVideoHall cvh)
 {
     if (videoHall.AddVideoHall(cvh) > 0)
     {
         return true;
     }
     return false;
 }
        /// <summary>
        /// 添加放映厅
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Add_Click(object sender, EventArgs e)
        {
            if (btn_Add.Text.Contains("要"))
            {
                CleanTxtControl();
                btn_Cancel.Visible = true;
                btn_Modify.Enabled = false;
                btn_Delete.Enabled = false;
                lbl_ImportExport.Enabled = false;
                txt_VideoHallId.Enabled = true;
                txt_Seatings.Enabled = true;
                txt_Row.Enabled = true;
                txt_Col.Enabled = true;
                btn_Add.Text = "保存添加";
                return;
            }
            CommonVideoHall cvh = new CommonVideoHall();
            cvh.VideoHallId = 0;
            try
            {
                cvh.VideoHallId = Convert.ToInt32(txt_VideoHallId.Text);
            }
            catch
            {
                MessageBox.Show("请输入正确的放映厅ID");
                return;
            }
            cvh.Seatings = Convert.ToInt32(txt_Seatings.Text);
            cvh.RowSeatNum = Convert.ToInt32(txt_Row.Text);
            cvh.ColumnSeatNum = Convert.ToInt32(txt_Col.Text);

            if (videoHall.AddVideoHall(cvh))
            {
                GetVideoHall();
                MessageBox.Show("添加成功");
            }
            else
            {
                MessageBox.Show("添加失败");
            }
            GetVideoHall();
            btn_Cancel.Visible = false;
            btn_Add.Text = "要添加";
            btn_Cancel_Click(sender, e);
        }
 /// <summary>
 /// 获取放映厅的信息
 /// </summary>
 /// <returns></returns>
 public List<CommonVideoHall> GetVideoHallMsg()
 {
     SqlDataReader sdr = videoHall.GetVideoHallMsg();
     List<CommonVideoHall> list = new List<CommonVideoHall>();
     if (sdr != null)
     {
         while (sdr.Read())
         {
             CommonVideoHall v = new CommonVideoHall();
             v.VideoHallId = (int)sdr[0];//Id
             v.RowSeatNum = (int)sdr[2];
             v.ColumnSeatNum = (int)sdr[3];
             list.Add(v);
         }
         sdr.Close();
     }
     return list;
 }
 /// <summary>
 /// 添加放映厅
 /// </summary>
 /// <param name="cvh"></param>
 /// <returns></returns>
 public int AddVideoHall(CommonVideoHall cvh)
 {
     if (IsReapt(cvh.VideoHallId))
     {
         return 0;
     }
     string sql = " insert into VideoHall(VideoHallId,Seatings,RowSeatNum,ColumnSeatNum) " +
         " values(@VideoHallId,@Seatings,@RowSeatNum,@ColumnSeatNum) ";
     SqlParameter[] paras = {
                                new SqlParameter("@VideoHallId",SqlDbType.Int,4),
                                new SqlParameter("@Seatings",SqlDbType.Int,4),
                                new SqlParameter("@RowSeatNum",SqlDbType.Int,4),
                                new SqlParameter("@ColumnSeatNum",SqlDbType.Int,4)
                            };
     paras[0].Value = cvh.VideoHallId;
     paras[1].Value = cvh.Seatings;
     paras[2].Value = cvh.RowSeatNum;
     paras[3].Value = cvh.ColumnSeatNum;
     return SQLHelper.ExecuteNonQuery(sql, paras);
 }
 /// <summary>
 /// 修改放映厅信息
 /// </summary>
 /// <param name="cvh"></param>
 /// <returns></returns>
 public int ModifyVideoHall(int oldHallId, CommonVideoHall cvh)
 {
     if (oldHallId != cvh.VideoHallId)
     {
         if (IsReapt(cvh.VideoHallId))
         {
             return 0;
         }
     }
     string sql = " update VideoHall " +
         " set VideoHallId=@VideoHallId,Seatings=@Seatings, " +
         " RowSeatNum=@RowSeatNum,ColumnSeatNum=@ColumnSeatNum " +
         " where VideoHallId=@oldHallId ";
     SqlParameter[] paras = {
                                new SqlParameter("@VideoHallId",SqlDbType.Int,4),
                                new SqlParameter("@Seatings",SqlDbType.Int,4),
                                new SqlParameter("@RowSeatNum",SqlDbType.Int,4),
                                new SqlParameter("@ColumnSeatNum",SqlDbType.Int,4),
                                new SqlParameter("@oldHallId",SqlDbType.Int,4)
                            };
     paras[0].Value = cvh.VideoHallId;
     paras[1].Value = cvh.Seatings;
     paras[2].Value = cvh.RowSeatNum;
     paras[3].Value = cvh.ColumnSeatNum;
     paras[4].Value = oldHallId;
     return SQLHelper.ExecuteNonQuery(sql, paras);
 }
 /// <summary>
 /// 修改放映厅信息
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btn_Modify_Click(object sender, EventArgs e)
 {
     try
     {
         oldHallId = Convert.ToInt32(lbl_OldHallId.Text);
     }
     catch { return; }
     if (videoHall.IsVideoHallUsing(oldHallId))
     {
         MessageBox.Show("放映厅在使用,无法修改");
         return;
     }
     if (btn_Modify.Text.Contains("要"))
     {
         btn_Cancel.Visible = true;
         btn_Add.Enabled = false;
         btn_Delete.Enabled = false;
         lbl_ImportExport.Enabled = false;
         txt_VideoHallId.Enabled = true;
         txt_Seatings.Enabled = true;
         txt_Row.Enabled = true;
         txt_Col.Enabled = true;
         btn_Modify.Text = "保存修改";
         return;
     }
     CommonVideoHall cvh = new CommonVideoHall();
     cvh.VideoHallId = Convert.ToInt32(txt_VideoHallId.Text);
     cvh.Seatings = Convert.ToInt32(txt_Seatings.Text);
     cvh.RowSeatNum = Convert.ToInt32(txt_Row.Text);
     cvh.ColumnSeatNum = Convert.ToInt32(txt_Col.Text);
     if (videoHall.ModifyVideoHall(oldHallId, cvh))
     {
         MessageBox.Show("修改成功");
     }
     else
     {
         MessageBox.Show("修改失败");
     }
     btn_Modify.Text = "要修改";
     btn_Cancel.Visible = false;
     GetVideoHall();
     btn_Cancel_Click(sender, e);
 }
 /// <summary>
 /// 获取放映厅号
 /// </summary>
 /// <returns></returns>
 public List<CommonVideoHall> GetVideoHallNO()
 {
     SqlDataReader sdr = videoHall.GetVideoHallNO();
     List<CommonVideoHall> list = new List<CommonVideoHall>();
     if (sdr != null)
     {
         while (sdr.Read())
         {
             CommonVideoHall v = new CommonVideoHall();
             v.VideoHallId = (int)sdr[0];//Id
             list.Add(v);
         }
         sdr.Close();
     }
     return list;
 }
 /// <summary>
 /// 修改放映厅信息
 /// </summary>
 /// <param name="cvh"></param>
 /// <returns></returns>
 public bool ModifyVideoHall(int oldHallId, CommonVideoHall cvh)
 {
     if (videoHall.ModifyVideoHall(oldHallId, cvh) > 0)
     {
         return true;
     }
     return false;
 }