private void Goodsadd_Load(object sender, EventArgs e) { DataTable type = TypeBLL.selecttype(); if (type.Rows.Count != 0) { foreach (DataRow row in type.Rows) { this.cbo_type.Items.Add(row[1].ToString()); } this.cbo_type.SelectedIndex = 0; } }
//在操作区域内部添加选项卡页,显示WarehouseForm窗体 private void btn_cangku_Click(object sender, EventArgs e) { DataTable type = TypeBLL.selecttype(); if (type.Rows.Count != 0) { //在操作区域内部添加选项卡页,显示WarehouseForm窗体 WarehouseForm warehouseForm = new WarehouseForm(); AddTabPage("仓库管理", warehouseForm); } else { MessageBox.Show("请先去添加书本类型", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } }
private void btn_jinhuo_Click(object sender, EventArgs e) { DataTable type = TypeBLL.selecttype(); if (type.Rows.Count != 0) { //new一个添加书本对象 Booksadd Add = new Booksadd(); //显示窗体 Add.Show(); } else { MessageBox.Show("请先去添加书本类型", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } }
private void btn_delete_Click(object sender, EventArgs e) { try { TypeBLL.InsertType(this.txt_typename.Text); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { this.dgv_xiangqing.AutoGenerateColumns = false; this.dgv_xiangqing.DataSource = TypeBLL.selecttype(); this.txt_typename.Text = ""; } }
int booktype; //保存当前书本类型 private void WarehouseForm_Load(object sender, EventArgs e) { //显示所有书本 //不允许自动创建列 this.dgv_goods.AutoGenerateColumns = false; //绑定数据源 this.dgv_goods.DataSource = BooksBLL.GetBooksandType(); //初始最大化 this.WindowState = System.Windows.Forms.FormWindowState.Maximized; //设置为可编辑状态 // dgv_goods.BeginEdit(false); //查询类型 DataTable dt = TypeBLL.selecttype(); //遍历出所有类型 for (int i = 0; i < dt.Rows.Count; i++) { this.cbo_type.Items.Add(dt.Rows[i][1]); } }
//删除 private void btn_delete_Click_1(object sender, EventArgs e) { try { if (TypeBLL.DeleteType(id)) { MessageBox.Show("删除成功", "温馨提示"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { //初始化 id = 0; this.txt_typename.Text = ""; this.dgv_xiangqing.DataSource = TypeBLL.selecttype(); } }
private void TypeForm_Load(object sender, EventArgs e) { //绑定数据 this.dgv_xiangqing.AutoGenerateColumns = false; this.dgv_xiangqing.DataSource = TypeBLL.selecttype(); }