public void Insert(FbGroupDTO fbGroup) { OleDbConnection connection = DataProvider.CreateConnection(); string cmdText = "Insert into FBGROUP(GroupId, GroupName, NumberOfMember, NgayNhap, NguoiNhap) values(?,?,?,?,?)"; OleDbCommand command = new OleDbCommand(cmdText, connection); command.Parameters.Add("@GroupId", OleDbType.VarWChar); command.Parameters["@GroupId"].Value = fbGroup.GroupId; command.Parameters.Add("@GroupName", OleDbType.VarWChar); command.Parameters["@GroupName"].Value = fbGroup.GroupName; command.Parameters.Add("@NumberOfMember", OleDbType.Integer); command.Parameters["@NumberOfMember"].Value = fbGroup.NumberOfMember; command.Parameters.Add("@NgayNhap", OleDbType.Date); command.Parameters["@NgayNhap"].Value = fbGroup.NgayNhap; command.Parameters.Add("@NguoiNhap", OleDbType.WChar); command.Parameters["@NguoiNhap"].Value = fbGroup.NguoiNhap; command.ExecuteNonQuery(); connection.Close(); }
public void Update(FbGroupDTO fbGroup) { OleDbConnection connection = DataProvider.CreateConnection(); string cmdText = "Update FBGROUP Set GroupName = ?, NumberOfMember = ? Where GroupId like ?"; OleDbCommand command = new OleDbCommand(cmdText, connection); command.Parameters.Add("@GroupName", OleDbType.WChar); command.Parameters.Add("@NumberOfMember", OleDbType.Integer); command.Parameters.Add("@GroupId", OleDbType.WChar); command.Parameters["@GroupName"].Value = fbGroup.GroupName; command.Parameters["@NumberOfMember"].Value = fbGroup.NumberOfMember; command.Parameters["@GroupId"].Value = fbGroup.GroupId; int row = command.ExecuteNonQuery(); connection.Close(); }
private void btnUpdateGroups_Click(object sender, EventArgs e) { if (dtgvGroupSearchResult.Rows.Count == 0) { MessageBox.Show("Please load group list first"); return; } foreach (DataGridViewRow row in this.dtgvGroupSearchResult.Rows) { FbGroupDTO groupDTO = new FbGroupDTO(); groupDTO.GroupId = row.Cells["GroupId"].Value.ToString(); groupDTO.GroupName = row.Cells["GroupName"].Value.ToString(); groupDTO.NumberOfMember = Int32.Parse(row.Cells["GroupMember"].Value.ToString()); groupDTO.NguoiCapNhat = frmDangNhap.gUserName; groupDTO.NgayCapNhat = System.DateTime.Now; FbGroupBUS.Update(groupDTO); } MessageBox.Show("Done"); }
public static void Update(FbGroupDTO group) { FbGroupDAO gd = new FbGroupDAO(); gd.Update(group); }
public static void Insert(FbGroupDTO group) { FbGroupDAO gd = new FbGroupDAO(); gd.Insert(group); }