/// <summary> /// Lấy thông tin chi tiết của sản phẩm cuốn thông qua SKU /// </summary> /// <param name="productSku"></param> /// <returns></returns> public BookProductDetails GetBookProductDetails(string productSku) { var parameters = new Dictionary <string, object>(); parameters.Add("SKU_SAN_PHAM", productSku); var productDetails = new BookProductDetails(); var tblKHO_SAN_PHAM = RestDbExecutor.ExecuteQuery("SELECT * FROM KHO_SAN_PHAM_SPC WHERE SKU_SAN_PHAM = @SKU_SAN_PHAM ORDER BY THU_TU ASC", parameters); var tblBIA = RestDbExecutor.ExecuteQuery("SELECT * FROM BIA_SPC WHERE SKU_SAN_PHAM = @SKU_SAN_PHAM ORDER BY THU_TU ASC", parameters); var tblDONG_CUON = RestDbExecutor.ExecuteQuery("SELECT * FROM DONG_CUON_SPC WHERE SKU_SAN_PHAM = @SKU_SAN_PHAM ORDER BY THU_TU ASC", parameters); var tblSO_LUONG_CUON = RestDbExecutor.ExecuteQuery("SELECT * FROM SO_LUONG_CUON_SPC WHERE SKU_SAN_PHAM = @SKU_SAN_PHAM ORDER BY THU_TU ASC", parameters); var tblRUOT = RestDbExecutor.ExecuteQuery("SELECT * FROM RUOT_SPC WHERE SKU_SAN_PHAM = @SKU_SAN_PHAM ORDER BY THU_TU ASC", parameters); var tblGIAY_IN_RUOT = RestDbExecutor.ExecuteQuery("SELECT * FROM GIAY_IN_RUOT_SPC WHERE SKU_SAN_PHAM = @SKU_SAN_PHAM ORDER BY THU_TU ASC", parameters); var tblTHOI_GIAN_GIAO = RestDbExecutor.ExecuteQuery("SELECT * FROM THOI_GIAN_GIAO_SPC WHERE SKU_SAN_PHAM = @SKU_SAN_PHAM ORDER BY THU_TU ASC", parameters); productDetails.DANH_SACH_KHO_SAN_PHAM = new List <KHO_SAN_PHAM_SPC>(); foreach (DataRow row in tblKHO_SAN_PHAM.Rows) { productDetails.DANH_SACH_KHO_SAN_PHAM.Add(new KHO_SAN_PHAM_SPC { ID = (long)row["ID"], TEN_KHO = (string)row["TEN_KHO"], THU_TU = (long)row["THU_TU"], SKU_SAN_PHAM = (string)row["SKU_SAN_PHAM"] }); } productDetails.DANH_SACH_BIA = new List <BIA_SPC>(); foreach (DataRow row in tblBIA.Rows) { productDetails.DANH_SACH_BIA.Add(new BIA_SPC { ID = (long)row["ID"], TEN_BIA = (string)row["TEN_BIA"], THU_TU = (long)row["THU_TU"], SKU_SAN_PHAM = (string)row["SKU_SAN_PHAM"] }); } productDetails.DANH_SACH_DONG_CUON = new List <DONG_CUON_SPC>(); foreach (DataRow row in tblDONG_CUON.Rows) { productDetails.DANH_SACH_DONG_CUON.Add(new DONG_CUON_SPC { ID = (long)row["ID"], TEN_DONG_CUON = (string)row["TEN_DONG_CUON"], THU_TU = (long)row["THU_TU"], SKU_SAN_PHAM = (string)row["SKU_SAN_PHAM"] }); } productDetails.DANH_SACH_SO_LUONG_CUON = new List <SO_LUONG_CUON_SPC>(); foreach (DataRow row in tblSO_LUONG_CUON.Rows) { productDetails.DANH_SACH_SO_LUONG_CUON.Add(new SO_LUONG_CUON_SPC { ID = (long)row["ID"], TEN_SO_LUONG = (string)row["TEN_SO_LUONG"], THU_TU = (long)row["THU_TU"], SKU_SAN_PHAM = (string)row["SKU_SAN_PHAM"] }); } productDetails.DANH_SACH_RUOT = new List <RUOT_SPC>(); foreach (DataRow row in tblRUOT.Rows) { productDetails.DANH_SACH_RUOT.Add(new RUOT_SPC { ID = (long)row["ID"], TEN_RUOT = (string)row["TEN_RUOT"], THU_TU = (long)row["THU_TU"], SKU_SAN_PHAM = (string)row["SKU_SAN_PHAM"] }); } productDetails.DANH_SACH_GIAY_IN_RUOT = new List <GIAY_IN_RUOT_SPC>(); foreach (DataRow row in tblGIAY_IN_RUOT.Rows) { productDetails.DANH_SACH_GIAY_IN_RUOT.Add(new GIAY_IN_RUOT_SPC { ID = (long)row["ID"], TEN_GIAY_IN = (string)row["TEN_GIAY_IN"], THU_TU = (long)row["THU_TU"], SKU_SAN_PHAM = (string)row["SKU_SAN_PHAM"] }); } productDetails.DANH_SACH_THOI_GIAN_GIAO = new List <THOI_GIAN_GIAO_SPC>(); foreach (DataRow row in tblTHOI_GIAN_GIAO.Rows) { productDetails.DANH_SACH_THOI_GIAN_GIAO.Add(new THOI_GIAN_GIAO_SPC { ID = (long)row["ID"], TEN_THOI_GIAN_GIAO = (string)row["TEN_THOI_GIAN_GIAO"], THU_TU = (long)row["THU_TU"], SKU_SAN_PHAM = (string)row["SKU_SAN_PHAM"] }); } return(productDetails); }
/// <summary> /// Lấy thông tin chi tiết của sản phẩm phẳng thông qua SKU /// </summary> /// <param name="productSku"></param> /// <returns></returns> public FlatProductDetails GetFlatProductDetails(string productSku) { var parameters = new Dictionary <string, object>(); parameters.Add("SKU_SAN_PHAM", productSku); var productDetails = new FlatProductDetails(); var tblKHO_SAN_PHAM = RestDbExecutor.ExecuteQuery("SELECT * FROM KHO_SAN_PHAM_SPP WHERE SKU_SAN_PHAM = @SKU_SAN_PHAM ORDER BY THU_TU ASC", parameters); var tblSO_LUONG_THANH_PHAM = RestDbExecutor.ExecuteQuery("SELECT * FROM SO_LUONG_THANH_PHAM_SPP WHERE SKU_SAN_PHAM = @SKU_SAN_PHAM ORDER BY THU_TU ASC", parameters); var tblCACH_IN = RestDbExecutor.ExecuteQuery("SELECT * FROM CACH_IN_SPP WHERE SKU_SAN_PHAM = @SKU_SAN_PHAM ORDER BY THU_TU ASC", parameters); var tblGIAY_IN = RestDbExecutor.ExecuteQuery("SELECT * FROM GIAY_IN_SPP WHERE SKU_SAN_PHAM = @SKU_SAN_PHAM ORDER BY THU_TU ASC", parameters); var tblNHOM_THANH_PHAM = RestDbExecutor.ExecuteQuery("SELECT * FROM NHOM_THANH_PHAM_SPP WHERE SKU_SAN_PHAM = @SKU_SAN_PHAM ORDER BY THU_TU ASC", parameters); var tblTHOI_GIAN_GIAO = RestDbExecutor.ExecuteQuery("SELECT * FROM THOI_GIAN_GIAO_SPP WHERE SKU_SAN_PHAM = @SKU_SAN_PHAM ORDER BY THU_TU ASC", parameters); productDetails.DANH_SACH_KHO_SAN_PHAM = new List <KHO_SAN_PHAM_SPP>(); foreach (DataRow row in tblKHO_SAN_PHAM.Rows) { productDetails.DANH_SACH_KHO_SAN_PHAM.Add(new KHO_SAN_PHAM_SPP { ID = (long)row["ID"], TEN_KHO = (string)row["TEN_KHO"], THU_TU = (long)row["THU_TU"], SKU_SAN_PHAM = (string)row["SKU_SAN_PHAM"] }); } productDetails.DANH_SACH_SO_LUONG_THANH_PHAM = new List <SO_LUONG_THANH_PHAM_SPP>(); foreach (DataRow row in tblSO_LUONG_THANH_PHAM.Rows) { productDetails.DANH_SACH_SO_LUONG_THANH_PHAM.Add(new SO_LUONG_THANH_PHAM_SPP { ID = (long)row["ID"], TEN_SO_LUONG = (string)row["TEN_SO_LUONG"], THU_TU = (long)row["THU_TU"], SKU_SAN_PHAM = (string)row["SKU_SAN_PHAM"] }); } productDetails.DANH_SACH_CACH_IN = new List <CACH_IN_SPP>(); foreach (DataRow row in tblCACH_IN.Rows) { productDetails.DANH_SACH_CACH_IN.Add(new CACH_IN_SPP { ID = (long)row["ID"], TEN_CACH_IN = (string)row["TEN_CACH_IN"], THU_TU = (long)row["THU_TU"], SKU_SAN_PHAM = (string)row["SKU_SAN_PHAM"] }); } productDetails.DANH_SACH_GIAY_IN = new List <GIAY_IN_SPP>(); foreach (DataRow row in tblGIAY_IN.Rows) { productDetails.DANH_SACH_GIAY_IN.Add(new GIAY_IN_SPP { ID = (long)row["ID"], TEN_GIAY_IN = (string)row["TEN_GIAY_IN"], THU_TU = (long)row["THU_TU"], SKU_SAN_PHAM = (string)row["SKU_SAN_PHAM"] }); } productDetails.DANH_SACH_NHOM_THANH_PHAM = new List <NHOM_THANH_PHAM_SPP>(); foreach (DataRow row in tblNHOM_THANH_PHAM.Rows) { var NHOM_THANH_PHAM = new NHOM_THANH_PHAM_SPP { ID = (long)row["ID"], TEN_NHOM = (string)row["TEN_NHOM"], THU_TU = (long)row["THU_TU"], SKU_SAN_PHAM = (string)row["SKU_SAN_PHAM"] }; var tblTHANH_PHAM = RestDbExecutor.ExecuteQuery("SELECT * FROM THANH_PHAM_SPP WHERE ID_NHOM_THANH_PHAM = " + NHOM_THANH_PHAM.ID + " ORDER BY THU_TU ASC ", null); NHOM_THANH_PHAM.DANH_SACH_THANH_PHAM = new List <THANH_PHAM_SPP>(); foreach (DataRow rowTHANH_PHAM in tblTHANH_PHAM.Rows) { NHOM_THANH_PHAM.DANH_SACH_THANH_PHAM.Add(new THANH_PHAM_SPP { ID = (long)rowTHANH_PHAM["ID"], TEN_THANH_PHAM = (string)rowTHANH_PHAM["TEN_THANH_PHAM"], THU_TU = (long)rowTHANH_PHAM["THU_TU"], ID_NHOM_THANH_PHAM = (long)rowTHANH_PHAM["ID_NHOM_THANH_PHAM"] }); } productDetails.DANH_SACH_NHOM_THANH_PHAM.Add(NHOM_THANH_PHAM); } productDetails.DANH_SACH_THOI_GIAN_GIAO = new List <THOI_GIAN_GIAO_SPP>(); foreach (DataRow row in tblTHOI_GIAN_GIAO.Rows) { productDetails.DANH_SACH_THOI_GIAN_GIAO.Add(new THOI_GIAN_GIAO_SPP { ID = (long)row["ID"], TEN_THOI_GIAN_GIAO = (string)row["TEN_THOI_GIAN_GIAO"], THU_TU = (long)row["THU_TU"], SKU_SAN_PHAM = (string)row["SKU_SAN_PHAM"] }); } return(productDetails); }