Пример #1
0
        /// <summary>
        /// 获取商品类目
        /// </summary>
        /// <returns></returns>
        public bool CheckGetGoodsCat()
        {
            //获取商品类目
            DataTable dt = Caches.GetGoodsCatList(M_Config.m_ConfigInfoID);

            try
            {
                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        DataView dv = dt.DefaultView;
                        dv.Sort = "mUpdateTime";
                        dt      = dv.ToTable();
                        if (DateTime.Now.Subtract(Convert.ToDateTime(dt.Rows[0]["m_UpdateTime"].ToString())).TotalDays >= 1)//一天获取一次
                        {
                            M_Utils.DeleteM_GoodsCatAll(M_Config.m_ConfigInfoID);
                            return(TopApiUtils.GetGoodsCatListAll(M_Config, 0));
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(TopApiUtils.GetGoodsCatListAll(M_Config, 0));
                    }
                }
                else
                {
                    return(true);
                }
            }
            finally {
                dt = null;
            }
        }