Exemplo n.º 1
0
        void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var view360Info = new View360Info(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 ltlPreviewUrl = e.Item.FindControl("ltlPreviewUrl") as Literal;
                var ltlEditUrl    = e.Item.FindControl("ltlEditUrl") as Literal;

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

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

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

                var urlEdit = PageView360Add.GetRedirectUrl(PublishmentSystemId, view360Info.Id);
                ltlEditUrl.Text = $@"<a href=""{urlEdit}"">编辑</a>";
            }
        }
Exemplo n.º 2
0
        public int Insert(View360Info view360Info)
        {
            var view360ID = 0;

            IDataParameter[] parms = null;

            var SQL_INSERT = BaiRongDataProvider.TableStructureDao.GetInsertSqlString(view360Info.ToNameValueCollection(), ConnectionString, TABLE_NAME, out parms);

            using (var conn = GetConnection())
            {
                conn.Open();
                using (var trans = conn.BeginTransaction())
                {
                    try
                    {
                        ExecuteNonQuery(trans, SQL_INSERT, parms);

                        view360ID = BaiRongDataProvider.DatabaseDao.GetSequence(trans, TABLE_NAME);

                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        throw;
                    }
                }
            }

            return(view360ID);
        }
Exemplo n.º 3
0
        public void Update(View360Info view360Info)
        {
            IDataParameter[] parms = null;
            var SQL_UPDATE         = BaiRongDataProvider.TableStructureDao.GetUpdateSqlString(view360Info.ToNameValueCollection(), ConnectionString, TABLE_NAME, out parms);

            ExecuteNonQuery(SQL_UPDATE, parms);
        }
Exemplo n.º 4
0
        public int Insert(View360Info view360Info)
        {
            var view360Id = 0;

            IDataParameter[] parms = null;

            var sqlInsert = BaiRongDataProvider.TableStructureDao.GetInsertSqlString(view360Info.ToNameValueCollection(), ConnectionString, TableName, out parms);

            using (var conn = GetConnection())
            {
                conn.Open();
                using (var trans = conn.BeginTransaction())
                {
                    try
                    {
                        view360Id = ExecuteNonQueryAndReturnId(trans, sqlInsert, parms);

                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        throw;
                    }
                }
            }

            return(view360Id);
        }
Exemplo n.º 5
0
        public List <View360Info> GetView360InfoListByKeywordID(int publishmentSystemID, int keywordID)
        {
            var view360InfoList = new List <View360Info>();

            string SQL_WHERE =
                $"WHERE {View360Attribute.PublishmentSystemID} = {publishmentSystemID} AND {View360Attribute.IsDisabled} <> '{true}'";

            if (keywordID > 0)
            {
                SQL_WHERE += $" AND {View360Attribute.KeywordID} = {keywordID}";
            }

            var SQL_SELECT = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TABLE_NAME, 0, SqlUtils.Asterisk, SQL_WHERE, null);

            using (var rdr = ExecuteReader(SQL_SELECT))
            {
                while (rdr.Read())
                {
                    var view360Info = new View360Info(rdr);
                    view360InfoList.Add(view360Info);
                }
                rdr.Close();
            }

            return(view360InfoList);
        }
Exemplo n.º 6
0
        public void Update(View360Info view360Info)
        {
            IDataParameter[] parms = null;
            var sqlUpdate          = BaiRongDataProvider.TableStructureDao.GetUpdateSqlString(view360Info.ToNameValueCollection(), ConnectionString, TableName, out parms);

            ExecuteNonQuery(sqlUpdate, parms);
        }
Exemplo n.º 7
0
        public List <View360Info> GetView360InfoListByKeywordId(int publishmentSystemId, int keywordId)
        {
            var view360InfoList = new List <View360Info>();

            string sqlWhere =
                $"WHERE {View360Attribute.PublishmentSystemId} = {publishmentSystemId} AND {View360Attribute.IsDisabled} <> '{true}'";

            if (keywordId > 0)
            {
                sqlWhere += $" AND {View360Attribute.KeywordId} = {keywordId}";
            }

            var sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TableName, 0, SqlUtils.Asterisk, sqlWhere, null);

            using (var rdr = ExecuteReader(sqlSelect))
            {
                while (rdr.Read())
                {
                    var view360Info = new View360Info(rdr);
                    view360InfoList.Add(view360Info);
                }
                rdr.Close();
            }

            return(view360InfoList);
        }
Exemplo n.º 8
0
        public View360Info GetView360Info(int view360ID)
        {
            View360Info view360Info = null;

            string SQL_WHERE  = $"WHERE ID = {view360ID}";
            var    SQL_SELECT = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TABLE_NAME, 0, SqlUtils.Asterisk, SQL_WHERE, null);

            using (var rdr = ExecuteReader(SQL_SELECT))
            {
                if (rdr.Read())
                {
                    view360Info = new View360Info(rdr);
                }
                rdr.Close();
            }

            return(view360Info);
        }
Exemplo n.º 9
0
        public View360Info GetView360Info(int view360Id)
        {
            View360Info view360Info = null;

            string sqlWhere  = $"WHERE ID = {view360Id}";
            var    sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TableName, 0, SqlUtils.Asterisk, sqlWhere, null);

            using (var rdr = ExecuteReader(sqlSelect))
            {
                if (rdr.Read())
                {
                    view360Info = new View360Info(rdr);
                }
                rdr.Close();
            }

            return(view360Info);
        }
Exemplo n.º 10
0
        public List <View360Info> GetView360InfoList(int publishmentSystemId)
        {
            var view360InfoList = new List <View360Info>();

            string sqlWhere  = $" AND {View360Attribute.PublishmentSystemId} = {publishmentSystemId}";
            var    sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TableName, 0, SqlUtils.Asterisk, sqlWhere, null);

            using (var rdr = ExecuteReader(sqlSelect))
            {
                while (rdr.Read())
                {
                    var view360Info = new View360Info(rdr);
                    view360InfoList.Add(view360Info);
                }
                rdr.Close();
            }

            return(view360InfoList);
        }
Exemplo n.º 11
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                var selectedStep = 0;
                if (PhStep1.Visible)
                {
                    selectedStep = 1;
                }
                else if (PhStep2.Visible)
                {
                    selectedStep = 2;
                }

                PhStep1.Visible = PhStep2.Visible = false;

                if (selectedStep == 1)
                {
                    var isConflict       = false;
                    var conflictKeywords = string.Empty;
                    if (!string.IsNullOrEmpty(TbKeywords.Text))
                    {
                        if (_view360Id > 0)
                        {
                            var view360Info = DataProviderWx.View360Dao.GetView360Info(_view360Id);
                            isConflict = KeywordManager.IsKeywordUpdateConflict(PublishmentSystemId, view360Info.KeywordId, PageUtils.FilterXss(TbKeywords.Text), out conflictKeywords);
                        }
                        else
                        {
                            isConflict = KeywordManager.IsKeywordInsertConflict(PublishmentSystemId, PageUtils.FilterXss(TbKeywords.Text), out conflictKeywords);
                        }
                    }

                    if (isConflict)
                    {
                        FailMessage($"触发关键词“{conflictKeywords}”已存在,请设置其他关键词");
                        PhStep1.Visible = true;
                    }
                    else
                    {
                        PhStep2.Visible = true;
                        BtnSubmit.Text  = "确 认";
                    }
                }
                else if (selectedStep == 2)
                {
                    var view360Info = new View360Info();
                    if (_view360Id > 0)
                    {
                        view360Info = DataProviderWx.View360Dao.GetView360Info(_view360Id);
                    }
                    view360Info.PublishmentSystemId = PublishmentSystemId;

                    view360Info.KeywordId  = DataProviderWx.KeywordDao.GetKeywordId(PublishmentSystemId, _view360Id > 0, TbKeywords.Text, EKeywordType.View360, view360Info.KeywordId);
                    view360Info.IsDisabled = !CbIsEnabled.Checked;

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

                    view360Info.ContentImageUrl1 = TbContentImageUrl1.Text;
                    view360Info.ContentImageUrl2 = TbContentImageUrl2.Text;
                    view360Info.ContentImageUrl3 = TbContentImageUrl3.Text;
                    view360Info.ContentImageUrl4 = TbContentImageUrl4.Text;
                    view360Info.ContentImageUrl5 = TbContentImageUrl5.Text;
                    view360Info.ContentImageUrl6 = TbContentImageUrl6.Text;

                    try
                    {
                        if (_view360Id > 0)
                        {
                            DataProviderWx.View360Dao.Update(view360Info);

                            LogUtils.AddAdminLog(Body.AdministratorName, "修改360全景", $"360全景:{TbTitle.Text}");
                            SuccessMessage("修改360全景成功!");
                        }
                        else
                        {
                            _view360Id = DataProviderWx.View360Dao.Insert(view360Info);

                            LogUtils.AddAdminLog(Body.AdministratorName, "添加360全景", $"360全景:{TbTitle.Text}");
                            SuccessMessage("添加360全景成功!");
                        }

                        var redirectUrl = PageView360.GetRedirectUrl(PublishmentSystemId);
                        AddWaitAndRedirectScript(redirectUrl);
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, "360全景设置失败!");
                    }

                    BtnSubmit.Visible = false;
                    BtnReturn.Visible = false;
                }
            }
        }
Exemplo n.º 12
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                var selectedStep = 0;
                if (phStep1.Visible)
                {
                    selectedStep = 1;
                }
                else if (phStep2.Visible)
                {
                    selectedStep = 2;
                }

                phStep1.Visible = phStep2.Visible = false;

                if (selectedStep == 1)
                {
                    var isConflict       = false;
                    var conflictKeywords = string.Empty;
                    if (!string.IsNullOrEmpty(tbKeywords.Text))
                    {
                        if (view360ID > 0)
                        {
                            var view360Info = DataProviderWX.View360DAO.GetView360Info(view360ID);
                            isConflict = KeywordManager.IsKeywordUpdateConflict(PublishmentSystemID, view360Info.KeywordID, PageUtils.FilterXSS(tbKeywords.Text), out conflictKeywords);
                        }
                        else
                        {
                            isConflict = KeywordManager.IsKeywordInsertConflict(PublishmentSystemID, PageUtils.FilterXSS(tbKeywords.Text), out conflictKeywords);
                        }
                    }

                    if (isConflict)
                    {
                        FailMessage($"触发关键词“{conflictKeywords}”已存在,请设置其他关键词");
                        phStep1.Visible = true;
                    }
                    else
                    {
                        phStep2.Visible = true;
                        btnSubmit.Text  = "确 认";
                    }
                }
                else if (selectedStep == 2)
                {
                    var view360Info = new View360Info();
                    if (view360ID > 0)
                    {
                        view360Info = DataProviderWX.View360DAO.GetView360Info(view360ID);
                    }
                    view360Info.PublishmentSystemID = PublishmentSystemID;

                    view360Info.KeywordID  = DataProviderWX.KeywordDAO.GetKeywordID(PublishmentSystemID, view360ID > 0, tbKeywords.Text, EKeywordType.View360, view360Info.KeywordID);
                    view360Info.IsDisabled = !cbIsEnabled.Checked;

                    view360Info.Title    = PageUtils.FilterXSS(tbTitle.Text);
                    view360Info.ImageUrl = imageUrl.Value;;
                    view360Info.Summary  = tbSummary.Text;

                    view360Info.ContentImageUrl1 = tbContentImageUrl1.Text;
                    view360Info.ContentImageUrl2 = tbContentImageUrl2.Text;
                    view360Info.ContentImageUrl3 = tbContentImageUrl3.Text;
                    view360Info.ContentImageUrl4 = tbContentImageUrl4.Text;
                    view360Info.ContentImageUrl5 = tbContentImageUrl5.Text;
                    view360Info.ContentImageUrl6 = tbContentImageUrl6.Text;

                    try
                    {
                        if (view360ID > 0)
                        {
                            DataProviderWX.View360DAO.Update(view360Info);

                            LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "修改360全景",
                                            $"360全景:{tbTitle.Text}");
                            SuccessMessage("修改360全景成功!");
                        }
                        else
                        {
                            view360ID = DataProviderWX.View360DAO.Insert(view360Info);

                            LogUtils.AddLog(BaiRongDataProvider.AdministratorDao.UserName, "添加360全景",
                                            $"360全景:{tbTitle.Text}");
                            SuccessMessage("添加360全景成功!");
                        }

                        var redirectUrl = PageUtils.GetWXUrl(
                            $"background_view360.aspx?publishmentSystemID={PublishmentSystemID}");
                        AddWaitAndRedirectScript(redirectUrl);
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, "360全景设置失败!");
                    }

                    btnSubmit.Visible = false;
                    btnReturn.Visible = false;
                }
            }
        }
Exemplo n.º 13
0
        public static string GetView360Url(PublishmentSystemInfo publishmentSystemInfo, View360Info view360Info, string wxOpenID)
        {
            var attributes = new NameValueCollection();

            attributes.Add("publishmentSystemID", view360Info.PublishmentSystemId.ToString());
            attributes.Add("view360ID", view360Info.Id.ToString());
            attributes.Add("wxOpenID", wxOpenID);
            return(PageUtils.AddQueryString(GetView360Url(publishmentSystemInfo), attributes));
        }