private void toolDel_Click(object sender, EventArgs e) { Store_DAL ss = new Store_DAL(constr); int store_id = Convert.ToInt16(dgList.CurrentRow.Cells[0].Value.ToString()); if (ss.Del(store_id) == true) { int iRow = dgList.CurrentRow.Index; dgList.Rows.RemoveAt(iRow); MessageBox.Show("删除成功!"); } else { MessageBox.Show("删除失败!"); } }
private void toolRefresh_Click(object sender, EventArgs e) { Store_DAL ss = new Store_DAL(constr); List <Store> lss = ss.GetStoreSetList(); if (lss.Count > 0) { this.dgList.Rows.Clear(); foreach (Store so in lss) { int index = this.dgList.Rows.Add(); this.dgList.Rows[index].Cells[0].Value = so.Store_id; this.dgList.Rows[index].Cells[1].Value = so.Store_name; this.dgList.Rows[index].Cells[2].Value = so.Stock_id; this.dgList.Rows[index].Cells[3].Value = so.Stock_Number; this.dgList.Rows[index].Cells[4].Value = so.Stock_Name; this.dgList.Rows[index].Cells[5].Value = so.StoreOrg_id; this.dgList.Rows[index].Cells[6].Value = so.StoreOrg_Number; this.dgList.Rows[index].Cells[7].Value = so.StoreOrg_Name; } } }