//库存清算按钮事件 private void button2_Click(object sender, EventArgs e) { ClassSqlConnect check = new ClassSqlConnect(); string cekItems; cekItems = ("STOR"); DataSet ds = check.ViewSelect(cekItems); this.dataGridView3.DataSource = ds; this.dataGridView3.DataMember = "STORE"; check.Close(); }
private void Form7_Load(object sender, EventArgs e) { ClassSqlConnect sel = new ClassSqlConnect(); string showItems; showItems = ("STAF"); DataSet ds = sel.Select(showItems); this.DataGridView1.DataSource = ds; this.DataGridView1.DataMember = "STAFF"; sel.Close(); }
//员工工资选项卡核算按钮事件 private void Button4_Click(object sender, EventArgs e) { string d1 = dateTimePicker1.Value.Date.ToShortDateString(); string d2 = dateTimePicker2.Value.Date.ToShortDateString(); ClassSqlConnect salary = new ClassSqlConnect(); string salItems; salItems = ("TSAY" + d1 + "," + d2 + " "); string ds = salary.ViewCount(salItems); this.textBox1.Text = ds; salary.Close(); }
private void button5_Click(object sender, EventArgs e) { string d1 = dateTimePicker1.Value.Date.ToShortDateString(); string d2 = dateTimePicker2.Value.Date.ToShortDateString(); ClassSqlConnect saler = new ClassSqlConnect(); string salItems; salItems = ("ECOM" + d1 + "," + d2 + " "); DataSet ds = saler.ViewSelect(salItems); this.dataGridView1.DataSource = ds; this.dataGridView1.DataMember = "PROFIT"; saler.Close(); }
//删除销售记录按钮事件 private void button4_Click(object sender, EventArgs e) { ClassSqlConnect del = new ClassSqlConnect(); string delItems; delItems = ("SALE" + textBox1.Text.ToString() + "," + textBox5.Text.ToString() + "," + textBox7.Text.ToString() + " "); del.Delete(delItems); delItems = ("SALE"); DataSet ds = del.Select(delItems); this.dataGridView1.DataSource = ds; this.dataGridView1.DataMember = "SALE"; del.Close(); }
//删除用户按钮事件 private void ButtonDel_Click(object sender, EventArgs e) { ClassSqlConnect del = new ClassSqlConnect(); string delItems; delItems = ("USER" + TextUID1.Text.ToString() + " "); del.Delete(delItems); delItems = ("USER"); DataSet ds = del.Select(delItems); this.DataGridView1.DataSource = ds; this.DataGridView1.DataMember = "USERS"; del.Close(); }
private void button2_Click(object sender, EventArgs e) { string d1 = dateTimePicker3.Value.Date.ToShortDateString(); string d2 = dateTimePicker4.Value.Date.ToShortDateString(); ClassSqlConnect saler = new ClassSqlConnect(); string salItems; salItems = ("OUST" + d1 + "," + d2 + " "); DataSet ds = saler.ViewSelect(salItems); this.dataGridView2.DataSource = ds; this.dataGridView2.DataMember = "OUTSTORE"; saler.Close(); }
//更新销售记录按钮事件 private void button3_Click(object sender, EventArgs e) { ClassSqlConnect upd = new ClassSqlConnect(); string updItems; updItems = ("SALE" + textBox1.Text.ToString() + "," + textBox2.Text.ToString() + "," + textBox3.Text.ToString() + "," + textBox4.Text.ToString() + "," + textBox5.Text.ToString() + "," + textBox6.Text.ToString() + "," + textBox7.Text.ToString() + " "); upd.Update(updItems); updItems = ("SALE"); DataSet ds = upd.Select(updItems); this.dataGridView1.DataSource = ds; this.dataGridView1.DataMember = "SALE"; upd.Close(); }
//创建销售记录按钮事件 private void button2_Click(object sender, EventArgs e) { ClassSqlConnect add = new ClassSqlConnect(); string addItems; addItems = ("SALE" + textBox1.Text.ToString() + "," + textBox2.Text.ToString() + "," + textBox3.Text.ToString() + "," + textBox4.Text.ToString() + "," + textBox5.Text.ToString() + "," + textBox6.Text.ToString() + "," + textBox7.Text.ToString() + " "); add.Insert(addItems); addItems = ("SALE"); DataSet ds = add.Select(addItems); this.dataGridView1.DataSource = ds; this.dataGridView1.DataMember = "SALE"; add.Close(); }
//修改用户按钮事件 private void ButtonUpd_Click(object sender, EventArgs e) { ClassSqlConnect upd = new ClassSqlConnect(); string updItems; updItems = ("USER" + TextUID1.Text.ToString() + "," + textUName1.Text.ToString() + "," + TextUPower1.Text.ToString() + "," + TextUP1.Text.ToString() + " "); upd.Update(updItems); updItems = ("USER"); DataSet ds = upd.Select(updItems); this.DataGridView1.DataSource = ds; this.DataGridView1.DataMember = "USERS"; upd.Close(); }
//新增用户按钮事件 private void ButtonAdd_Click(object sender, EventArgs e) { ClassSqlConnect add = new ClassSqlConnect(); string addItems; addItems = ("USER" + TextUID1.Text.ToString() + "," + textUName1.Text.ToString() + "," + TextUPower1.Text.ToString() + "," + TextUP1.Text.ToString() + " "); add.Insert(addItems); addItems = ("USER"); DataSet ds = add.Select(addItems); this.DataGridView1.DataSource = ds; this.DataGridView1.DataMember = "USERS"; add.Close(); }
//按商品统计按钮事件 private void button6_Click(object sender, EventArgs e) { string d1 = dateTimePicker1.Value.Date.ToShortDateString(); string d2 = dateTimePicker2.Value.Date.ToShortDateString(); ClassSqlConnect product = new ClassSqlConnect(); string proItems; proItems = ("SALE" + d1 + "," + d2 + " "); DataSet ds = product.ViewSelect(proItems); this.dataGridView2.DataSource = ds; this.dataGridView2.DataMember = "PRODUCT"; product.Close(); }
//登录按键响应事件 private void ButtonLogin_Click(object sender, EventArgs e) { //新建ClassSqlConnect类,调用重构的ViewCount方法返回从数据库中查询的结果 ClassSqlConnect log = new ClassSqlConnect(); SqlDataReader reader = log.ViewCount(ComboxUserName.Text.ToString(),TxtPassword.Text.ToString()); if (reader.Read())//判断有数据,说明登录成功 { /*保存账号信息,将这部分信息保存在数据库(XML)中更好*/ ComboxUserName.Items.Add(ComboxUserName.Text.ToString()); Form nfm; //提取用户名信息 string UName = reader[1].ToString(); MessageBox.Show("欢迎你,"+ UName); //提取权限信息并选择应打开的界面 switch((int)reader[2]) { case 0: nfm = new Form2();//系统管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 1: nfm = new Form7();//人事经理管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 2: nfm = new Form3();//人事员工管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 3: nfm = new Form8();//财务经理管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 4: nfm = new Form4();//财务员工管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 5: nfm = new Form9();//销售经理管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 6: nfm = new Form6();//销售员工管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 7: nfm = new Form10();//仓库经理管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; case 8: nfm = new Form5();//仓库员工管理界面 this.Hide(); if (nfm.ShowDialog() == DialogResult.OK) { this.Show(); } break; default: MessageBox.Show("你没有登录权限," + UName,"没有权限"); ComboxUserName.Text = ""; TxtPassword.Text = ""; break; } } else { MessageBox.Show("用户名或密码错误!","错误"); TxtPassword.Text = ""; } //调用自定义的Close方法关闭sql连接 log.Close(); }
//修改出库记录按钮事件 private void button6_Click(object sender, EventArgs e) { ClassSqlConnect upd = new ClassSqlConnect(); string updItems; updItems = ("OUST" + textBox7.Text.ToString() + "," + textBox8.Text.ToString() + "," + textBox9.Text.ToString() + "," + textBox10.Text.ToString() + " "); upd.Update(updItems); updItems = ("OUST"); DataSet ds = upd.Select(updItems); this.dataGridView2.DataSource = ds; this.dataGridView2.DataMember = "OUTSTORE"; upd.Close(); }
//窗体加载时显示列表信息 private void Form5_Load(object sender, EventArgs e) { ClassSqlConnect sel = new ClassSqlConnect(); string showItems; showItems = ("INST"); DataSet ds = sel.Select(showItems); this.dataGridView1.DataSource = ds; this.dataGridView1.DataMember = "INSTORE"; sel.Close(); showItems = ("OUST"); ds = sel.Select(showItems); this.dataGridView2.DataSource = ds; this.dataGridView2.DataMember = "OUTSTORE"; sel.Close(); }
//添加出库记录按钮事件 private void button8_Click(object sender, EventArgs e) { ClassSqlConnect add = new ClassSqlConnect(); string addItems; addItems = ("OUST" + textBox7.Text.ToString() + "," + textBox8.Text.ToString() + "," + textBox9.Text.ToString() + "," + textBox10.Text.ToString() + " "); add.Insert(addItems); addItems = ("OUST"); DataSet ds = add.Select(addItems); this.dataGridView2.DataSource = ds; this.dataGridView2.DataMember = "OUTSTORE"; add.Close(); }