Пример #1
0
 /// <summary>
 /// 过滤不插入的SKU
 /// </summary>
 /// <param name="shopid"></param>
 /// <param name="table"></param>
 /// <returns></returns>
 public DataTable HasGSKU(int shopid, DataTable table)
 {
     try
     {
         List <GSKU>   GSKUlist = CommService.GetGSKUListByshopID(shopid);
         GSKU[]        str      = GSKUlist.ToArray();
         List <string> skulist  = new List <string>(); //取出所有的需要过滤的SKU GetCSVcolByshopID
         foreach (var item in str)
         {
             skulist.Add(item.gsku);
         }
         string csvcol = CommService.GetCSVcolByshopID(shopid);//取出每个店铺SKU存储列
         //csvcol.Replace("\"","");
         for (int i = 0; i < table.Rows.Count; i++)
         {
             if (skulist.Contains(table.Rows[i][csvcol].ToString()))
             {
                 table.Rows.Remove(table.Rows[i]);
             }
         }
         return(table);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }