Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && pictureBox1.ImageLocation != null)
            {
                int sname = Convert.ToInt16(textBox3.Text);
                int row = Convert.ToInt16(textBox1.Text);
                int col = Convert.ToInt16(textBox2.Text);

                string simage = pictureBox1.ImageLocation;
                string image_Path = @"resource\cinema\S" + textBox3.Text.Trim() + ".PNG";

                if (File.Exists(image_Path))
                {
                    File.Delete(image_Path);
                    File.Copy(simage, image_Path);
                }
                else
                {
                    File.Copy(simage, image_Path);
                }

                Screens screen = new Screens(sname, row, col, image_Path);
                SqlScreens.scressAdd(screen);

                cinema.Combox_Load();
                cinema.button4_Click(null, null);
                MessageBox.Show("添加成功");
                this.Dispose();
            }
            else
            {
                MessageBox.Show("请输入完整信息!");
            }
        }
Exemplo n.º 2
0
 public static Screens getScreenBySName(String sName)
 {
     Screens screen = new Screens();
     screen.setName(Convert.ToInt16(sName));
     screen.setRow((int)DbHelperSQL.GetSingle("select Row from Screens where SName='" + sName + "'"));
     screen.setCol((int)DbHelperSQL.GetSingle("select col from Screens where SName='" + sName + "'"));
     screen.setImage((string)DbHelperSQL.GetSingle("select SImage from Screens where SName='" + sName + "'"));
     return screen;
 }
Exemplo n.º 3
0
 public static void scressAdd(Screens screen)
 {
     string insert = "insert into Screens(SName,Row,col,SImage) values("
         + screen.getName() + "," + screen.getRow() + "," + screen.getCol() + ",'" + screen.getImage() + "')";
     DbHelperSQL.ExecuteSql(insert);
 }