private void edit_bt_Click(object sender, EventArgs e) { DataRow drt = manuser.GetDataRow(manuser.FocusedRowHandle); MessageBox.Show(drt["password"].ToString() + " " + drt["ID"].ToString()); Maticsoft.BLL.username user = new Maticsoft.BLL.username(); Maticsoft.Model.username user_mode = user.GetModel(Convert.ToInt32(drt["ID"])); password pass_obj = new password(); pass_obj.user_mode = user_mode; pass_obj.Show(); return; for (int i = 0; i < manuser.RowCount; i++) { string ua = manuser.GetRowCellValue(i, "user").ToString(); string pw = manuser.GetRowCellValue(i, "password").ToString(); string po = manuser.GetRowCellValue(i, "power").ToString(); int id = Convert.ToInt32(manuser.GetRowCellValue(i, "ID")); DateTime tm = Convert.ToDateTime(manuser.GetRowCellValue(i, "addTime")); Maticsoft.BLL.username use = new Maticsoft.BLL.username(); Maticsoft.Model.username us = new username() { ID = id, user = ua, addtime = tm, password = pw, power = po, }; use.Update(us); } MessageBox.Show("修改成功"); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Maticsoft.Model.username model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Maticsoft.Model.username model) { return(dal.Add(model)); }