Beispiel #1
0
        public void Them(BaiInBDO entityBDO)
        {
            using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(GlobalConfig.CnnString(tenDB)))
            {
                var p = new DynamicParameters(); //Của dapper

                p.Add("@TenBaiIn", entityBDO.TenBaiIn);
                p.Add("@DienGiaiIn", entityBDO.DienGiaiIn);
                p.Add("@NguoiLamFile", entityBDO.NguoiLamFile);
                p.Add("@IdMayIn", entityBDO.IdMayIn);
                p.Add("@TenMayIn", entityBDO.TenMayIn);
                p.Add("@TenGiayIn", entityBDO.TenGiayIn);
                p.Add("@ToChayRong", entityBDO.TinhTrangBaiIn);
                p.Add("@ToChayDai", entityBDO.ToChayDai);
                p.Add("@SoLuongToChayCanIn", entityBDO.SoLuongToChayCanIn);
                p.Add("@SoLuongToChayBuHao", entityBDO.SoLuongToChayBuHao);
                p.Add("@SoMatIn", entityBDO.SoMatIn);
                p.Add("@MauIn", entityBDO.MauIn);
                p.Add("@SoClickCanIn", entityBDO.SoClickCanIn);
                p.Add("@DonViTinhClick", entityBDO.DonViTinhClick);
                p.Add("@MucUuTien", entityBDO.MucUuTien);
                p.Add("@DuongDanFileIn", entityBDO.DuongDanFileIn);
                p.Add("@DuongDanFileKhachHang", entityBDO.DuongDanFileKhachHang);
                p.Add("@TinhTrangBaiIn", entityBDO.TinhTrangBaiIn);
                p.Add("@IdBaiSanPham", entityBDO.IdBaiSanPham);
                p.Add("@ThoiHanInXong", entityBDO.ThoiHanInXong);
                p.Add("@id", dbType: DbType.Int32, direction: ParameterDirection.Output);
                //Excecute
                connection.Execute("dbo.spBaiIn_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 #2
0
        public void Sua(BaiInBDO 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("@TenBaiIn", entityBDO.TenBaiIn);
                p.Add("@DienGiaiIn", entityBDO.DienGiaiIn);
                p.Add("@NguoiLamFile", entityBDO.NguoiLamFile);
                p.Add("@IdMayIn", entityBDO.IdMayIn);
                p.Add("@TenMayIn", entityBDO.TenMayIn);
                p.Add("@TenGiayIn", entityBDO.TenGiayIn);
                p.Add("@ToChayRong", entityBDO.TinhTrangBaiIn);
                p.Add("@ToChayDai", entityBDO.ToChayDai);
                p.Add("@SoLuongToChayCanIn", entityBDO.SoLuongToChayCanIn);
                p.Add("@SoLuongToChayBuHao", entityBDO.SoLuongToChayBuHao);
                p.Add("@SoMatIn", entityBDO.SoMatIn);
                p.Add("@MauIn", entityBDO.MauIn);
                p.Add("@SoClickCanIn", entityBDO.SoClickCanIn);
                p.Add("@DonViTinhClick", entityBDO.DonViTinhClick);
                p.Add("@MucUuTien", entityBDO.MucUuTien);
                p.Add("@DuongDanFileIn", entityBDO.DuongDanFileIn);
                p.Add("@DuongDanFileKhachHang", entityBDO.DuongDanFileKhachHang);
                p.Add("@TinhTrangBaiIn", entityBDO.TinhTrangBaiIn);
                p.Add("@IdBaiSanPham", entityBDO.IdBaiSanPham);
                p.Add("@ThoiHanInXong", entityBDO.ThoiHanInXong);

                //Excecute
                connection.Execute("dbo.spBaiIn_SuaTheoId", p, commandType: CommandType.StoredProcedure);
            }
        }
Beispiel #3
0
 public void Sua(BaiInBDO mayIn)
 {
     dataDAO.Sua(mayIn);
 }
Beispiel #4
0
 public void Them(BaiInBDO mayIn)
 {
     dataDAO.Them(mayIn);
 }