Beispiel #1
0
 public void ChuyenObjectBDOThanhObjectDTO(BaiSanPhamBDO objBDO, BaiSanPhamModel objDTO)
 {
     Mapper.Initialize(cfg => cfg.AddProfile <BaiSanPhamBDOBaiSanPhamModelProfile>());
     //Khác null 2 cái tạo liền
     if (objBDO != null && objDTO != null)
     {
         objDTO = Mapper.Map <BaiSanPhamModel>(objBDO);
     }
 }
Beispiel #2
0
        public void Sua(BaiSanPhamBDO entityBDO)
        {
            using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(GlobalConfig.CnnString(tenDB)))
            {
                var p = new DynamicParameters(); //Của dapper

                p.Add("@id", entityBDO.Id);
                p.Add("@SoDonHang", entityBDO.SoDonHang);
                p.Add("@TenSanPham", entityBDO.TenSanPham);
                p.Add("@YeuCau", entityBDO.YeuCau);
                p.Add("@DuongDanFile01", entityBDO.DuongDanFile01);
                p.Add("@DuongDanFile02", entityBDO.DuongDanFile02);
                p.Add("@DuongDanFile03", entityBDO.DuongDanFile03);
                p.Add("@TinhTrangBaiSanPham", entityBDO.TinhTrangBaiSanPham);
                p.Add("@ThoiHan", entityBDO.ThoiHan);

                //Excecute
                connection.Execute("dbo.spBaiSanPham_SuaTheoId", p, commandType: CommandType.StoredProcedure);
            }
        }
Beispiel #3
0
        public void Them(BaiSanPhamBDO entityBDO)
        {
            using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(GlobalConfig.CnnString(tenDB)))
            {
                var p = new DynamicParameters(); //Của dapper

                p.Add("@SoDonHang", entityBDO.SoDonHang);
                p.Add("@TenSanPham", entityBDO.TenSanPham);
                p.Add("@YeuCau", entityBDO.YeuCau);
                p.Add("@DuongDanFile01", entityBDO.DuongDanFile01);
                p.Add("@DuongDanFile02", entityBDO.DuongDanFile02);
                p.Add("@DuongDanFile03", entityBDO.DuongDanFile03);
                p.Add("@TinhTrangBaiSanPham", entityBDO.TinhTrangBaiSanPham);
                p.Add("@ThoiHan", entityBDO.ThoiHan);
                p.Add("@id", dbType: DbType.Int32, direction: ParameterDirection.Output);
                //Excecute
                connection.Execute("dbo.spBaiSanPham_Them", p, commandType: CommandType.StoredProcedure);
                //xử lý id out
                entityBDO.Id = p.Get <int>("@id");
                ///nếu cần có thể
                ///đặt return ở đay cũng được
            }
        }
Beispiel #4
0
 public void Sua(BaiSanPhamBDO baiSP)
 {
     dataDAO.Sua(baiSP);
 }
Beispiel #5
0
 public void Them(BaiSanPhamBDO baiSP)
 {
     dataDAO.Them(baiSP);
 }