private void chemstock_Click(object sender, EventArgs e) { stockin stockIn = new stockin(); stockIn.main = this; stockIn.Adminid = this.Adminid; if (chemitemname == "") { stockIn.Tabindex = 3; } else { stockIn.Tabindex = 0; stockIn.Itemname = chemitemname; } stockIn.Show(); }
private void addequipb_Click(object sender, EventArgs e) { stockin stockIn = new stockin(); stockIn.main = this; stockIn.Adminid = this.Adminid; if (equipitemname == "") { stockIn.Tabindex = 1; } else { stockIn.Tabindex = 0; stockIn.Itemname = equipitemname; } stockIn.Show(); }
private void button10_Click(object sender, EventArgs e) { stockin stockIn = new stockin(); stockIn.main = this; stockIn.Adminid = this.Adminid; if (appitemname == "") { stockIn.Tabindex = 2; } else { stockIn.Tabindex = 0; stockIn.Itemname = appitemname; } stockIn.Show(); }
private void InitData(String sql) { try { list.Clear(); MySqlConnection con = new sql_conn().getconn(); con.Open(); MySqlDataReader dr; MySqlCommand cmd = new MySqlCommand(sql, con); dr = cmd.ExecuteReader(); while (dr.Read()) { int flag = 0; for (int i = 0; i < list.Count; i++) { if (list[i].name == dr[0].ToString()) { list[i].amount = list[i].amount + int.Parse(dr[1].ToString()); flag = 1; } } if (flag == 0) { stockin st = new stockin(); st.name = dr[0].ToString(); st.amount = int.Parse(dr[1].ToString()); list.Add(st); } } InitcharControls(); } catch { MessageBox.Show("数据库链接失败,请重试"); } }