public void TestLoaiItem07_DeleteSuccess() { TestLoaiItem05_InsertSuccess(); List <DMLoaiItemInfor> list = DMLoaiItemDataProvider.GetListItemInfor(); DMLoaiItemInfor infor = list.Find(delegate(DMLoaiItemInfor match) { return(match.MaLoaiItem == "5"); }); frmDM_LoaiItem frm = new frmDM_LoaiItem(); frm.isAdd = false; frm.Oid = infor.IdLoaiItem; frmChiTiet_LoaiItem frmChiTietLoaiItem = new frmChiTiet_LoaiItem(frm); frmChiTietLoaiItem.TestDelete(); list = DMLoaiItemDataProvider.GetListItemInfor(); infor = list.Find(delegate(DMLoaiItemInfor match) { return(match.MaLoaiItem == "5"); }); Assert.AreEqual(infor, null); }
private void ucActions1_OnDelete(object obj) { //DMLoaiItemInfor khaibao = new DMLoaiItemInfor(); //khaibao.MaLoaiItem = Convert.ToString(getValue("clMaLoaiItem")); DMLoaiItemDataProvider.Delete(new DMLoaiItemInfor { IdLoaiItem = Convert.ToInt32(getValue("clIdLoaiItem")) }); MessageBox.Show("Xóa Thành Công", "Thông Báo"); dgvList.DataSource = DMLoaiItemDataProvider.GetListItemInfor(); }
private void frmDM_LoaiItem_Load(object sender, EventArgs e) { try { dgvList.DataSource = DMLoaiItemDataProvider.GetListItemInfor(); } catch (Exception ex) { #if DEBUG MessageBox.Show("Lỗi ngoại lệ: " + ex.ToString(), Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error); #else MessageBox.Show("Lỗi ngoại lệ: " + ex.Message, Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error); #endif this.Dispose(); } }
public frmDmLoaiItemTestUnits() { frmLogin frmLogin = new frmLogin(); frmLogin.TestLogin("quantri", "quantri"); //chuẩn bị dữ liệu để test List <DMLoaiItemInfor> list = DMLoaiItemDataProvider.GetListItemInfor(); List <DMLoaiItemInfor> listMatch = list.FindAll(delegate(DMLoaiItemInfor match) { return(match.MaLoaiItem == "5"); }); foreach (var dmLoaiItemInfor in listMatch) { DMLoaiItemDataProvider.Delete(dmLoaiItemInfor); } }
public void TestLoaiItem03_MaLoaiItemHasExistedOnUpdate() { try { TestLoaiItem05_InsertSuccess(); List <DMLoaiItemInfor> list = DMLoaiItemDataProvider.GetListItemInfor(); DMLoaiItemInfor infor = list.Find(delegate(DMLoaiItemInfor match) { return(match.MaLoaiItem == "5"); }); frmDM_LoaiItem frm = new frmDM_LoaiItem(); frm.isAdd = false; frm.Oid = infor.IdLoaiItem; frmChiTiet_LoaiItem frmChiTietLoaiItem = new frmChiTiet_LoaiItem(frm); frmChiTietLoaiItem.SetInput("LoaiItem1", "1", "Unit test ma LoaiItem", 1); frmChiTietLoaiItem.TestSave(); list = DMLoaiItemDataProvider.GetListItemInfor(); List <DMLoaiItemInfor> listDuplicate = list.FindAll(delegate(DMLoaiItemInfor match) { return(match.MaLoaiItem == "1"); }); frmChiTietLoaiItem.TestDelete(); Assert.AreEqual(1, listDuplicate.Count); } catch (Exception ex) { if (ex.GetType() != typeof(AssertFailedException)) { Assert.AreEqual(ex.Message, "Mã loại Item đã có trong hệ thống !"); } else { throw; } } }
protected override void LoadData() { grcBase.DataSource = DMLoaiItemDataProvider.GetListItemInfor(); btTimKiem.Text = Resources.btnSearch; }
private void ucActions1_OnAdd(object obj) { DMLoaiItemDataProvider.Insert(getinfor()); MessageBox.Show("Thêm bảng thành công!"); dgvList.DataSource = DMLoaiItemDataProvider.GetListItemInfor(); }
private void ucActions1_OnUpdate(object obj) { DMLoaiItemDataProvider.Update(getinfor()); MessageBox.Show("Sửa bảng thành công!"); dgvList.DataSource = DMLoaiItemDataProvider.GetListItemInfor(); }