예제 #1
0
        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);
        }
예제 #2
0
 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();
 }
예제 #3
0
        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();
            }
        }
예제 #4
0
        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);
            }
        }
예제 #5
0
        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;
                }
            }
        }
예제 #6
0
 protected override void LoadData()
 {
     grcBase.DataSource = DMLoaiItemDataProvider.GetListItemInfor();
     btTimKiem.Text     = Resources.btnSearch;
 }
예제 #7
0
 private void ucActions1_OnAdd(object obj)
 {
     DMLoaiItemDataProvider.Insert(getinfor());
     MessageBox.Show("Thêm bảng thành công!");
     dgvList.DataSource = DMLoaiItemDataProvider.GetListItemInfor();
 }
예제 #8
0
 private void ucActions1_OnUpdate(object obj)
 {
     DMLoaiItemDataProvider.Update(getinfor());
     MessageBox.Show("Sửa bảng thành công!");
     dgvList.DataSource = DMLoaiItemDataProvider.GetListItemInfor();
 }