public ActionResult ShowSupplierDetail(int supplierId) { var supplierDetailModel = new SupplierDetailModel(); try { supplierDetailModel = supplierBLL.GetSupplierDetailInfo(supplierId); } catch (Exception ext) { LogHelper.Error(ext); } return(View(supplierDetailModel)); }
public SupplierDetailModel GetSupplierDetailInfo(int supplierId) { const string sql = @" WITH SN AS ( SELECT pin.SupplierId,COUNT(1) AS SkuNumber FROM SkuInfo(NOLOCK) si INNER JOIN ProductInfo(NOLOCK) pin ON si.SpuId = pin.id AND pin.LanguageVersion=2 LEFT JOIN Stock(NOLOCK) t ON t.Sku=si.Sku WHERE pin.SupplierId=@SupplierID AND t.ForOrderQty >0 and [Status]=3 GROUP BY pin.SupplierId ) SELECT s.*,sn.SkuNumber,ss.StoreLogoPath FROM Supplier(NOLOCK) AS s LEFT JOIN SN ON sn.SupplierId = s.SupplierID INNER JOIN SupplierStore(NOLOCK) AS ss ON ss.SupplierID = s.SupplierID WHERE s.SupplierID=@SupplierID SELECT * FROM SupplierBrand(NOLOCK) WHERE SupplierID=@SupplierID"; var db = DbSFO2ORead; var parameters = db.CreateParameterCollection(); parameters.Append("@SupplierID", supplierId); var ds = db.ExecuteDataSet(CommandType.Text, sql, parameters); var sd = new SupplierDetailModel(); if (ds != null && ds.Tables != null && ds.Tables.Count > 0) { sd.Supplier = DataMapHelper.DataTableToObject <SupplierModel>(ds.Tables[0]); if (ds.Tables[1] != null && ds.Tables[1].Rows != null && ds.Tables[1].Rows.Count > 0) { sd.Brands = DataMapHelper.DataTableToList <BrandModel>(ds.Tables[1]).ToList(); } } return(sd); }
public ActionResult EditSupplier(int supplierId = 0) { var supplierDetail = new SupplierDetailModel(); try { if (supplierId > 0) { supplierDetail = supplierBLL.GetSupplierDetailInfo(supplierId); if (supplierDetail != null && supplierDetail.Supplier != null) { supplierDetail.Supplier.ImgPath = supplierDetail.Supplier.StoreLogoPath; supplierDetail.Supplier.StoreLogoPath = (ConfigHelper.ImageServer + supplierDetail.Supplier.StoreLogoPath).Replace("\\", "//"); } } } catch (Exception ext) { LogHelper.Error(ext); } return(View(supplierDetail)); }