Exemple #1
0
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("8-1-1") || CheckUserPopedoms("8-1-2") || CheckUserPopedoms("8-1-3"))
                {
                    Act      = HTTPRequest.GetString("Act");
                    reformat = HTTPRequest.GetString("reformat");
                    if (Act == "download")
                    {
                        if (ispost)
                        {
                            M_Utils.DeleteM_GoodsCatAll(M_Config.m_ConfigInfoID);
                            if (TopApiUtils.GetGoodsCatListAll(M_Config, 0))
                            {
                                AddMsgLine("商品类目更新成功!");
                            }
                            else
                            {
                                AddErrLine("商品类目更新失败!");
                            }
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.parent.HidBox();");
                }
                if (reformat == "json")
                {
                    Response.ClearContent();
                    Response.Buffer          = true;
                    Response.ExpiresAbsolute = System.DateTime.Now.AddYears(-1);
                    Response.Expires         = 0;

                    Response.Charset         = "utf-8";
                    Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
                    Response.ContentType     = "application/json";
                    string Json_Str = "{\"results\": {\"msg\":\"" + this.msgbox_text + "\",\"state\":\"" + (!IsErr()).ToString() + "\"}}";
                    Response.Write(Json_Str);
                    Response.End();
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
        /// <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;
            }
        }