Exemplo n.º 1
0
 private void btnOrder_Click(object sender, System.EventArgs e)
 {
     for (int i = 0; i < this.rptList.Items.Count; i++)
     {
         int num = 0;
         System.Web.UI.WebControls.TextBox textBox = (System.Web.UI.WebControls.TextBox) this.rptList.Items[i].FindControl("txtSequence");
         if (int.TryParse(textBox.Text.Trim(), out num))
         {
             int          categoryId = Globals.ToNum(((System.Web.UI.WebControls.HiddenField) this.rptList.Items[i].FindControl("hdfCategoryID")).Value);
             CategoryInfo category   = CatalogHelper.GetCategory(categoryId);
             if (category.DisplaySequence != num)
             {
                 CatalogHelper.SwapCategorySequence(categoryId, num);
             }
         }
     }
     HiCache.Remove("DataCache-Categories");
     HiCache.Remove("DataCache-CategoryList");
     this.BindData();
     this.ShowMsg("排序保存成功", true);
 }
Exemplo n.º 2
0
 private void btnSaveCategory_Click(object sender, System.EventArgs e)
 {
     if (!this.dropCategoryFrom.SelectedValue.HasValue || !this.dropCategoryTo.SelectedValue.HasValue)
     {
         this.ShowMsgToTarget("请选择需要转移商品的分类或需要转移至的商品分类!", false, "parent");
         return;
     }
     if (this.dropCategoryFrom.SelectedValue.Value == this.dropCategoryTo.SelectedValue.Value)
     {
         this.ShowMsgToTarget("请选择不同的商品分类进行转移!", false, "parent");
         return;
     }
     if (CatalogHelper.DisplaceCategory(this.dropCategoryFrom.SelectedValue.Value, this.dropCategoryTo.SelectedValue.Value) == 0)
     {
         this.ShowMsgToTarget("此分类下没有可以转移的商品!", false, "parent");
         return;
     }
     HiCache.Remove("DataCache-Categories");
     HiCache.Remove("DataCache-CategoryList");
     this.ShowMsgToTarget("商品批量转移成功!", true, "parent");
 }
Exemplo n.º 3
0
        public static bool DeleteCategory(int categoryId)
        {
            ManagerHelper.CheckPrivilege(Privilege.DeleteProductCategory);
            CategoryInfo category = CatalogHelper.GetCategory(categoryId);

            if (category == null)
            {
                return(false);
            }
            bool flag = new CategoryDao().DeleteCategory(categoryId, category.Path);

            if (flag)
            {
                EventLogs.WriteOperationLog(Privilege.DeleteProductCategory, string.Format(CultureInfo.InvariantCulture, "删除了编号为 “{0}” 的店铺分类", new object[1]
                {
                    categoryId
                }), false);
                HiCache.Remove("DataCache-Categories");
            }
            return(flag);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 控件事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void dtManageThemes_ItemCommand(object sender, DataListCommandEventArgs e)
        {
            if (((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) && (e.CommandName == "btnUse"))
            {
                SiteSettings siteSettings = SettingsManager.GetSiteSettings(HiContext.Current.User.UserId);

                DisplayThemesImages images = (DisplayThemesImages)e.Item.FindControl("themeImg");

                siteSettings.Theme = images.ThemeName;

                SettingsManager.Save(siteSettings);

                HiCache.Remove(string.Format("AdsFileCache-{0}", HiContext.Current.User.UserId));
                HiCache.Remove(string.Format("ArticleSubjectFileCache-{0}", HiContext.Current.User.UserId));
                HiCache.Remove(string.Format("ProductSubjectFileCache-{0}", HiContext.Current.User.UserId));

                GetThemes(images.ThemeName);

                ShowMsg("成功修改了店铺模板", true);
            }
        }
Exemplo n.º 5
0
        private void InsertAdvPosition(AdvPositionInfo advPosition)
        {
            Globals.EntityCoding(advPosition, true);
            string      filename = HttpContext.Current.Request.MapPath(Globals.ApplicationPath + string.Format("/Templates/master/{0}/AdvPositions.xml", themName));
            XmlDocument document = new XmlDocument();

            document.Load(filename);
            XmlNode    node     = document.SelectSingleNode("root");
            XmlElement newChild = document.CreateElement("AdvPositions");
            XmlElement element2 = document.CreateElement("AdvPositionName");

            element2.InnerText = advPosition.AdvPositionName;
            newChild.AppendChild(element2);
            XmlElement element3 = document.CreateElement("AdvHtml");

            element3.InnerText = advPosition.AdvHtml;
            newChild.AppendChild(element3);
            node.AppendChild(newChild);
            document.Save(filename);
            HiCache.Remove("AdsFileCache-Admin");
        }
Exemplo n.º 6
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            XmlDocument xmlNode = this.GetXmlNode();

            if (this.RadDefault.Checked || string.IsNullOrWhiteSpace(this.fmSrc.Value))
            {
                xmlNode.SelectSingleNode("root/DefaultBg").InnerText = Globals.GetVshopSkinPath(this.vTheme) + "/images/ad/imgDefaultBg.jpg";
            }
            else
            {
                xmlNode.SelectSingleNode("root/DefaultBg").InnerText = this.fmSrc.Value;
            }
            xmlNode.SelectSingleNode("root/TopicProductMaxNum").InnerText = this.txtTopicProductMaxNum.Text;
            xmlNode.SelectSingleNode("root/MarketPrice").InnerText        = this.txtMarketPrice.Text;
            xmlNode.SelectSingleNode("root/SalePrice").InnerText          = this.txtSalePrice.Text;
            xmlNode.SelectSingleNode("root/Phone").InnerText    = this.txtPhone.Text;
            xmlNode.SelectSingleNode("root/Navigate").InnerText = this.txtNavigate.Text;
            xmlNode.Save(this.path);
            HiCache.Remove("TemplateFileCache");
            base.Response.Redirect("ManageVthemes.aspx");
        }
Exemplo n.º 7
0
        public static CategoryActionStatus AddCategory(CategoryInfo category)
        {
            CategoryActionStatus categoryActionStatu;

            if (null != category)
            {
                Globals.EntityCoding(category, true);
                if ((new CategoryDao()).CreateCategory(category) > 0)
                {
                    CultureInfo invariantCulture = CultureInfo.InvariantCulture;
                    object[]    name             = new object[] { category.Name };
                    EventLogs.WriteOperationLog(Privilege.AddProductCategory, string.Format(invariantCulture, "创建了一个新的店铺分类:”{0}”", name));
                    HiCache.Remove("DataCache-Categories");
                }
                categoryActionStatu = CategoryActionStatus.Success;
            }
            else
            {
                categoryActionStatu = CategoryActionStatus.UnknowError;
            }
            return(categoryActionStatu);
        }
Exemplo n.º 8
0
        public bool CheckVerifyCode(string verifyCode, string openId = "")
        {
            if (!string.IsNullOrEmpty(openId))
            {
                string text = HiCache.Get(openId).ToNullString();
                if (string.IsNullOrEmpty(text) && DataHelper.IsMobile(openId))
                {
                    text = HiCache.Get($"DataCache-PhoneCode-{openId}").ToNullString();
                }
                if (string.IsNullOrEmpty(text) && DataHelper.IsEmail(openId))
                {
                    text = HiCache.Get($"DataCache-EmailCode-{openId}").ToNullString();
                }
                if (!string.IsNullOrEmpty(text))
                {
                    bool flag = string.Compare(HiCryptographer.Decrypt(text), verifyCode, true, CultureInfo.InvariantCulture) == 0;
                    if (flag)
                    {
                        HiCache.Remove($"DataCache-PhoneCode-{openId}");
                        HiCache.Remove($"DataCache-EmailCode-{openId}");
                        HiCache.Remove(openId);
                    }
                    return(flag);
                }
            }
            HttpCookie httpCookie = HiContext.Current.Context.Request.Cookies["VerifyCookie"];
            string     text2      = string.Empty;

            if (httpCookie != null)
            {
                text2 = httpCookie.Value;
            }
            if (!string.IsNullOrEmpty(text2))
            {
                text2 = HiCryptographer.Decrypt(text2);
                return(string.Compare(text2, verifyCode, true, CultureInfo.InvariantCulture) == 0);
            }
            return(false);
        }
Exemplo n.º 9
0
        public bool EnableTemp(string TempName, string wid)
        {
            if (string.IsNullOrEmpty(TempName))
            {
                return(false);
            }
            //SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
            //masterSettings.VTheme = TempName;
            //SettingsManager.Save(masterSettings);

            Chenduo.BLL.sf_website   bll     = new Chenduo.BLL.sf_website();
            Chenduo.Model.sf_website website = bll.GetModelByWid(wid);
            if (website == null)
            {
                return(false);
            }
            website.templatesNum = TempName;
            bll.Update(website);

            HiCache.Remove("TemplateFileCache");
            return(true);
        }
Exemplo n.º 10
0
        public static int DeleteAffiches(List <int> affiches)
        {
            if (affiches == null || affiches.Count == 0)
            {
                return(0);
            }
            AfficheDao afficheDao = new AfficheDao();
            int        num        = 0;

            foreach (int affich in affiches)
            {
                if (afficheDao.Delete <AfficheInfo>(affich))
                {
                    num++;
                }
            }
            if (num > 0)
            {
                HiCache.Remove("DataCache-Affiches");
            }
            return(num);
        }
Exemplo n.º 11
0
        protected void dtManageThemes_ItemCommand(object sender, DataListCommandEventArgs e)
        {
            if (((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) && (e.CommandName == "btnUse"))
            {
                string currentThemeName = dtManageThemes.DataKeys[e.Item.ItemIndex].ToString();

                string srcPath = Page.Request.MapPath(Globals.ApplicationPath + "/Templates/library/") + currentThemeName;

                string path = Page.Request.MapPath(Globals.ApplicationPath + "/Templates/master/") + currentThemeName;

                if (!Directory.Exists(path))
                {
                    try
                    {
                        CopyDir(srcPath, path);
                    }
                    catch
                    {
                        ShowMsg("修改店铺模板失败", false);
                    }
                }
                SiteSettings siteSettings = HiContext.Current.SiteSettings;

                siteSettings.Theme = currentThemeName;

                SettingsManager.Save(siteSettings);

                HiCache.Remove("AdsFileCache-Admin");

                HiCache.Remove("ProductSubjectFileCache-Admin");

                HiCache.Remove("ArticleSubjectFileCache-Admin");

                ShowMsg("成功修改了店铺模板", true);

                GetThemes(currentThemeName);
            }
        }
Exemplo n.º 12
0
        public static bool AddCategory(CategoryInfo category)
        {
            if (category == null)
            {
                return(false);
            }
            CategoryDao categoryDao = new CategoryDao();

            category.CategoryId = categoryDao.GetMaxDisplaySequence <CategoryInfo>();
            int categoryId;

            if (category.ParentCategoryId > 0)
            {
                CategoryInfo category2 = CatalogHelper.GetCategory(category.ParentCategoryId);
                string       path      = category2.Path;
                categoryId     = category.CategoryId;
                category.Path  = path + "|" + categoryId.ToString();
                category.Depth = category2.Depth + 1;
            }
            else
            {
                categoryId     = category.CategoryId;
                category.Path  = categoryId.ToString();
                category.Depth = 1;
            }
            Globals.EntityCoding(category, true);
            bool flag = categoryDao.Add(category, null) > 0;

            if (flag)
            {
                EventLogs.WriteOperationLog(Privilege.AddProductCategory, string.Format(CultureInfo.InvariantCulture, "创建了一个新的店铺分类:”{0}”", new object[1]
                {
                    category.Name
                }), false);
                HiCache.Remove("DataCache-Categories");
            }
            return(flag);
        }
Exemplo n.º 13
0
        public static CategoryActionStatus UpdateCategory(CategoryInfo category)
        {
            CategoryActionStatus categoryActionStatu;

            if (null != category)
            {
                Globals.EntityCoding(category, true);
                CategoryActionStatus categoryActionStatu1 = (new CategoryDao()).UpdateCategory(category);
                if (categoryActionStatu1 == CategoryActionStatus.Success)
                {
                    CultureInfo invariantCulture = CultureInfo.InvariantCulture;
                    object[]    categoryId       = new object[] { category.CategoryId };
                    EventLogs.WriteOperationLog(Privilege.EditProductCategory, string.Format(invariantCulture, "修改了编号为 “{0}” 的店铺分类", categoryId));
                    HiCache.Remove("DataCache-Categories");
                }
                categoryActionStatu = categoryActionStatu1;
            }
            else
            {
                categoryActionStatu = CategoryActionStatus.UnknowError;
            }
            return(categoryActionStatu);
        }
Exemplo n.º 14
0
        public static Hidistro.Entities.Store.RegionInfo GetRegion(int regionId, bool containDel = true)
        {
            IList <Hidistro.Entities.Store.RegionInfo> allRegions = RegionHelper.GetAllRegions();

            Hidistro.Entities.Store.RegionInfo regionInfo = null;
            try
            {
                regionInfo = ((!containDel) ? (from r in allRegions
                                               where r.RegionId == regionId && !r.IsDel
                                               select r).First() : (from r in allRegions
                                                                    where r.RegionId == regionId
                                                                    select r).First());
            }
            catch
            {
            }
            if (regionInfo == null)
            {
                regionInfo = new RegionDao().Get <Hidistro.Entities.Store.RegionInfo>(regionId);
                if (regionInfo != null && regionInfo.Depth == 4)
                {
                    Hidistro.Entities.Store.RegionInfo region = RegionHelper.GetRegion(regionInfo.ParentRegionId, true);
                    if (region != null)
                    {
                        IList <Hidistro.Entities.Store.RegionInfo> streetsOfCity = new RegionDao().GetStreetsOfCity(region.ParentRegionId, containDel);
                        if (streetsOfCity != null && streetsOfCity.Count > 0)
                        {
                            IList <Hidistro.Entities.Store.RegionInfo> allRegions2 = RegionHelper.GetAllRegions();
                            allRegions2 = allRegions2.Concat(streetsOfCity).ToList();
                            HiCache.Remove("FileCache-Regions");
                            HiCache.Insert("FileCache-Regions", allRegions2);
                        }
                    }
                }
            }
            return(regionInfo);
        }
Exemplo n.º 15
0
        public void GetAdminOpenId(HttpContext context)
        {
            string text = "";
            string str  = "";

            if (HiContext.Current.Manager != null)
            {
                str = HiContext.Current.Manager.ManagerId.ToString();
            }
            HttpContext.Current.Response.Clear();
            int num  = 0;
            int num2 = 0;

            while (num != 1)
            {
                num2++;
                Thread.Sleep(1000);
                text = ((HiCache.Get(str + "_OpenId") == null) ? "" : HiCache.Get(str + "_OpenId").ToString());
                num  = ((!string.IsNullOrEmpty(text)) ? 1 : 0);
                if (num2 == 25)
                {
                    break;
                }
            }
            StringBuilder stringBuilder = new StringBuilder("{");

            stringBuilder.AppendFormat("\"Status\":\"{0}\",", num);
            stringBuilder.AppendFormat("\"OpenId\":\"{0}\"", text);
            stringBuilder.Append("}");
            if (num == 1)
            {
                HiCache.Remove(str + "_OpenId");
            }
            HttpContext.Current.Response.ContentType = "application/json";
            HttpContext.Current.Response.Write(stringBuilder.ToString());
            HttpContext.Current.Response.End();
        }
Exemplo n.º 16
0
        private void btnSaveSubject_Click(object sender, EventArgs e)
        {
            string str = string.Empty;

            if (string.IsNullOrEmpty(txtSubjectName.Text) || (txtSubjectName.Text.Length > 30))
            {
                str = str + Formatter.FormatErrorMessage("主题名称不能为空,限制在30个字符以内");
            }
            string str2 = string.Empty;
            string str3 = string.Empty;

            if (listArticleCategories.SelectedValue.Count > 0)
            {
                foreach (int num in listArticleCategories.SelectedValue)
                {
                    str2 = str2 + num + ",";
                    str3 = str3 + listArticleCategories.Items.FindByValue(num.ToString()).Text.Trim() + ",";
                }
                str2 = str2.Substring(0, str2.Length - 1);
                str3 = str3.Substring(0, str3.Length - 1);
            }
            string      filename = HttpContext.Current.Request.MapPath(Globals.ApplicationPath + string.Format("/Templates/master/{0}/ArticleSubjects.xml", themName));
            XmlDocument document = new XmlDocument();

            document.Load(filename);
            XmlNode entity = document.SelectSingleNode("root/Subject[SubjectId='" + subjectId + "']");

            entity.SelectSingleNode("SubjectName").InnerText  = txtSubjectName.Text;
            entity.SelectSingleNode("Categories").InnerText   = str2;
            entity.SelectSingleNode("CategoryName").InnerText = str3;
            entity.SelectSingleNode("Keywords").InnerText     = txtKeywords.Text;
            entity.SelectSingleNode("MaxNum").InnerText       = txtMaxNum.Text;
            Globals.EntityCoding(entity, true);
            document.Save(filename);
            HiCache.Remove("ArticleSubjectFileCache-Admin");
            ShowMsg("成功的修改了商品栏目", true);
        }
Exemplo n.º 17
0
        public static SiteSettings GetMasterSettings(bool cacheable)
        {
            if (!cacheable)
            {
                HiCache.Remove("FileCache-MasterSettings");
            }
            XmlDocument document = HiCache.Get("FileCache-MasterSettings") as XmlDocument;

            if (document == null)
            {
                string masterSettingsFilename = GetMasterSettingsFilename();
                if (!File.Exists(masterSettingsFilename))
                {
                    return(null);
                }
                document = new XmlDocument();
                document.Load(masterSettingsFilename);
                if (cacheable)
                {
                    HiCache.Max("FileCache-MasterSettings", document, new CacheDependency(masterSettingsFilename));
                }
            }
            return(SiteSettings.FromXml(document));
        }
Exemplo n.º 18
0
        public static SiteSettings GetMasterSettings(bool cacheable)
        {
            if (!cacheable)
            {
                HiCache.Remove("FileCache-MasterSettings");
            }
            XmlDocument xmlDocument = HiCache.Get("FileCache-MasterSettings") as XmlDocument;

            if (xmlDocument == null)
            {
                string text = SettingsManager.smethod_0();
                if (!System.IO.File.Exists(text))
                {
                    return(null);
                }
                xmlDocument = new XmlDocument();
                xmlDocument.Load(text);
                if (cacheable)
                {
                    HiCache.Max("FileCache-MasterSettings", xmlDocument, new CacheDependency(text));
                }
            }
            return(SiteSettings.FromXml(xmlDocument));
        }
Exemplo n.º 19
0
        public static CategoryActionStatus AddCategory(CategoryInfo category)
        {
            CategoryActionStatus result;

            if (null == category)
            {
                result = CategoryActionStatus.UnknowError;
            }
            else
            {
                Globals.EntityCoding(category, true);
                int num = new CategoryDao().CreateCategory(category);
                if (num > 0)
                {
                    EventLogs.WriteOperationLog(Privilege.AddProductCategory, string.Format(CultureInfo.InvariantCulture, "创建了一个新的店铺分类:”{0}”", new object[]
                    {
                        category.Name
                    }));
                    HiCache.Remove("DataCache-Categories");
                }
                result = CategoryActionStatus.Success;
            }
            return(result);
        }
Exemplo n.º 20
0
        public static CategoryActionStatus UpdateCategory(CategoryInfo category)
        {
            CategoryActionStatus result;

            if (null == category)
            {
                result = CategoryActionStatus.UnknowError;
            }
            else
            {
                Globals.EntityCoding(category, true);
                CategoryActionStatus categoryActionStatus = new CategoryDao().UpdateCategory(category);
                if (categoryActionStatus == CategoryActionStatus.Success)
                {
                    EventLogs.WriteOperationLog(Privilege.EditProductCategory, string.Format(CultureInfo.InvariantCulture, "修改了编号为 “{0}” 的商品分类", new object[]
                    {
                        category.CategoryId
                    }));
                    HiCache.Remove("DataCache-Categories");
                }
                result = categoryActionStatus;
            }
            return(result);
        }
Exemplo n.º 21
0
 public static bool DeleteAffiche(int afficheId)
 {
     HiCache.Remove("DataCache-Affiches");
     return(new AfficheDao().Delete <AfficheInfo>(afficheId));
 }
Exemplo n.º 22
0
        static readonly bool isWxLogger = true; //微信日志开关

        protected VWeiXinOAuthTemplatedWebControl()
        {
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);

            string currentRequestUrl = HttpContext.Current.Request.Url.ToString();

            currentRequestUrl = System.Text.RegularExpressions.Regex.Replace(currentRequestUrl, "[\f\n\r\t\v]", "");

            #region
            WeiXinOAuthAttribute oAuth2Attr = Attribute.GetCustomAttribute(this.GetType(), typeof(WeiXinOAuthAttribute)) as WeiXinOAuthAttribute;

            WxLogger("*****************请求进入会员中心*****************");

            WxLogger("********Request.Url****" + currentRequestUrl);
            WxLogger("********ReferralId****" + this.Page.Request.QueryString["ReferralId"]);

            //WxLogger("Cookies:" + Globals.GetCurrentMemberUserId());

            MemberInfo currentMember = null;

            currentMember = MemberProcessor.GetCurrentMember();
            WxLogger("调式Vshop-Member-COOKIE:" + Globals.GetCurrentMemberUserId().ToString());
            WxLogger("调式currentMember:" + ((currentMember == null)?"empty":"111"));



            if (currentMember != null)    // || (this.Page.Session["userid"] == null || this.Page.Session["userid"].ToString() != currentMember.UserId.ToString())
            {
                //爽爽挝啡需求:店铺增加粉丝数
                string storeId = HiCache.Get(string.Format("DataCache-sub-StoreId-{0}", currentMember.OpenId)) as string;
                if (!string.IsNullOrEmpty(storeId))
                {
                    ManagerHelper.addStoreFansCount(storeId.ToInt(), currentMember.UserId, 0);
                    HiCache.Remove(string.Format("DataCache-sub-StoreId-{0}", currentMember.OpenId));
                }

                /*爽爽挝啡的代理商系统跳转判断:如果aspnet_member表的topRegionId为0或者不为1,则表示未激活,跳转到非法页面*/
                if (CustomConfigHelper.Instance.IsBuyerNeedsToBeActive)
                {
                    if (currentMember.TopRegionId == 0 || currentMember.TopRegionId != 1)
                    {
                        GotoResourceNotFound("您尚未被授权登录后台采购系统");
                    }
                }
                WxLogger(string.Format("        状态信息:**用户“{0}”已登录,中止请求微信**", currentMember.UserName));

                if (null != oAuth2Attr)
                {
                    switch (oAuth2Attr.WeiXinOAuthPage)
                    {
                    case WeiXinOAuthPage.VLogin:
                    case WeiXinOAuthPage.VRegister:
                    case WeiXinOAuthPage.VUserLogin:
                    {
                        string tUrl = (string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralId"]))
                                        ? "~/vshop/MemberCenter.aspx" : "~/vshop/MemberCenter.aspx?ReferralId=" + this.Page.Request.QueryString["ReferralId"];
                        Page.Response.Redirect(tUrl, true);
                        break;
                    }

                    case WeiXinOAuthPage.VMemberCenter:
                    {
                        break;
                    }

                    default:
                    {
                        break;
                    }
                    }
                }
                return;
            }

            //读取配置信息.
            if (masterSettings.IsValidationService)     //是否启用微信登录
            {
                string code = this.Page.Request.QueryString["code"];

                if (!string.IsNullOrEmpty(code))
                {
                    WxLogger("      状态信息:**从微信网关授权回来**");

                    WxLogger("      code:" + code);

                    #region 取到了code,说明用户同意了授权登录

                    string responseResult = this.GetResponseResult("https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + masterSettings.WeixinAppId + "&secret=" + masterSettings.WeixinAppSecret + "&code=" + code + "&grant_type=authorization_code");

                    WxLogger("      获取令牌:" + responseResult);

                    if (responseResult.Contains("access_token"))
                    {
                        JObject obj2 = JsonConvert.DeserializeObject(responseResult) as JObject;

                        string openId = obj2["openid"].ToString();    //微信用户OPENID
                        if (1 == 1)
                        {
                            string wxUserInfoStr = this.GetResponseResult("https://api.weixin.qq.com/sns/userinfo?access_token=" + obj2["access_token"].ToString() + "&openid=" + obj2["openid"].ToString() + "&lang=zh_CN");

                            WxLogger("      用户信息:" + wxUserInfoStr);

                            if (wxUserInfoStr.Contains("nickname"))
                            {
                                JObject wxUserInfo = JsonConvert.DeserializeObject(wxUserInfoStr) as JObject;

                                if (this.SkipWinxinOpenId(Globals.UrlDecode(wxUserInfo["nickname"].ToString()), wxUserInfo["openid"].ToString(), wxUserInfo["headimgurl"].ToString(), Page.Request["state"], 0))
                                {
                                    WxLogger("      状态信息:**微信绑定登录成功**" + currentRequestUrl);

                                    this.Page.Response.Redirect(currentRequestUrl);
                                }
                                else
                                {
                                    WxLogger("      状态信息:**微信绑定登录失败**");

                                    this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/index.aspx");
                                }
                            }
                            else
                            {
                                WxLogger("      状态信息:**微信登录失败**");

                                this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/index.aspx");
                            }
                        }
                        else
                        {
                        }
                    }
                    else
                    {
                        WxLogger("      状态信息:**获取信息失败**");

                        this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/index.aspx");
                    }

                    #endregion
                }
                else if (!string.IsNullOrEmpty(this.Page.Request.QueryString["state"]))
                {
                    this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/index.aspx");
                }
                else
                {
                    #region 跳转到微信登录

                    WxLogger("      状态信息:**到微信网关授权**");

                    string state = "";

                    if (System.Web.HttpContext.Current.Request.Cookies["Vshop-ReferralId"] != null)
                    {
                        state = System.Web.HttpContext.Current.Request.Cookies.Get("Vshop-ReferralId").Value;
                    }

                    WxLogger("      state:" + state);

                    string url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + masterSettings.WeixinAppId + "&redirect_uri=" + Globals.UrlEncode(currentRequestUrl) + "&response_type=code&scope=snsapi_userinfo&state=" + (string.IsNullOrWhiteSpace(state) ? "STATE" : state) + "#wechat_redirect";

                    /*url = (string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralId"]))
                    *               ? url :url+ "&ReferralId=" + this.Page.Request.QueryString["ReferralId"];*/
                    /*url = (string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralId"]) || url.ToLower().IndexOf("referralid") > -1)
                     *              ? url : url + "&ReferralId=" + this.Page.Request.QueryString["ReferralId"];*/
                    WxLogger("      状态信息:**测试**" + url);

                    //这里是微信入口
                    this.Page.Response.Redirect(url, true);

                    #endregion
                }
            }
            else
            {
                //if (!string.IsNullOrEmpty(masterSettings.WeixinLoginUrl))
                //{
                //    WxLogger("      状态信息:**跳转到通用登陆接口" + masterSettings.WeixinLoginUrl + "**");
                //    this.Page.Response.Redirect(masterSettings.WeixinLoginUrl);
                //}
                //else
                //{

                WxLogger("      状态信息:**跳转到通用登陆接口" + masterSettings.WeixinLoginUrl + "**");

                #region 加上尾巴

                int ReferralUserId = (null == currentMember ? 0 : currentMember.ReferralUserId);    // GetReferralUserId();

                //跳转过来的URL
                Uri urlReferrer = HttpContext.Current.Request.UrlReferrer;

                string returnUrl = currentRequestUrl;

                if (ReferralUserId > 0 && returnUrl.Contains("?"))
                {
                    returnUrl += "&ReferralUserId=" + ReferralUserId.ToString();
                }
                //else
                //{
                //    returnUrl += "?ReferralUserId=" + ReferralUserId.ToString();
                //}

                #endregion

                // this.Page.Response.Redirect("Login.aspx?returnUrl=" + Globals.UrlEncode(returnUrl));


                if (null != oAuth2Attr)
                {
                    switch (oAuth2Attr.WeiXinOAuthPage)
                    {
                    case WeiXinOAuthPage.VLogin:
                    case WeiXinOAuthPage.VMemberCenter:
                    {
                        this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/UserLogin.aspx?returnUrl=" + Globals.UrlEncode(returnUrl));
                        break;
                    }

                    default:
                    {
                        break;
                    }
                    }
                }
            }
            #endregion



            // }
        }
Exemplo n.º 23
0
 public static void RemoveDistributorCache(int userId)
 {
     HiCache.Remove(string.Format("DataCache-Distributor-{0}", userId));
 }
Exemplo n.º 24
0
 public static bool UpdateBalanceDrawRequest(int Id, string Remark)
 {
     HiCache.Remove(string.Format("DataCache-Distributor-{0}", Id));
     return(new DistributorsDao().UpdateBalanceDrawRequest(Id, Remark, null));
 }
Exemplo n.º 25
0
        private void UpdateStores()
        {
            StoresInfo  storeById   = StoresHelper.GetStoreById(this.storeId);
            ManagerInfo managerInfo = ManagerHelper.FindManagerByStoreId(this.storeId, SystemRoles.StoreAdmin);

            if (storeById == null)
            {
                base.Response.Redirect("StoresList.aspx");
            }
            double  num     = 0.0;
            int     num2    = 0;
            int     num3    = 0;
            decimal num4    = default(decimal);
            string  text    = "";
            string  text2   = "";
            string  Address = "";
            string  text3   = Globals.StripAllTags(this.txtStoresName.Text.Trim());

            Address = Globals.StripAllTags(this.txtAddress.Text);
            string text4 = Globals.StripAllTags(this.txtRegionScop.Value.Trim());
            string text5 = Globals.StripAllTags(this.txtRegionScopName.Value.Trim());

            text  = this.txtTel.Text;
            text2 = this.txtContactMan.Text;
            string[] array  = text4.Split(',');
            string[] array2 = text5.Split(',');
            IDictionary <int, DeliveryScopeInfo> dictionary = new Dictionary <int, DeliveryScopeInfo>();

            for (int i = 0; i < array.Length; i++)
            {
                int num5 = 0;
                if (int.TryParse(array[i], out num5) && array2.Length >= i && dictionary != null && !dictionary.ContainsKey(num5))
                {
                    DeliveryScopeInfo deliveryScopeInfo = new DeliveryScopeInfo();
                    deliveryScopeInfo.RegionId       = num5;
                    deliveryScopeInfo.RegionName     = array2[i];
                    deliveryScopeInfo.FullRegionPath = RegionHelper.GetFullPath(num5, true);
                    dictionary.Add(num5, deliveryScopeInfo);
                }
            }
            if (storeById.StoreName != text3 && StoresHelper.ExistStoreName(text3))
            {
                this.ResetForm(storeById.StoreId);
                this.ShowMsg("门店名称已经存在,请重新输入!", false);
            }
            else if (string.Compare(this.txtUserPwd.Text, this.txtUserRePwd.Text) != 0)
            {
                this.ResetForm(storeById.StoreId);
                this.ShowMsg("请确保两次输入的密码相同", false);
            }
            else if (!this.dropRegion.GetSelectedRegionId().HasValue)
            {
                this.ResetForm(storeById.StoreId);
                this.ShowMsg("请选择店铺所在区域!", false);
            }
            else if (text2.Length > 8 || text2.Length < 2)
            {
                this.ResetForm(storeById.StoreId);
                this.ShowMsg("请输入联系人,联系人长度必须是2-8位!", false);
            }
            else if (string.IsNullOrEmpty(this.hfLatitude.Value) || string.IsNullOrEmpty(this.hfLongitude.Value))
            {
                this.ResetForm(storeById.StoreId);
                this.ShowMsg("请给门店标注定位!", false);
            }
            else if (text == "" || !DataHelper.IsTel(text))
            {
                this.ResetForm(storeById.StoreId);
                this.ShowMsg("请输入正确的联系电话(手机或者固定电话)!", false);
            }
            else
            {
                if (!string.IsNullOrEmpty(this.txtUserPwd.Text))
                {
                    if (this.txtUserPwd.Text.Length < 6 || this.txtUserPwd.Text.Length > 20)
                    {
                        this.ResetForm(storeById.StoreId);
                        this.ShowMsg("密码长度必须在6到20个字符之间!", false);
                        return;
                    }
                    managerInfo.Password = Users.EncodePassword(this.txtUserPwd.Text, managerInfo.PasswordSalt);
                }
                if (!this.chkIsSupportExpress.Checked && !this.chkIsAboveSelf.Checked && !this.chkIsStoreDelive.Checked)
                {
                    this.ResetForm(storeById.StoreId);
                    this.ShowMsg("请选择一种配送方式!", false);
                }
                else
                {
                    if (this.chkIsStoreDelive.Checked)
                    {
                        if (!double.TryParse(this.txtServeRadius.Text.Trim(), out num) || num > 10000.0 || num <= 0.0)
                        {
                            this.ResetForm(storeById.StoreId);
                            this.ShowMsg("请输入正确的配送半径,为大于0至10000之间的数字!", false);
                            return;
                        }
                        if (!int.TryParse(this.txtStoreFreight.Text.Trim(), out num2) || num2 > 99999999 || num2 < 0)
                        {
                            this.ResetForm(storeById.StoreId);
                            this.ShowMsg("请输入正确的配送费", false);
                            return;
                        }
                        if (!int.TryParse(this.txtMinOrderPrice.Text.Trim(), out num3) || num3 > 99999999 || num3 < 0)
                        {
                            this.ResetForm(storeById.StoreId);
                            this.ShowMsg("请输入正确的起送价", false);
                            return;
                        }
                    }
                    if (!decimal.TryParse(this.txtCommissionRate.Text.Trim(), out num4) || num4 > 100m || num4 < decimal.Zero)
                    {
                        this.ResetForm(storeById.StoreId);
                        this.ShowMsg("请输入正确的平台抽佣比例", false);
                    }
                    else if (!this.chkOfflinePay.Checked && !this.chkOnlinePay.Checked && !this.chkCashOnDelivery.Checked)
                    {
                        this.ResetForm(storeById.StoreId);
                        this.ShowMsg("支付方式请至少选择一种", false);
                    }
                    else
                    {
                        storeById.IsOfflinePay     = this.chkOfflinePay.Checked;
                        storeById.IsOnlinePay      = this.chkOnlinePay.Checked;
                        storeById.IsCashOnDelivery = this.chkCashOnDelivery.Checked;
                        if (string.IsNullOrEmpty(this.txtStoreOpenTimeStartH.Text) || this.txtStoreOpenTimeStartH.Text.ToInt(0) < 0 || this.txtStoreOpenTimeStartH.Text.ToInt(0) >= 24)
                        {
                            this.ResetForm(storeById.StoreId);
                            this.ShowMsg("请输入正确的营业起始小时", false);
                        }
                        else if (string.IsNullOrEmpty(this.txtStoreOpenTimeStartM.Text) || this.txtStoreOpenTimeStartM.Text.ToInt(0) < 0 || this.txtStoreOpenTimeStartM.Text.ToInt(0) >= 60)
                        {
                            this.ResetForm(storeById.StoreId);
                            this.ShowMsg("请输入正确的营业起始分钟", false);
                        }
                        else if (string.IsNullOrEmpty(this.txtStoreOpenTimeEndH.Text) || this.txtStoreOpenTimeEndH.Text.ToInt(0) < 0 || this.txtStoreOpenTimeEndH.Text.ToInt(0) >= 24)
                        {
                            this.ResetForm(storeById.StoreId);
                            this.ShowMsg("请输入正确的营业结束小时", false);
                        }
                        else if (string.IsNullOrEmpty(this.txtStoreOpenTimeEndM.Text) || this.txtStoreOpenTimeEndM.Text.ToInt(0) < 0 || this.txtStoreOpenTimeEndM.Text.ToInt(0) >= 60)
                        {
                            this.ResetForm(storeById.StoreId);
                            this.ShowMsg("请输入正确的营业结束分钟", false);
                        }
                        else
                        {
                            string   empty     = string.Empty;
                            DateTime dateTime  = DateTime.Now;
                            string   text6     = dateTime.ToString("yyyy-MM-dd");
                            DateTime?nullable  = (text6 + " " + this.txtStoreOpenTimeStartH.Text.ToInt(0) + ":" + this.txtStoreOpenTimeStartM.Text.ToInt(0)).ToDateTime();
                            DateTime?nullable2 = (text6 + " " + this.txtStoreOpenTimeEndH.Text.ToInt(0) + ":" + this.txtStoreOpenTimeEndM.Text.ToInt(0)).ToDateTime();
                            dateTime = nullable.Value;
                            string str = dateTime.ToString("HH:mm");
                            dateTime = nullable2.Value;
                            string text7 = dateTime.ToString("HH:mm");
                            if (text7 == "00:00")
                            {
                                nullable2 = (text6 + " 23:59").ToDateTime();
                                text7     = "23:59";
                            }
                            empty = (storeById.StoreOpenTime = str + "-" + text7);
                            storeById.OpenStartDate    = nullable.Value;
                            storeById.OpenEndDate      = nullable2.Value;
                            storeById.IsSupportExpress = (this.chkIsSupportExpress.Checked && true);
                            storeById.IsAboveSelf      = (this.chkIsAboveSelf.Checked && true);
                            storeById.IsStoreDelive    = (this.chkIsStoreDelive.Checked && true);
                            storeById.Introduce        = this.editDescription.Text;
                            if (this.chkIsStoreDelive.Checked)
                            {
                                storeById.ServeRadius   = num;
                                storeById.MinOrderPrice = num3;
                                storeById.StoreFreight  = num2;
                            }
                            else
                            {
                                storeById.ServeRadius   = 0.0;
                                storeById.MinOrderPrice = null;
                                storeById.StoreFreight  = null;
                            }
                            storeById.CommissionRate = num4;
                            List <string> list = RegionHelper.GetFullRegion(this.dropRegion.GetSelectedRegionId().Value, ",", true, 0).Split(',').Take(3)
                                                 .ToList();
                            list.ForEach(delegate(string c)
                            {
                                Address = Address.Replace(c, string.Empty);
                            });
                            IList <string> list2  = new List <string>();
                            string         text9  = this.hidUploadImages.Value.Trim();
                            string[]       array3 = text9.Split(',');
                            for (int j = 0; j < array3.Length; j++)
                            {
                                if (!string.IsNullOrEmpty(array3[j]))
                                {
                                    string text10      = Globals.SaveFile("depot", array3[j], "/Storage/master/", true, false, "");
                                    string text11      = base.Request.MapPath(text10);
                                    string virtualPath = HiContext.Current.GetStoragePath() + "/depot/thum_" + text10.Substring(text10.LastIndexOf("/") + 1);
                                    if (!File.Exists(text11))
                                    {
                                        this.ShowMsg("缩略图文件夹未创建,请联系管理员", false);
                                        return;
                                    }
                                    ResourcesHelper.CreateThumbnail(text11, base.Request.MapPath(virtualPath), 160, 160);
                                    list2.Add(text10);
                                }
                            }
                            if (list2.Count == 0)
                            {
                                this.ResetForm(storeById.StoreId);
                                this.ShowMsg("logo已失效或未上传,请上传门店logo", false);
                            }
                            else if (ManagerHelper.Update(managerInfo))
                            {
                                int value = this.dropRegion.GetSelectedRegionId().Value;
                                storeById.StoreName      = text3;
                                storeById.RegionId       = value;
                                storeById.TopRegionId    = RegionHelper.GetCityId(value);
                                storeById.Tel            = text;
                                storeById.Address        = Address;
                                storeById.ContactMan     = text2;
                                storeById.StoreImages    = ((list2.Count == 0) ? string.Empty : string.Join(",", list2.ToArray()));
                                storeById.Longitude      = Math.Round(double.Parse(string.IsNullOrEmpty(this.hfLongitude.Value) ? "0" : this.hfLongitude.Value), 6);
                                storeById.Latitude       = Math.Round(double.Parse(string.IsNullOrEmpty(this.hfLatitude.Value) ? "0" : this.hfLatitude.Value), 6);
                                storeById.FullRegionPath = RegionHelper.GetFullPath(value, true);
                                StoresHelper.UpdateStore(storeById);
                                HiCache.Remove("DataCache-StoreInfoDataKey");
                                if (dictionary.Count > 0 && this.chkIsStoreDelive.Checked)
                                {
                                    StoresHelper.AddDeliveryScope(this.storeId, dictionary);
                                }
                                else
                                {
                                    StoresHelper.DeleteDevlieryScope(this.storeId);
                                }
                                if (!string.IsNullOrEmpty(this.txtStoreTag.Text.Trim()))
                                {
                                    IList <int> list3  = new List <int>();
                                    string      text12 = this.txtStoreTag.Text.Trim();
                                    string[]    array4 = null;
                                    array4 = ((!text12.Contains(",")) ? new string[1]
                                    {
                                        text12
                                    } : text12.Split(','));
                                    string[] array5 = array4;
                                    foreach (string value2 in array5)
                                    {
                                        list3.Add(Convert.ToInt32(value2));
                                    }
                                    StoresHelper.DeleteStoreTags(this.storeId);
                                    StoresHelper.BindStoreTags(this.storeId, list3);
                                }
                                else
                                {
                                    StoresHelper.DeleteStoreTags(this.storeId);
                                }
                                HiCache.Remove($"DataCache-StoreStateCacheKey-{storeById.StoreId}");
                                SiteSettings masterSettings = SettingsManager.GetMasterSettings();
                                if (masterSettings.OpenDadaLogistics)
                                {
                                    DataTable dataTable = DepotHelper.SynchroDadaStoreList(this.storeId);
                                    if (dataTable != null && dataTable.Rows.Count > 0)
                                    {
                                        for (int l = 0; l < dataTable.Rows.Count; l++)
                                        {
                                            string station_name    = dataTable.Rows[l]["StoreName"].ToNullString();
                                            int    business        = 5;
                                            string city_name       = dataTable.Rows[l]["CityName"].ToNullString().Replace("市", "");
                                            string area_name       = dataTable.Rows[l]["RegionName"].ToNullString();
                                            string station_address = dataTable.Rows[l]["Address"].ToNullString();
                                            double lng             = dataTable.Rows[l]["Longitude"].ToDouble(0);
                                            double lat             = dataTable.Rows[l]["Latitude"].ToDouble(0);
                                            string contact_name    = dataTable.Rows[l]["ContactMan"].ToNullString();
                                            string phone           = dataTable.Rows[l]["Tel"].ToNullString();
                                            string text13          = dataTable.Rows[l]["StoreId"].ToNullString();
                                            string text14          = DadaHelper.shopUpdate(masterSettings.DadaSourceID, this.storeId.ToString(), "", station_name, business, city_name, area_name, station_address, lng, lat, contact_name, phone, -1);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 26
0
 private static void RemoveMenuCache(ShopMenuInfo menu)
 {
     HiCache.Remove($"DataCache-ShopMenuCacheKey-{menu.ClientType}");
     HiCache.Remove($"DataCache-FooterMenuCacheKey-{menu.ClientType}");
 }
Exemplo n.º 27
0
 public static bool UpdateMember(MemberInfo member)
 {
     HiCache.Remove(string.Format("DataCache-Member-{0}", member.UserId));
     return(new MemberDao().Update(member));
 }
Exemplo n.º 28
0
 public static void SignOut(string username)
 {
     HiCache.Remove(string.Format("DataCache-ManagerPrivileges:{0}", username));
 }
Exemplo n.º 29
0
 public static void ForceRefresh()
 {
     HiCache.Remove("SiteUrls");
 }
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            string     value = this.txtcellphone.Value;
            MemberInfo user  = HiContext.Current.User;

            if (HiContext.Current.User.CellPhone != value && HiContext.Current.User.UserName != value)
            {
                MemberInfo memberInfo = MemberProcessor.FindMemberByUsername(value);
                if (MemberProcessor.IsUseCellphone(value) || (memberInfo != null && memberInfo.UserName == value))
                {
                    this.ShowMessage("当前手机已被其他用户使用不能验证!", false, "", 1);
                    return;
                }
            }
            if (string.IsNullOrEmpty(value))
            {
                this.ShowMessage("手机号码不允许为空!", false, "", 1);
            }
            else if (!Regex.IsMatch(value, "^(13|14|15|17|18)\\d{9}$"))
            {
                this.ShowMessage("手机号码格式不正确!", false, "", 1);
            }
            else if (string.IsNullOrEmpty(this.txtcode.Value))
            {
                this.ShowMessage("验证码不允许为空!", false, "", 1);
            }
            else
            {
                object obj = HiCache.Get($"DataCache-PhoneCode-{value}");
                if (obj == null)
                {
                    this.ShowMessage("验证码错误!", false, "", 1);
                }
                else if (this.txtcode.Value.ToNullString().ToLower().Trim() != obj.ToNullString().ToLower().Trim())
                {
                    this.ShowMessage("验证码输入错误!", false, "", 1);
                }
                else
                {
                    MemberInfo user2 = Users.GetUser(HiContext.Current.UserId);
                    if (user2 == null)
                    {
                        this.ShowMessage("请您先登录!", false, "", 1);
                    }
                    else
                    {
                        if (user2.UserName.IndexOf("YSC_") >= 0 || user2.UserName == user2.CellPhone)
                        {
                            user2.UserName = value;
                        }
                        user2.CellPhone             = value;
                        user2.CellPhoneVerification = true;
                        if (MemberProcessor.UpdateMember(user2))
                        {
                            HiCache.Remove($"DataCache-PhoneCode-{value}");
                            this.Page.Response.Redirect("VerificationSuccess.aspx");
                        }
                        else
                        {
                            this.ShowMessage("发送验证码失败", false, "", 1);
                        }
                    }
                }
            }
        }