Ejemplo n.º 1
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 0)
            {
                MessageBox.Show("请选择一列数据");
                return;
            }
            int    a       = dataGridView1.SelectedRows[0].Index;
            int    OrderId = (int)dataGridView1.Rows[a].Cells["OrderId"].Value;
            string state   = dataGridView1.Rows[a].Cells["Column8"].Value.ToString().Trim();

            if (state == "已退订")
            {
                string  sql  = string.Format(@"DELETE FROM OrderInfo  where OrderId='{0}'", OrderId);
                DBTools bb   = new DBTools();
                string  sql2 = string.Format(@"DELETE FROM client_order where OrderId='{0}'", OrderId);
                int     i    = bb.DonIntsdf(sql);
                if (i > 0)
                {
                    MessageBox.Show("删除成功");
                    loadDate();
                }
                else
                {
                    MessageBox.Show("删除失败");
                }
            }
            else
            {
                MessageBox.Show("只可删除已退订的订单");
            }
        }
Ejemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            int    sdf         = 0;
            Random random      = new Random();
            int    number      = Convert.ToInt32(numericUpDown1.Value);                   //电影票的张数
            string moiveid     = dataGridView1.SelectedRows[0].Cells[0].Value.ToString(); //影院ID
            string dindanbianh = "";

            if (number <= int.Parse(textBox7.Text.ToString()))
            {
                for (int i = 1; i <= number; i++)
                {
                    int    orderId = random.Next(100000, 999999);//生成一个六位随机数作为订单编号
                    string sql     = string.Format(@"INSERT INTO [movieDB].[dbo].[OrderInfo]
                           ([OrderId]
                           ,[TicketId]
                           ,[number]
                           ,[State])
                     VALUES ({0},'{1}','{2}','{3}')
                     ;UPDATE [movieDB].[dbo].[Movie] SET [number]=[number]-{4} WHERE TicketId='{5}'"
                                                   , orderId, moiveid, number, "已预订", number, moiveid);
                    Convert.ToInt32(cc.DonIntsdf(sql));

                    string sql2 = string.Format(@"INSERT INTO client_order([OrderId],[ClientId])  VALUES ('{0}','{1}')", orderId, Program.username);
                    sdf         = Convert.ToInt32(cc.DonIntsdf(sql2));
                    dindanbianh = dindanbianh + orderId;
                }
                if (sdf > 0)
                {
                    MessageBox.Show("预订成功,订单编号为:" + dindanbianh, "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
            else
            {
                MessageBox.Show("预订的票数不能超过剩余票数");
            }
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string  sql = string.Format(@"update Client set ClientPwd='{0}',name='{1}',age={2} where ClientId='{3}'", textBox3.Text, textBox1.Text, textBox2.Text, Program.username);
            DBTools bb  = new DBTools();
            int     i   = bb.DonIntsdf(sql);

            if (i > 0)
            {
                MessageBox.Show("保存成功");
            }
            else
            {
                MessageBox.Show("保存失败");
            }
        }
Ejemplo n.º 4
0
        private void tuidinToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count == 0)
            {
                MessageBox.Show("请选择一列数据");
                return;
            }
            int     a       = dataGridView1.SelectedRows[0].Index;
            int     OrderId = (int)dataGridView1.Rows[a].Cells["OrderId"].Value;
            string  sql     = string.Format(@"update OrderInfo set State='{0}' where OrderId='{1}'", "已退订", OrderId);
            DBTools bb      = new DBTools();
            int     i       = bb.DonIntsdf(sql);

            if (i > 0)
            {
                MessageBox.Show("退订成功");
                loadDate();
            }
            else
            {
                MessageBox.Show("退订失败");
            }
        }
Ejemplo n.º 5
0
        private void button1_Click(object sender, EventArgs e)//注册
        {
            bool kdfg = ksdjhfg();

            if (kdfg == false)
            {
                string ID     = comboBox1.Text;
                string PWD    = textBox1.Text;
                string quePWD = textBox2.Text;

                if (ID != "" && PWD != "" && quePWD != "" && textBox3.Text != "")
                {
                    if (ID.Length == 11)
                    {
                        bool asd = IsHandset(ID);
                        if (asd)
                        {
                            if (PWD.Length >= 6 && PWD.Length <= 12)
                            {
                                if (PWD == quePWD)
                                {
                                    if (textBox3.Text == he.ToString())
                                    {
                                        string  asdd    = @"INSERT INTO [movieDB].[dbo].[Client]
                                   ([ClientId]
                                   ,[ClientPwd])
                             VALUES
                                   ('" + ID + "','" + PWD + "')";
                                        DBTools bb      = new DBTools();
                                        int     clienID = bb.DonIntsdf(asdd);
                                        if (clienID == 1)
                                        {
                                            MessageBox.Show("注册成功,立即返回登录界面", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                                            this.Close();
                                        }
                                        else
                                        {
                                            MessageBox.Show("注册失败");
                                        }
                                    }
                                    else
                                    {
                                        MessageBox.Show("验证码不正确");
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("密码不一致");
                                }
                            }
                            else
                            {
                                MessageBox.Show("密码长度限制在6-12位");
                            }
                        }
                        else
                        {
                            MessageBox.Show("手机号格式不正确");
                        }
                    }
                    else
                    {
                        MessageBox.Show("手机号长度不正确");
                    }
                }
                else
                {
                    MessageBox.Show("请完善信息!");
                }
            }
            else
            {
                MessageBox.Show("此用户已注册");
            }
        }