Exemplo n.º 1
0
        private void ModefyButton_Click(object sender, EventArgs e)  //选择该行,才能修改,然后 panel3.show();
        {
            try
            {
                f_id     = (int)dataGridView1.CurrentRow.Cells[0].Value;
                datetime = (DateTime)dataGridView1.CurrentRow.Cells[2].Value;
                time     = (String)dataGridView1.CurrentRow.Cells[3].Value;
                switch ((String)dataGridView1.CurrentRow.Cells[4].Value)
                {
                case "1号影厅": h_id = "001"; break;

                case "2号影厅": h_id = "002"; break;

                case "3号影厅": h_id = "003"; break;
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("请选择有效数据行!");
                return;
            }


            Schedule_id       = dealschedule.Getfilm_scheduleid(f_id, datetime, time, h_id); //读取排期原来值显示在修改panel中
            model             = dealschedule.GetModel1(Schedule_id);
            comboBox3.Text    = model.H_id;
            DatePicker2.Value = model.Date;
            string[] time1 = model.Time.Split(':');
            comboBox6.Text = time1[0];
            comboBox7.Text = time1[1];
            panel3.Show();
        }
Exemplo n.º 2
0
        //增加电影场次,返回schedule_id
        public int Addfilm_schedule2(Model.film_schedule model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(" insert into film_schedule(");
            strSql.Append(" F_id,Date,Time,H_id)");
            strSql.Append(" values (");
            strSql.Append(" @F_id,@Date,@Time,@H_id); select @Schedule_id=@@IDENTITY; ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@F_id",        SqlDbType.Int),
                new SqlParameter("@Date",        SqlDbType.Date),
                new SqlParameter("@Time",        SqlDbType.VarChar, 20),
                new SqlParameter("@H_id",        SqlDbType.VarChar, 20),
                new SqlParameter("@Schedule_id", SqlDbType.Int)
            };

            parameters[0].Value     = model.F_id;
            parameters[1].Value     = model.Date;
            parameters[2].Value     = model.Time;
            parameters[3].Value     = model.H_id;
            parameters[4].Direction = ParameterDirection.Output;


            int rows = Convert.ToInt32(SqlDbHelper.ExecuteNonQuery(strSql.ToString(), CommandType.Text, parameters));

            return(Convert.ToInt32(parameters[4].Value));
        }
Exemplo n.º 3
0
        //根据电影场次号Schedule_id查询电影场次信息
        public Model.film_schedule GetModel1(int Schedule_id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(" select top 1 Schedule_id,F_id,Date,Time,H_id");
            strSql.Append(" from film_schedule where Schedule_id=@Schedule_id ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@Schedule_id", SqlDbType.Int)
            };
            parameters[0].Value = Schedule_id;


            Model.film_schedule model = new Model.film_schedule();
            DataTable           dt    = SqlDbHelper.ExecuteDataTable(strSql.ToString(), CommandType.Text, parameters);

            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["Schedule_id"] != null && dt.Rows[0]["Schedule_id"].ToString() != "")
                {
                    model.Schedule_id = int.Parse(dt.Rows[0]["Schedule_id"].ToString());
                }
                if (dt.Rows[0]["F_id"] != null && dt.Rows[0]["F_id"].ToString() != "")
                {
                    model.F_id = int.Parse(dt.Rows[0]["F_id"].ToString());
                }
                if (dt.Rows[0]["Date"] != null && dt.Rows[0]["Date"].ToString() != "")
                {
                    model.Date = DateTime.Parse(dt.Rows[0]["Date"].ToString());
                }
                if (dt.Rows[0]["Time"] != null && dt.Rows[0]["Time"].ToString() != "")
                {
                    model.Time = dt.Rows[0]["Time"].ToString();
                }
                if (dt.Rows[0]["H_id"] != null && dt.Rows[0]["H_id"].ToString() != "")
                {
                    model.H_id = dt.Rows[0]["H_id"].ToString();
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 4
0
        //更新电影场次安排
        public bool Updatefilm_schedule(Model.film_schedule model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update film_schedule set");
            strSql.Append(" F_id=@F_id,");
            strSql.Append(" Date=@Date,");
            strSql.Append(" Time=@Time,");
            strSql.Append(" H_id=@H_id");
            strSql.Append(" where Schedule_id=@Schedule_id ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@F_id",        SqlDbType.Int),
                new SqlParameter("@Date",        SqlDbType.Date),
                new SqlParameter("@Time",        SqlDbType.VarChar, 20),
                new SqlParameter("@H_id",        SqlDbType.VarChar, 20),
                new SqlParameter("@Schedule_id", SqlDbType.Int),
            };
            parameters[0].Value = model.F_id;
            parameters[1].Value = model.Date;
            parameters[2].Value = model.Time;
            parameters[3].Value = model.H_id;
            parameters[4].Value = model.Schedule_id;


            int rows = SqlDbHelper.ExecuteNonQuery(strSql.ToString(), CommandType.Text, parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 5
0
 //更新电影场次安排
 public bool Updatefilm_schedule(Model.film_schedule model)
 {
     return(dealfilm_schedule.Updatefilm_schedule(model));
 }
Exemplo n.º 6
0
 //增加电影场次,返回schedule_id
 public int Addfilm_schedule2(Model.film_schedule model)
 {
     return(dealfilm_schedule.Addfilm_schedule2(model));
 }
Exemplo n.º 7
0
 //增加电影场次
 public bool Addfilm_schedule(Model.film_schedule model)
 {
     return(dealfilm_schedule.Addfilm_schedule(model));
 }