コード例 #1
0
        public void TestDuAn07_DeleteSuccess()
        {
            TestLoaiSP05_InsertSuccess();
            List <DMLoaiSanPhamInfo> list  = DMLoaiSanPhamDataProvider.GetLoaiSPInfor();
            DMLoaiSanPhamInfo        infor = list.Find(delegate(DMLoaiSanPhamInfo match)
            {
                return(match.MaLoaiSP == "13");
            });

            frmDM_LoaiSanPham frm = new frmDM_LoaiSanPham();

            frm.isAdd = false;
            frm.Oid   = infor.IdLoaiSP;

            frmChiTiet_LoaiSanPham frmChiTiet = new frmChiTiet_LoaiSanPham(frm);

            frmChiTiet.TestDelete();
            list  = DMLoaiSanPhamDataProvider.GetLoaiSPInfor();
            infor = list.Find(delegate(DMLoaiSanPhamInfo match)
            {
                return(match.MaLoaiSP == "13");
            });

            Assert.AreEqual(infor, null);
        }
コード例 #2
0
        internal void Update(DMLoaiSanPhamInfo dmChucNangInfor)
        {
            ExecuteCommand(Declare.StoreProcedureNamespace.spLoaiSanPhamUpdate,
                           ParseToParams <DMLoaiSanPhamInfo>(dmChucNangInfor));

            //CreateCommonCommand(Declare.StoreProcedureNamespace.spLoaiSanPhamUpdate);
            //SetParams(dmChucNangInfor);
            //ExecuteNoneQuery();
        }
コード例 #3
0
        internal void Delete(DMLoaiSanPhamInfo dmChucNangInfor)
        {
            ExecuteCommand(Declare.StoreProcedureNamespace.spLoaiSanPhamDelete,
                           dmChucNangInfor.IdLoaiSP);

            //CreateCommonCommand(Declare.StoreProcedureNamespace.spLoaiSanPhamDelete);
            //Parameters.AddWithValue("@IdChucNang", dmChucNangInfor.IdLoaiSP);
            //ExecuteNoneQuery();
        }
コード例 #4
0
        internal List <DMLoaiSanPhamInfo> Search(DMLoaiSanPhamInfo dmChucNangInfor)
        {
            return(GetListCommand <DMLoaiSanPhamInfo>(Declare.StoreProcedureNamespace.spLoaiSanPhamSearch,
                                                      dmChucNangInfor.TenLoaiSP,
                                                      dmChucNangInfor.MaLoaiSP));

            //CreateGetListCommand(Declare.StoreProcedureNamespace.spLoaiSanPhamSearch);
            //Parameters.AddWithValue("@MaChucNang", dmChucNangInfor.TenLoaiSP);
            //Parameters.AddWithValue("@TenChucNang", dmChucNangInfor.MaLoaiSP);
            //return FillToList<DMLoaiSanPhamInfo>();
        }
コード例 #5
0
        internal int Insert(DMLoaiSanPhamInfo dmChucNangInfor)
        {
            return(GetObjectCommand <int>(Declare.StoreProcedureNamespace.spLoaiSanPhamInsert,
                                          ParseToParams <DMLoaiSanPhamInfo>(dmChucNangInfor)));

            //CreateCommonCommand(Declare.StoreProcedureNamespace.spLoaiSanPhamInsert);
            //SetParams(dmChucNangInfor);
            //Parameters["@IdChucNang"].Direction = ParameterDirection.Output;
            //ExecuteNoneQuery();

            //return Convert.ToInt32(Parameters["@IdChucNang"].Value.ToString());
        }
コード例 #6
0
        internal bool Exist(DMLoaiSanPhamInfo dmChucNangInfor)
        {
            return(GetObjectCommand <int>(Declare.StoreProcedureNamespace.spLoaiSanPhamExist,
                                          dmChucNangInfor.IdLoaiSP,
                                          dmChucNangInfor.MaLoaiSP) > 0);

            //CreateCommonCommand(Declare.StoreProcedureNamespace.spLoaiSanPhamExist);
            //Parameters.AddWithValue("@Count", 0).Direction = ParameterDirection.Output;
            //Parameters.AddWithValue("@IdChucNang", dmChucNangInfor.IdLoaiSP);
            //Parameters.AddWithValue("@TenChucNang", dmChucNangInfor.MaLoaiSP);
            //ExecuteNoneQuery();

            //return Convert.ToInt32(Parameters["@Count"].Value) == 1;
        }
コード例 #7
0
        public void TestCauHinh03_MaCauHinhHasExistedOnUpdate()
        {
            try
            {
                TestLoaiSP05_InsertSuccess();
                List <DMLoaiSanPhamInfo> list  = DMLoaiSanPhamDataProvider.GetLoaiSPInfor();
                DMLoaiSanPhamInfo        infor = list.Find(delegate(DMLoaiSanPhamInfo match)
                {
                    return(match.MaLoaiSP == "13");
                });

                frmDM_LoaiSanPham frm = new frmDM_LoaiSanPham();
                frm.isAdd = false;
                frm.Oid   = infor.IdLoaiSP;

                frmChiTiet_LoaiSanPham frmChiTiet = new frmChiTiet_LoaiSanPham(frm);
                frmChiTiet.SetInput("Test1", "03", "Unit test ma du an", 1, 1);
                frmChiTiet.TestSave();
                list = DMLoaiSanPhamDataProvider.GetLoaiSPInfor();
                List <DMLoaiSanPhamInfo> listDuplicate = list.FindAll(delegate(DMLoaiSanPhamInfo match)
                {
                    return(match.MaLoaiSP == "03");
                });
                frmChiTiet.TestDelete();
                Assert.AreEqual(1, listDuplicate.Count);
            }
            catch (Exception ex)
            {
                if (ex.GetType() != typeof(AssertFailedException))
                {
                    Assert.AreEqual(ex.Message, "Mã đã tồn tại trong hệ thống!");
                }
                else
                {
                    throw;
                }
            }
        }
コード例 #8
0
        public void Insert()
        {
            if (_SpInfo == null)
            {
                _SpInfo = new DMLoaiSanPhamInfo();

                _SpInfo.MaLoaiSP  = View.MaLoaiSP;
                _SpInfo.TenLoaiSP = View.TenLoaiSP;
                _SpInfo.Nganh     = View.Nganh;
                _SpInfo.Chung     = View.Chung;
                _SpInfo.Loai      = View.Loai;
                _SpInfo.Hang      = View.Hang;
                _SpInfo.LinhVuc   = View.LinhVuc;
                _SpInfo.Nhom      = View.Nhom;
                _SpInfo.Model     = View.Model;
                _SpInfo.GhiChu    = View.MoTa;
                _SpInfo.NhomCha   = View.NhomCha;
                _SpInfo.SuDung    = View.SuDung;
                _SpInfo.IdLoaiSP  = DMLoaiSPDAO.Instance.Insert(_SpInfo);
                ((List <DMLoaiSanPhamInfo>)DSLoaiSanPhamView.Instance.DataSource).Add(_SpInfo);
                DSLoaiSanPhamView.Instance.RefreshDataSource();
            }
        }
コード例 #9
0
 private void GetData()
 {
     _SpInfo = View.SanPhamInfo;
 }