Example #1
0
        void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var storeInfo = new StoreInfo(e.Item.DataItem);

                var ltlItemIndex       = e.Item.FindControl("ltlItemIndex") as Literal;
                var ltlTitle           = e.Item.FindControl("ltlTitle") as Literal;
                var ltlKeywords        = e.Item.FindControl("ltlKeywords") as Literal;
                var ltlPvCount         = e.Item.FindControl("ltlPVCount") as Literal;
                var ltlIsEnabled       = e.Item.FindControl("ltlIsEnabled") as Literal;
                var ltlStoreContentUrl = e.Item.FindControl("ltlStoreContentUrl") as Literal;
                var ltlPreviewUrl      = e.Item.FindControl("ltlPreviewUrl") as Literal;
                var ltlEditUrl         = e.Item.FindControl("ltlEditUrl") as Literal;

                ltlItemIndex.Text = (e.Item.ItemIndex + 1).ToString();
                ltlTitle.Text     = storeInfo.Title;
                ltlKeywords.Text  = DataProviderWx.KeywordDao.GetKeywords(storeInfo.KeywordId);
                ltlPvCount.Text   = storeInfo.PvCount.ToString();

                ltlIsEnabled.Text = StringUtils.GetTrueOrFalseImageHtml(!storeInfo.IsDisabled);

                var urlStoreContent = PageStoreItem.GetRedirectUrl(PublishmentSystemId, storeInfo.Id);

                ltlStoreContentUrl.Text = $@"<a href=""{urlStoreContent}"">微门店</a>";

                //var urlPreview = StoreManager.GetStoreUrl(PublishmentSystemInfo, storeInfo, string.Empty);
                //urlPreview = BackgroundPreview.GetRedirectUrlToMobile(urlPreview);
                //ltlPreviewUrl.Text = $@"<a href=""{urlPreview}"" target=""_blank"">预览</a>";

                var urlEdit = PageStoreAdd.GetRedirectUrl(PublishmentSystemId, storeInfo.Id);
                ltlEditUrl.Text = $@"<a href=""{urlEdit}"">编辑</a>";
            }
        }
Example #2
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                var conflictKeywords = string.Empty;

                var storeItemInfo = new StoreItemInfo();
                if (_storeItemId > 0)
                {
                    storeItemInfo = DataProviderWx.StoreItemDao.GetStoreItemInfo(_storeItemId);
                }
                storeItemInfo.PublishmentSystemId = PublishmentSystemId;
                storeItemInfo.StoreId             = _storeId;
                storeItemInfo.CategoryId          = Convert.ToInt32(DdlStoreCategoryName.SelectedValue);
                storeItemInfo.StoreName           = TbStoreName.Text;
                storeItemInfo.Tel       = TbStoreTel.Text;
                storeItemInfo.Mobile    = TbStoreMobile.Text;
                storeItemInfo.Address   = TbStoreAddress.Text;
                storeItemInfo.ImageUrl  = ImageUrl.Value;
                storeItemInfo.Latitude  = TxtLatitude.Value;
                storeItemInfo.Longitude = TxtLongitude.Value;
                storeItemInfo.Summary   = TbSummary.Text;

                try
                {
                    if (_storeItemId > 0)
                    {
                        DataProviderWx.StoreItemDao.Update(PublishmentSystemId, storeItemInfo);

                        LogUtils.AddAdminLog(Body.AdministratorName, "修改微门店信息", $"微门店:{TbStoreName.Text}");
                        SuccessMessage("修改微门店成功!");
                    }
                    else
                    {
                        _storeItemId = DataProviderWx.StoreItemDao.Insert(PublishmentSystemId, storeItemInfo);
                        LogUtils.AddAdminLog(Body.AdministratorName, "添加微门店信息", $"微门店:{TbStoreName.Text}");
                        SuccessMessage("添加微门店成功!");
                    }

                    var redirectUrl = PageStoreItem.GetRedirectUrl(PublishmentSystemId, _storeId);
                    AddWaitAndRedirectScript(redirectUrl);
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "微门店设置失败!");
                }
            }
        }
Example #3
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                var isConflict       = false;
                var conflictKeywords = string.Empty;
                if (!string.IsNullOrEmpty(TbKeywords.Text))
                {
                    if (_storeId > 0)
                    {
                        var storeInfo = DataProviderWx.StoreDao.GetStoreInfo(_storeId);
                        isConflict = KeywordManager.IsKeywordUpdateConflict(PublishmentSystemId, storeInfo.KeywordId, PageUtils.FilterXss(TbKeywords.Text), out conflictKeywords);
                    }
                    else
                    {
                        isConflict = KeywordManager.IsKeywordInsertConflict(PublishmentSystemId, PageUtils.FilterXss(TbKeywords.Text), out conflictKeywords);
                    }
                }

                if (isConflict)
                {
                    FailMessage($"触发关键词“{conflictKeywords}”已存在,请设置其他关键词");
                }
                else
                {
                    var storeInfo = new StoreInfo();
                    if (_storeId > 0)
                    {
                        storeInfo = DataProviderWx.StoreDao.GetStoreInfo(_storeId);
                    }
                    storeInfo.PublishmentSystemId = PublishmentSystemId;

                    storeInfo.KeywordId  = DataProviderWx.KeywordDao.GetKeywordId(PublishmentSystemId, _storeId > 0, TbKeywords.Text, EKeywordType.Store, storeInfo.KeywordId);
                    storeInfo.IsDisabled = !CbIsEnabled.Checked;

                    storeInfo.Title    = PageUtils.FilterXss(TbTitle.Text);
                    storeInfo.ImageUrl = ImageUrl.Value;;
                    storeInfo.Summary  = TbSummary.Text;

                    try
                    {
                        if (_storeId > 0)
                        {
                            DataProviderWx.StoreDao.Update(storeInfo);

                            LogUtils.AddAdminLog(Body.AdministratorName, "修改微门店", $"微门店:{TbTitle.Text}");
                            SuccessMessage("修改微门店成功!");
                        }
                        else
                        {
                            _storeId = DataProviderWx.StoreDao.Insert(storeInfo);

                            LogUtils.AddAdminLog(Body.AdministratorName, "添加微门店", $"微门店:{TbTitle.Text}");
                            SuccessMessage("添加微门店成功!");
                        }

                        var redirectUrl = PageStoreItem.GetRedirectUrl(PublishmentSystemId, _storeId);
                        AddWaitAndRedirectScript(redirectUrl);
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, "微门店设置失败!");
                    }
                }
            }
        }
Example #4
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemId");
            _storeId     = Body.GetQueryInt("storeID");
            _storeItemId = Body.GetQueryInt("storeItemID");

            if (!IsPostBack)
            {
                var pageTitle = _storeItemId > 0 ? "编辑微门店信息" : "添加微门店信息";
                BreadCrumb(AppManager.WeiXin.LeftMenu.IdFunction, AppManager.WeiXin.LeftMenu.Function.IdStore, pageTitle, AppManager.WeiXin.Permission.WebSite.Store);
                LtlPageTitle.Text = pageTitle;
                LtlImageUrl.Text  =
                    $@"<img id=""preview_imageUrl"" src=""{StoreManager.GetImageUrl(PublishmentSystemInfo, string.Empty)}"" width=""200"" height=""200"" align=""middle"" />";


                DdlStoreCategoryName.Items.Add(new ListItem("<请选择>", "0"));

                var categoryIdList = DataProviderWx.StoreCategoryDao.GetAllCategoryIdList(PublishmentSystemId);
                var count          = categoryIdList.Count;
                if (count > 0)
                {
                    _isLastNodeArray = new bool[count];
                    foreach (var theCategoryId in categoryIdList)
                    {
                        var categoryInfo = DataProviderWx.StoreCategoryDao.GetCategoryInfo(theCategoryId);
                        var listitem     = new ListItem(GetTitle(categoryInfo.Id, categoryInfo.CategoryName, categoryInfo.ParentsCount, categoryInfo.IsLastNode), theCategoryId.ToString());
                        DdlStoreCategoryName.Items.Add(listitem);
                    }
                }

                if (_storeItemId > 0)
                {
                    var storeItemInfo = DataProviderWx.StoreItemDao.GetStoreItemInfo(_storeItemId);

                    TbStoreName.Text    = storeItemInfo.StoreName;
                    TbStoreTel.Text     = storeItemInfo.Tel;
                    TbStoreMobile.Text  = storeItemInfo.Mobile;
                    TbStoreAddress.Text = storeItemInfo.Address;
                    TxtLatitude.Value   = storeItemInfo.Latitude;
                    TxtLongitude.Value  = storeItemInfo.Longitude;
                    TbSummary.Text      = storeItemInfo.Summary;

                    if (storeItemInfo.CategoryId > 0)
                    {
                        DdlStoreCategoryName.Items.FindByValue("" + storeItemInfo.CategoryId + "").Selected = true;
                    }

                    if (!string.IsNullOrEmpty(storeItemInfo.ImageUrl))
                    {
                        LtlImageUrl.Text =
                            $@"<img id=""preview_storeImageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                PublishmentSystemInfo, storeItemInfo.ImageUrl)}"" width=""370"" align=""middle"" />";
                    }

                    ImageUrl.Value = storeItemInfo.ImageUrl;

                    _storeId = storeItemInfo.StoreId;
                }

                BtnReturn.Attributes.Add("onclick",
                                         $@"location.href=""{PageStoreItem.GetRedirectUrl(PublishmentSystemId, _storeId)}"";return false");
            }
        }