private void radioButton2_CheckedChanged(object sender, EventArgs e)
 {
     if (radioButton2.Checked == true)
     {
         this.groupBox1.Enabled     = false;
         this.dataGridView1.Visible = true;
         conn = CONN.Myconn();
         conn.Open();
         cmd = new SqlCommand("select * from VIP_INFORMATION", conn);
         sda = new SqlDataAdapter();
         sda.SelectCommand = cmd;
         ds = new DataSet();
         sda.Fill(ds, "VIP_INFORMATION");
         this.dataGridView1.DataSource = ds.Tables[0];
         this.textBox1.Text            = "";
         this.textBox2.Text            = "";
         this.textBox3.Text            = "";
         this.textBox4.Text            = "";
         this.textBox5.Text            = "";
         this.textBox6.Text            = "";
         this.textBox7.Text            = "";
         cmd.Clone();
         conn.Close();
         this.groupBox3.Enabled = true;
     }
 }
 private void radioButton2_CheckedChanged(object sender, EventArgs e)
 {
     if (radioButton2.Checked == true)
     {
         this.groupBox1.Enabled     = false;
         this.dataGridView1.Visible = true;
         this.groupBox3.Enabled     = true;
         conn = CONN.Myconn();
         conn.Open();
         cmd = new SqlCommand("select BOOK_NUMBER as 图书编号,BOOK_NAME as 图书名称, BOOK_AUTHOR as 图书作者, BOOK_PUBLISHER as 出版社,BOOK_PRICE as 图书单价, BOOK_VARIETY as 图书类别, BOOK_RESERVE as 库存量 from BOOK_INFORMATION", conn);
         sda = new SqlDataAdapter();
         sda.SelectCommand = cmd;
         ds = new DataSet();
         sda.Fill(ds, "BOOK_INFORMATION");
         this.dataGridView1.DataSource = ds.Tables[0];
         cmd.Clone();
         conn.Close();
         this.textBox1.Text = "";
         this.textBox2.Text = "";
         this.textBox3.Text = "";
         this.textBox4.Text = "";
         this.textBox5.Text = "";
         this.textBox6.Text = "";
     }
 }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string t1 = this.textBox1.Text.Trim();
            string t2 = this.textBox2.Text.Trim();

            if (textBox1.Text != "" && textBox2.Text != "")
            {
                SqlConnection conn = CONN.Myconn();
                conn.Open();
                SqlCommand    cmd = new SqlCommand("select * from USERS_INFORMATION where USERS_LOGINNAME='" + t1 + "' and USERS_PASSWORDS='" + t2 + "'", conn);
                SqlDataReader sdr = cmd.ExecuteReader();
                if (sdr.Read())
                {
                    this.Hide();
                    主界面 frm2 = new 主界面();
                    frm2.authorization = sdr["USERS_AUTHORIZATIONS"].ToString().Trim();
                    frm2.name          = t1;
                    frm2.time          = DateTime.Now.ToLongDateString() + " " + DateTime.Now.DayOfWeek;
                    frm2.ShowDialog();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("用户名或密码错误!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.textBox2.Text = "";
                    this.textBox2.Focus();
                }
            }
            else
            {
                MessageBox.Show("用户名或密码不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Esempio n. 4
0
        private void textBox1_LostFocus(object sender, EventArgs e)
        {
            string        t1   = this.textBox1.Text.Trim();
            SqlConnection conn = CONN.Myconn();

            conn.Open();
            SqlCommand    cmd = new SqlCommand("select * from BOOK_INFORMATION where BOOK_NUMBER='" + t1 + "'", conn);
            SqlDataReader sdr = cmd.ExecuteReader();

            if (sdr.Read())
            {
                if (MessageBox.Show("图书编号已存在!是否显示", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
                {
                    this.textBox2.Text = sdr[1].ToString().Trim();
                    this.textBox3.Text = sdr[2].ToString().Trim();
                    this.textBox4.Text = sdr[3].ToString().Trim();
                    this.textBox5.Text = sdr[4].ToString().Trim();
                    this.textBox6.Text = sdr[5].ToString().Trim();
                    this.textBox7.Focus();
                }
                else
                {
                    this.textBox1.Text = "";
                    this.textBox1.Focus();
                }
            }
        }
Esempio n. 5
0
 private void radioButton2_CheckedChanged(object sender, EventArgs e)
 {
     if (radioButton2.Checked == true)
     {
         this.groupBox1.Enabled     = false;
         this.dataGridView1.Visible = true;
         this.groupBox3.Enabled     = true;
         conn = CONN.Myconn();
         conn.Open();
         cmd = new SqlCommand("select USERS_NUMBER as 用户编号,USERS_NAME as 姓名, USERS_SEX as 性别, USERS_LOGINNAME as 登录名,USERS_PASSWORDS as 密码, USERS_AUTHORIZATIONS as 权限 from USERS_INFORMATION", conn);
         sda = new SqlDataAdapter();
         sda.SelectCommand = cmd;
         ds = new DataSet();
         sda.Fill(ds, "USERS_INFORMATION");
         this.dataGridView1.DataSource = ds.Tables[0];
         cmd.Clone();
         conn.Close();
         this.textBox1.Text = "";
         this.textBox2.Text = "";
         this.textBox3.Text = "";
         this.textBox4.Text = "";
         this.textBox5.Text = "";
         this.textBox6.Text = "";
         this.textBox7.Text = "";
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            string t1 = this.textBox1.Text.Trim();
            string t2 = this.textBox2.Text.Trim();
            string t3 = this.comboBox1.SelectedItem.ToString();
            string t4 = "";

            switch (comboBox2.SelectedItem.ToString())
            {
            case "VIP1": t4 = "1"; break;

            case "VIP2": t4 = "2"; break;

            case "VIP3": t4 = "3"; break;

            case "VIP4": t4 = "4"; break;

            case "VIP5": t4 = "5"; break;
            }
            if (t1 == "")
            {
                MessageBox.Show("会员编号不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                SqlConnection conn = CONN.Myconn();
                conn.Open();
                SqlCommand    cmd = new SqlCommand("select * from VIP_INFORMATION where VIP_NUMBER='" + t1 + "'", conn);
                SqlDataReader sdr = cmd.ExecuteReader();
                if (sdr.Read())
                {
                    this.label8.Text    = "该会员信息已存在!";
                    this.label8.Visible = true;
                    sdr.Close();
                }
                else
                {
                    cmd.Clone();
                    cmd = new SqlCommand("insert VIP_INFORMATION values('" + t1 + "','" + t2 + "','" + t3 + "','" + t4 + "')", conn);
                    sdr.Close();
                    cmd.ExecuteScalar();
                    this.label8.Text    = "增加成功!";
                    this.label8.Visible = true;
                }
                this.textBox1.Text           = "";
                this.textBox2.Text           = "";
                this.comboBox1.SelectedIndex = 0;
                this.comboBox2.SelectedIndex = 0;
                conn.Close();
            }
            this.textBox1.Focus();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string t1 = this.textBox1.Text.Trim();
            string t2 = this.textBox2.Text.Trim();
            string t3 = this.comboBox1.SelectedItem.ToString().Trim();
            string t4 = this.textBox4.Text.Trim();
            string t5 = this.textBox5.Text.Trim();
            string t6 = "";

            switch (comboBox2.SelectedItem.ToString())
            {
            case "管理人员": t6 = "1"; break;

            case "销售人员": t6 = "2"; break;
            }
            if (t1 == "")
            {
                MessageBox.Show("用户编号不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                conn = CONN.Myconn();
                conn.Open();
                cmd = new SqlCommand("select * from USERS_INFORMATION where USERS_NUMBER='" + t1 + "'", conn);
                sdr = cmd.ExecuteReader();
                if (sdr.Read())
                {
                    this.label8.Text    = "该用户信息已存在!";
                    this.label8.Visible = true;
                    sdr.Close();
                }
                else
                {
                    cmd.Clone();
                    cmd = new SqlCommand("insert USERS_INFORMATION values('" + t1 + "','" + t2 + "','" + t3 + "','" + t4 + "','" + t5 + "','" + t6 + "')", conn);
                    sdr.Close();
                    cmd.ExecuteScalar();
                    this.label8.Text    = "增加成功!";
                    this.label8.Visible = true;
                }
                this.textBox1.Text = "";
                this.textBox1.Focus();
                this.textBox2.Text          = "";
                this.comboBox1.SelectedItem = 0;
                this.textBox4.Text          = "";
                this.textBox5.Text          = "";
                this.comboBox2.SelectedItem = 0;
                conn.Close();
            }
        }
        private void textBox1_LostFocus(object sender, EventArgs e)
        {
            string        t1   = this.textBox1.Text.Trim();
            SqlConnection conn = CONN.Myconn();

            conn.Open();
            SqlCommand    cmd = new SqlCommand("select * from USERS_INFORMATION where USERS_NUMBER='" + t1 + "'", conn);
            SqlDataReader sdr = cmd.ExecuteReader();

            if (sdr.Read())
            {
                if (MessageBox.Show("该用户编号已存在!请重新填写", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk) == DialogResult.OK)
                {
                    this.textBox1.Text = "";
                    this.textBox1.Focus();
                }
            }
        }
        private void textBox5_LostFocus(object sender, EventArgs e)
        {
            string        t1   = this.textBox5.Text.Trim();
            SqlConnection conn = CONN.Myconn();

            conn.Open();
            SqlCommand    cmd = new SqlCommand("select * from BOOK_INFORMATION where BOOK_NUMBER='" + t1 + "'", conn);
            SqlDataReader sdr = cmd.ExecuteReader();

            if (sdr.Read())
            {
            }
            else
            {
                if (this.textBox5.Text != "")
                {
                    MessageBox.Show("该图书编号不存在!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.textBox5.Text = "";
                    this.textBox5.Focus();
                }
            }
        }
Esempio n. 10
0
        private void button1_Click(object sender, EventArgs e)
        {
            string t1 = this.textBox1.Text.Trim();
            string t2 = this.textBox2.Text.Trim();
            string t3 = this.textBox3.Text.Trim();
            string t4 = this.textBox4.Text.Trim();
            float  t5;

            if (float.TryParse(this.textBox5.Text.Trim(), out t5))
            {
            }
            else
            {
                t5 = 0;
            }
            string t6 = this.textBox6.Text.Trim();
            int    t7;

            if (int.TryParse(this.textBox7.Text.Trim(), out t7))
            {
            }
            else
            {
                t7 = 0;
            }
            int number;

            if (t1 == "")
            {
                MessageBox.Show("图书编号不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                SqlConnection conn = CONN.Myconn();
                conn.Open();
                SqlCommand    cmd = new SqlCommand("select * from BOOK_INFORMATION where BOOK_NUMBER='" + t1 + "'", conn);
                SqlDataReader sdr = cmd.ExecuteReader();
                if (sdr.Read())
                {
                    this.label8.Text    = "图书信息已存在!";
                    this.label8.Visible = true;
                    number = int.Parse(sdr["BOOK_RESERVE"].ToString().Trim());
                    sdr.Close();
                    cmd.Clone();
                    number = number + t7;
                    cmd    = new SqlCommand("update BOOK_INFORMATION set BOOK_RESERVE=" + number + " where BOOK_NUMBER = '" + t1 + "'", conn);
                    cmd.ExecuteScalar();
                    string s = string.Format("新增{0}本图书后,总的库存量为{1}", t7, number);
                    this.label9.Text    = s;
                    this.label9.Visible = true;
                }
                else
                {
                    cmd.Clone();
                    cmd = new SqlCommand("insert BOOK_INFORMATION values('" + t1 + "','" + t2 + "','" + t3 + "','" + t4 + "'," + t5 + ",'" + t6 + "'," + t7 + ")", conn);
                    sdr.Close();
                    cmd.ExecuteScalar();
                    this.label8.Text    = "增加成功!";
                    this.label8.Visible = true;
                    string s = string.Format("该图书入库后,总的库存量为{0}", t7);
                    this.label9.Text    = s;
                    this.label9.Visible = true;
                }
                this.textBox1.Text = "";
                this.textBox2.Text = "";
                this.textBox3.Text = "";
                this.textBox4.Text = "";
                this.textBox5.Text = "";
                this.textBox6.Text = "";
                this.textBox7.Text = "";
                conn.Close();
            }
        }