public bool UpdateBuyleadCount(int CategoryLevel, int CategoryID) { var svBuylead = new Buylead.BuyleadService(); if (CategoryLevel == 3) { var sqlWhere = svBuylead.CreateWhereAction(BuyleadAction.FrontEnd) + "AND CateLV3 = " + CategoryID; var count = CountData <Ouikum.view_BuyLead>(" * ", sqlWhere); var sqlUpdate = " BuyleadCount = " + count; sqlWhere = "CategoryLevel = 3 AND CategoryID = " + CategoryID; UpdateByCondition <b2bCategory>(sqlUpdate, sqlWhere); } else if (CategoryLevel == 2) { var sqlUpdate = " BuyleadCount = (Select SUM(BuyleadCount) from b2bCategory where ParentCategoryID = " + CategoryID + " ) "; var sqlWhere = " CategoryID = " + CategoryID; UpdateByCondition <b2bCategory>(sqlUpdate, sqlWhere); } else if (CategoryLevel == 1) { var sqlUpdate = " BuyleadCount = (Select SUM(BuyleadCount) from b2bCategory where ParentCategoryID = " + CategoryID + " ) "; var sqlWhere = " CategoryID = " + CategoryID; UpdateByCondition <b2bCategory>(sqlUpdate, sqlWhere); } return(IsResult); }
public bool UpdateBuyleadCount(int CompID) { var svBuylead = new Buylead.BuyleadService(); var sqlWhere = svBuylead.CreateWhereAction(BuyleadAction.FrontEnd, CompID); var count = CountData <view_BuyLead>(" * ", sqlWhere); var svCompany = new Company.CompanyService(); IsResult = svCompany.UpdateByCondition <b2bCompany>(" BuyLeadCount = " + count, "CompID = " + CompID); return(IsResult); }