コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            SFact    sFact = new SFact();
            SOperate s1    = sFact.Select();

            if (s1._Select("*", "vip", "vip_num", textBox1.Text).Tables[0].Rows.Count == 0)
            {
                if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "" && textBox5.Text != "" && textBox6.Text != "" &&
                    textBox7.Text != "")
                {
                    SOperate s = sFact.Add();
                    s._Add("vip(vip_num,vip_name,vip_sex,vip_age,vip_money,vip_pwd,vip_phone)", "'" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" +
                           textBox4.Text + "','" + textBox5.Text + "','" + textBox6.Text + "','" + textBox7.Text + "' ");
                    textBox1.Text = "";
                    textBox2.Text = "";
                    textBox3.Text = "";
                    textBox4.Text = "";
                    textBox5.Text = "";
                    textBox6.Text = "";
                    textBox7.Text = "";
                }
                else
                {
                    MessageBox.Show("存在输入信息为空。!");
                }
            }
            else
            {
                MessageBox.Show("该员工账号已存在!");
            }
        }
コード例 #2
0
        public SOperate con()
        {
            SFact    s      = new SFact();
            SOperate select = s.Select();

            return(select);
        }
コード例 #3
0
        private void button3_Click(object sender, EventArgs e)
        {
            SFact    sFact = new SFact();
            SOperate s     = sFact.Select();
            DataSet  ds    = new DataSet();

            if (comboBox1.Text.Equals("All"))
            {
                ds = s._Select("*", "good");
                dataGridView1.DataSource = ds.Tables[0].DefaultView;
            }
            else if (comboBox1.Text.Equals("商品号"))
            {
                ds = s._Select("*", "good", "good_num", textBox1.Text);
                dataGridView1.DataSource = ds.Tables[0].DefaultView;
            }
            else if (comboBox1.Text.Equals("商品类别"))
            {
                ds = s._Select("*", "good", "good_typeid", textBox1.Text);
                dataGridView1.DataSource = ds.Tables[0].DefaultView;
            }
            else if (comboBox1.Text.Equals("商品名"))
            {
                ds = s._Select("*", "good", "good_name", textBox1.Text);
                dataGridView1.DataSource = ds.Tables[0].DefaultView;
            }
        }
コード例 #4
0
        private void button3_Click(object sender, EventArgs e)
        {
            SFact    sFact = new SFact();
            SOperate s     = sFact.Delete();

            s._Del("vip", "id", id);
            ClearInfo();
        }
コード例 #5
0
        public void ShowInfo()
        {
            DataSet ds = new DataSet();

            SFact    sFact = new SFact();
            SOperate s     = sFact.Select();

            ds = s._Select("good");

            dataGridView1.DataSource = ds.Tables[0].DefaultView;
            comboBox1.Items.Add("All");
            comboBox1.Items.Add("商品号");
            comboBox1.Items.Add("商品类别");
            comboBox1.Items.Add("商品名");
        }
コード例 #6
0
        public InpSp()
        {
            InitializeComponent();
            DataSet  ds    = new DataSet();
            SFact    sFact = new SFact();
            SOperate s     = sFact.Select();

            ds = s._Select("goodType_name", "goodtype");
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                comboBox1.Items.Add(ds.Tables[0].Rows[i][0].ToString().Trim());
            }
            comboBox1.DisplayMember = "shang";
            comboBox1.ValueMember   = "id";
        }
コード例 #7
0
        public void showInfo()
        {
            DataSet  ds    = new DataSet();
            DataSet  ds1   = new DataSet();
            SFact    sFact = new SFact();
            SOperate s     = sFact.Select();

            ds  = s._Select("good");
            ds1 = s._Select("good_id", "good");
            dataGridView1.DataSource = ds.Tables[0].DefaultView;
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                comboBox1.Items.Add(ds.Tables[0].Rows[i][0].ToString().Trim());
            }
            comboBox1.DisplayMember = "shang";
            comboBox1.ValueMember   = "id";
        }
コード例 #8
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (num == textBox1.Text)
     {
         SFact    sFact = new SFact();
         string   name  = textBox2.Text;
         string   sex   = textBox3.Text;
         string   age   = textBox4.Text;
         string   money = textBox5.Text;
         string   pwd   = textBox6.Text;
         string   phone = textBox7.Text;
         SOperate s     = sFact.Update();
         s._Update("vip", "vip_name = '" + name + "',vip_sex= '" + sex + "',vip_age=" + age + ",vip_money= '" + money + "',vip_pwd='" + pwd + "',vip_phone='" + phone + "'", "id", id);
     }
     else
     {
         MessageBox.Show("会员号不可更改");
     }
 }
コード例 #9
0
 private void button1_Click_1(object sender, EventArgs e)
 {
     if (tabControl1.SelectedTab.Name == "tabPage2")
     {
         Login_stra l = new Login_stra();
         // 返回的s是该登录用户的密码
         string s = l.Login(1, textBox3.Text);
         if (textBox4.Text == s)
         {
             DataSet  ds    = new DataSet();
             SFact    sFact = new SFact();
             SOperate s1    = sFact.Select();
             ds = s1._Select("sta_name", "staff", "sta_num", textBox3.Text);
             Form f = new MainWin(this, ds.Tables[0].Rows[0][0].ToString().Trim(), 0);
             this.Hide();
             f.Show();
         }
         else
         {
             MessageBox.Show("用户名不存在或密码错误...");
         }
     }
     else if (tabControl1.SelectedTab.Name == "tabPage1")//vip
     {
         Login_stra l = new Login_stra();
         string     s = l.Login(0, textBox1.Text);
         if (textBox2.Text == s)
         {
             DataSet  ds    = new DataSet();
             SFact    sFact = new SFact();
             SOperate s1    = sFact.Select();
             ds = s1._Select("sys_name", "system", "sys_num", textBox1.Text);
             Form f = new MainWin(this, ds.Tables[0].Rows[0][0].ToString().Trim(), 1);
             this.Hide();
             f.Show();
         }
         else
         {
             MessageBox.Show("用户名不存在或密码错误...");
         }
     }
 }
コード例 #10
0
        private void button2_Click(object sender, EventArgs e)
        {
            DataSet  ds    = new DataSet();
            SFact    sFact = new SFact();
            SOperate s     = sFact.Select();
            DataSet  ds1   = new DataSet();

            if (comboBox1.Text.Equals("All"))
            {
                ds = s._Select(" id as ID,vip_num as '会员号',vip_name as '会员名',vip_sex as '性别', vip_age as '年龄',vip_money as '余额',vip_phone as '联系方式',vip_pwd as '密码'", "vip");
                dataGridView1.DataSource = ds.Tables[0].DefaultView;
            }
            else if (comboBox1.Text.Equals("会员号"))
            {
                ds = s._Select("*", "vip", "vip_num", textBox1.Text);
                dataGridView1.DataSource = ds.Tables[0].DefaultView;
            }
            else if (comboBox1.Text.Equals("姓名"))
            {
                ds = s._Select("*", "vip", "vip_name", textBox1.Text);
                dataGridView1.DataSource = ds.Tables[0].DefaultView;
            }
            else if (comboBox1.Text.Equals("年龄"))
            {
                ds = s._Select("*", "vip", "vip_age", textBox1.Text);
                dataGridView1.DataSource = ds.Tables[0].DefaultView;
            }
            else if (comboBox1.Text.Equals("性别"))
            {
                ds = s._Select("*", "vip", "vip_sex", textBox1.Text);
                dataGridView1.DataSource = ds.Tables[0].DefaultView;
            }
            else if (comboBox1.Text.Equals("手机号"))
            {
                ds = s._Select("*", "vip", "vip_phone", textBox1.Text);
                dataGridView1.DataSource = ds.Tables[0].DefaultView;
            }
        }
コード例 #11
0
        private void button1_Click(object sender, EventArgs e)
        {
            num = textBox1.Text;
            SFact    sFact = new SFact();
            SOperate s     = sFact.Select();
            DataSet  d     = s._Select("*", "vip", "vip_num", textBox1.Text);

            if (d.Tables[0].Rows.Count == 0 && d.Tables.Count == 1)//判断是否有数据
            {
                MessageBox.Show("该会员号不存在");
                ClearInfo();
            }
            else
            {
                id            = d.Tables[0].Rows[0][0].ToString();
                textBox2.Text = d.Tables[0].Rows[0][2].ToString();
                textBox3.Text = d.Tables[0].Rows[0][3].ToString();
                textBox4.Text = d.Tables[0].Rows[0][4].ToString();
                textBox5.Text = d.Tables[0].Rows[0][5].ToString();
                textBox6.Text = d.Tables[0].Rows[0][6].ToString();
                textBox7.Text = d.Tables[0].Rows[0][7].ToString();
            }
        }
コード例 #12
0
        private void button1_Click(object sender, EventArgs e)
        {
            DataSet  ds    = new DataSet();
            SFact    sFact = new SFact();
            SOperate s     = sFact.Select();
            SOperate s1    = sFact.Update();
            SOperate s2    = sFact.Delete();
            int      num   = int.Parse(s._Select("good_sum", "good", "good_id", comboBox1.Text).Tables[0].Rows[0][0].ToString().Trim());

            if (num < int.Parse(textBox1.Text))
            {
                MessageBox.Show("数量不足!");
            }
            else if (num == int.Parse(textBox1.Text))
            {
                num = num - int.Parse(textBox1.Text);
                s2._Del("good", "good_id", comboBox1.Text);
            }
            else
            {
                num = num - int.Parse(textBox1.Text);
                s1._Update("good", "good_sum", num.ToString(), "good_id", comboBox1.Text);
            }
        }