Пример #1
0
        public void Update(KeywordInfo keywordInfo)
        {
            if (keywordInfo != null && keywordInfo.KeywordID > 0)
            {
                var parms = new IDataParameter[]
                {
                    GetParameter(PARM_PUBLISHMENT_SYSTEM_ID, EDataType.Integer, keywordInfo.PublishmentSystemID),
                    GetParameter(PARM_KEYWORDS, EDataType.NVarChar, 255, keywordInfo.Keywords),
                    GetParameter(PARM_IS_DISABLED, EDataType.VarChar, 18, keywordInfo.IsDisabled.ToString()),
                    GetParameter(PARM_KEYWORD_TYPE, EDataType.VarChar, 50, EKeywordTypeUtils.GetValue(keywordInfo.KeywordType)),
                    GetParameter(PARM_MATCH_TYPE, EDataType.VarChar, 50, EMatchTypeUtils.GetValue(keywordInfo.MatchType)),
                    GetParameter(PARM_REPLY, EDataType.NText, keywordInfo.Reply),
                    GetParameter(PARM_ADD_DATE, EDataType.DateTime, keywordInfo.AddDate),
                    GetParameter(PARM_TAXIS, EDataType.Integer, keywordInfo.Taxis),
                    GetParameter(PARM_KEYWORD_ID, EDataType.Integer, keywordInfo.KeywordID)
                };

                ExecuteNonQuery(SQL_UPDATE, parms);

                DataProviderWX.KeywordMatchDAO.DeleteByKeywordID(keywordInfo.KeywordID);

                foreach (var str in TranslateUtils.StringCollectionToStringList(keywordInfo.Keywords, ' '))
                {
                    var keyword = str.Trim();
                    if (!string.IsNullOrEmpty(keyword))
                    {
                        DataProviderWX.KeywordMatchDAO.Insert(new KeywordMatchInfo(0, keywordInfo.PublishmentSystemID, keyword, keywordInfo.KeywordID, keywordInfo.IsDisabled, keywordInfo.KeywordType, keywordInfo.MatchType));
                    }
                }
            }
        }
Пример #2
0
        public void Update(KeywordInfo keywordInfo)
        {
            if (keywordInfo != null && keywordInfo.KeywordId > 0)
            {
                var parms = new IDataParameter[]
                {
                    GetParameter(ParmPublishmentSystemId, EDataType.Integer, keywordInfo.PublishmentSystemId),
                    GetParameter(ParmKeywords, EDataType.NVarChar, 255, keywordInfo.Keywords),
                    GetParameter(ParmIsDisabled, EDataType.VarChar, 18, keywordInfo.IsDisabled.ToString()),
                    GetParameter(ParmKeywordType, EDataType.VarChar, 50, EKeywordTypeUtils.GetValue(keywordInfo.KeywordType)),
                    GetParameter(ParmMatchType, EDataType.VarChar, 50, EMatchTypeUtils.GetValue(keywordInfo.MatchType)),
                    GetParameter(ParmReply, EDataType.NText, keywordInfo.Reply),
                    GetParameter(ParmAddDate, EDataType.DateTime, keywordInfo.AddDate),
                    GetParameter(ParmTaxis, EDataType.Integer, keywordInfo.Taxis),
                    GetParameter(ParmKeywordId, EDataType.Integer, keywordInfo.KeywordId)
                };

                ExecuteNonQuery(SqlUpdate, parms);

                DataProviderWx.KeywordMatchDao.DeleteByKeywordId(keywordInfo.KeywordId);

                foreach (var str in TranslateUtils.StringCollectionToStringList(keywordInfo.Keywords, ' '))
                {
                    var keyword = str.Trim();
                    if (!string.IsNullOrEmpty(keyword))
                    {
                        DataProviderWx.KeywordMatchDao.Insert(new KeywordMatchInfo(0, keywordInfo.PublishmentSystemId, keyword, keywordInfo.KeywordId, keywordInfo.IsDisabled, keywordInfo.KeywordType, keywordInfo.MatchType));
                    }
                }
            }
        }
Пример #3
0
        void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var ltlTitle = e.Item.FindControl("ltlTitle") as Literal;

                var functionID  = TranslateUtils.EvalInt(e.Item.DataItem, "ID");
                var keywordType = EKeywordTypeUtils.GetEnumType(ddlKeywordType.SelectedValue);
                var pageTitle   = KeywordManager.GetFunctionName(keywordType, functionID);

                var clickString = string.Empty;

                if (Request.QueryString["itemIndex"] != null)
                {
                    clickString =
                        $@"window.parent.{jsMethod}({itemIndex}, '{EKeywordTypeUtils.GetValue(keywordType)}', {functionID}, '{pageTitle}');{JsUtils
                            .OpenWindow.HIDE_POP_WIN}";
                }
                else
                {
                    clickString =
                        $@"window.parent.{jsMethod}('{EKeywordTypeUtils.GetValue(keywordType)},{functionID},{pageTitle}');{JsUtils
                            .OpenWindow.HIDE_POP_WIN}";
                }

                ltlTitle.Text = $@"
<div class=""alert alert-success pull-left"" style=""margin:5px;padding-right:14px; cursor:pointer;"" onclick=""{clickString}"">
    <strong style=""color: #468847"">{pageTitle}</strong>
</div>";
            }
        }
Пример #4
0
        public IEnumerable GetDataSource(int publishmentSystemId, EKeywordType keywordType)
        {
            var parms = new IDataParameter[]
            {
                GetParameter(ParmPublishmentSystemId, EDataType.Integer, publishmentSystemId),
                GetParameter(ParmKeywordType, EDataType.VarChar, 50, EKeywordTypeUtils.GetValue(keywordType))
            };

            var enumerable = (IEnumerable)ExecuteReader(SqlSelectAllByType, parms);

            return(enumerable);
        }
Пример #5
0
        public IEnumerable GetDataSource(int publishmentSystemID, EKeywordType keywordType)
        {
            var parms = new IDataParameter[]
            {
                GetParameter(PARM_PUBLISHMENT_SYSTEM_ID, EDataType.Integer, publishmentSystemID),
                GetParameter(PARM_KEYWORD_TYPE, EDataType.VarChar, 50, EKeywordTypeUtils.GetValue(keywordType))
            };

            var enumerable = (IEnumerable)ExecuteReader(SQL_SELECT_ALL_BY_TYPE, parms);

            return(enumerable);
        }
Пример #6
0
        public int Insert(KeywordInfo keywordInfo)
        {
            var keywordID = 0;

            var sqlString = "INSERT INTO wx_Keyword (PublishmentSystemID, Keywords, IsDisabled, KeywordType, MatchType, Reply, AddDate, Taxis) VALUES (@PublishmentSystemID, @Keywords, @IsDisabled, @KeywordType, @MatchType, @Reply, @AddDate, @Taxis)";

            var taxis = GetMaxTaxis(keywordInfo.PublishmentSystemID, keywordInfo.KeywordType) + 1;
            var parms = new IDataParameter[]
            {
                GetParameter(PARM_PUBLISHMENT_SYSTEM_ID, EDataType.Integer, keywordInfo.PublishmentSystemID),
                GetParameter(PARM_KEYWORDS, EDataType.NVarChar, 255, keywordInfo.Keywords),
                GetParameter(PARM_IS_DISABLED, EDataType.VarChar, 18, keywordInfo.IsDisabled.ToString()),
                GetParameter(PARM_KEYWORD_TYPE, EDataType.VarChar, 50, EKeywordTypeUtils.GetValue(keywordInfo.KeywordType)),
                GetParameter(PARM_MATCH_TYPE, EDataType.VarChar, 50, EMatchTypeUtils.GetValue(keywordInfo.MatchType)),
                GetParameter(PARM_REPLY, EDataType.NText, keywordInfo.Reply),
                GetParameter(PARM_ADD_DATE, EDataType.DateTime, keywordInfo.AddDate),
                GetParameter(PARM_TAXIS, EDataType.Integer, taxis)
            };

            using (var conn = GetConnection())
            {
                conn.Open();
                using (var trans = conn.BeginTransaction())
                {
                    try
                    {
                        ExecuteNonQuery(trans, sqlString, parms);
                        keywordID = BaiRongDataProvider.DatabaseDao.GetSequence(trans, "wx_Keyword");
                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        throw;
                    }
                }
            }

            foreach (var str in TranslateUtils.StringCollectionToStringList(keywordInfo.Keywords, ' '))
            {
                var keyword = str.Trim();
                if (!string.IsNullOrEmpty(keyword))
                {
                    DataProviderWX.KeywordMatchDAO.Insert(new KeywordMatchInfo(0, keywordInfo.PublishmentSystemID, keyword, keywordID, keywordInfo.IsDisabled, keywordInfo.KeywordType, keywordInfo.MatchType));
                }
            }

            return(keywordID);
        }
Пример #7
0
        public int Insert(KeywordInfo keywordInfo)
        {
            var keywordId = 0;

            var sqlString = "INSERT INTO wx_Keyword (PublishmentSystemID, Keywords, IsDisabled, KeywordType, MatchType, Reply, AddDate, Taxis) VALUES (@PublishmentSystemID, @Keywords, @IsDisabled, @KeywordType, @MatchType, @Reply, @AddDate, @Taxis)";

            var taxis = GetMaxTaxis(keywordInfo.PublishmentSystemId, keywordInfo.KeywordType) + 1;
            var parms = new IDataParameter[]
            {
                GetParameter(ParmPublishmentSystemId, EDataType.Integer, keywordInfo.PublishmentSystemId),
                GetParameter(ParmKeywords, EDataType.NVarChar, 255, keywordInfo.Keywords),
                GetParameter(ParmIsDisabled, EDataType.VarChar, 18, keywordInfo.IsDisabled.ToString()),
                GetParameter(ParmKeywordType, EDataType.VarChar, 50, EKeywordTypeUtils.GetValue(keywordInfo.KeywordType)),
                GetParameter(ParmMatchType, EDataType.VarChar, 50, EMatchTypeUtils.GetValue(keywordInfo.MatchType)),
                GetParameter(ParmReply, EDataType.NText, keywordInfo.Reply),
                GetParameter(ParmAddDate, EDataType.DateTime, keywordInfo.AddDate),
                GetParameter(ParmTaxis, EDataType.Integer, taxis)
            };

            using (var conn = GetConnection())
            {
                conn.Open();
                using (var trans = conn.BeginTransaction())
                {
                    try
                    {
                        keywordId = ExecuteNonQueryAndReturnId(trans, sqlString, parms);
                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        throw;
                    }
                }
            }

            foreach (var str in TranslateUtils.StringCollectionToStringList(keywordInfo.Keywords, ' '))
            {
                var keyword = str.Trim();
                if (!string.IsNullOrEmpty(keyword))
                {
                    DataProviderWx.KeywordMatchDao.Insert(new KeywordMatchInfo(0, keywordInfo.PublishmentSystemId, keyword, keywordId, keywordInfo.IsDisabled, keywordInfo.KeywordType, keywordInfo.MatchType));
                }
            }

            return(keywordId);
        }
Пример #8
0
        public void Insert(KeywordMatchInfo matchInfo)
        {
            var sqlString = "INSERT INTO wx_KeywordMatch (PublishmentSystemID, Keyword, KeywordID, IsDisabled, KeywordType, MatchType) VALUES (@PublishmentSystemID, @Keyword, @KeywordID, @IsDisabled, @KeywordType, @MatchType)";

            var parms = new IDataParameter[]
            {
                GetParameter(PARM_PUBLISHMENT_SYSTEM_ID, EDataType.Integer, matchInfo.PublishmentSystemID),
                GetParameter(PARM_KEYWORD, EDataType.NVarChar, 255, matchInfo.Keyword),
                GetParameter(PARM_KEYWORD_ID, EDataType.Integer, matchInfo.KeywordID),
                GetParameter(PARM_IS_DISABLED, EDataType.VarChar, 18, matchInfo.IsDisabled.ToString()),
                GetParameter(PARM_KEYWORD_TYPE, EDataType.VarChar, 50, EKeywordTypeUtils.GetValue(matchInfo.KeywordType)),
                GetParameter(PARM_MATCH_TYPE, EDataType.VarChar, 50, EMatchTypeUtils.GetValue(matchInfo.MatchType))
            };

            ExecuteNonQuery(sqlString, parms);
        }
Пример #9
0
        public void Insert(KeywordMatchInfo matchInfo)
        {
            var sqlString = "INSERT INTO wx_KeywordMatch (PublishmentSystemID, Keyword, KeywordID, IsDisabled, KeywordType, MatchType) VALUES (@PublishmentSystemID, @Keyword, @KeywordID, @IsDisabled, @KeywordType, @MatchType)";

            var parms = new IDataParameter[]
            {
                GetParameter(ParmPublishmentSystemId, EDataType.Integer, matchInfo.PublishmentSystemId),
                GetParameter(ParmKeyword, EDataType.NVarChar, 255, matchInfo.Keyword),
                GetParameter(ParmKeywordId, EDataType.Integer, matchInfo.KeywordId),
                GetParameter(ParmIsDisabled, EDataType.VarChar, 18, matchInfo.IsDisabled.ToString()),
                GetParameter(ParmKeywordType, EDataType.VarChar, 50, EKeywordTypeUtils.GetValue(matchInfo.KeywordType)),
                GetParameter(ParmMatchType, EDataType.VarChar, 50, EMatchTypeUtils.GetValue(matchInfo.MatchType))
            };

            ExecuteNonQuery(sqlString, parms);
        }
Пример #10
0
        public List <string> GetKeywordList(int publishmentSystemID, EKeywordType keywordType)
        {
            var list = new List <string>();

            var parms = new IDataParameter[]
            {
                GetParameter(PARM_PUBLISHMENT_SYSTEM_ID, EDataType.Integer, publishmentSystemID),
                GetParameter(PARM_KEYWORD_TYPE, EDataType.VarChar, 50, EKeywordTypeUtils.GetValue(keywordType))
            };

            using (var rdr = ExecuteReader(SQL_SELECT_KEYOWRD_BY_TYPE, parms))
            {
                while (rdr.Read())
                {
                    list.Add(rdr.GetValue(0).ToString());
                }
                rdr.Close();
            }

            return(list);
        }
Пример #11
0
        public List <string> GetKeywordList(int publishmentSystemId, EKeywordType keywordType)
        {
            var list = new List <string>();

            var parms = new IDataParameter[]
            {
                GetParameter(ParmPublishmentSystemId, EDataType.Integer, publishmentSystemId),
                GetParameter(ParmKeywordType, EDataType.VarChar, 50, EKeywordTypeUtils.GetValue(keywordType))
            };

            using (var rdr = ExecuteReader(SqlSelectKeyowrdByType, parms))
            {
                while (rdr.Read())
                {
                    list.Add(rdr.GetValue(0).ToString());
                }
                rdr.Close();
            }

            return(list);
        }
Пример #12
0
        public void Update(int publishmentSystemId, int keywordId, EKeywordType keywordType, EMatchType matchType, string keywords)
        {
            var parms = new IDataParameter[]
            {
                GetParameter(ParmKeywords, EDataType.NVarChar, 255, keywords),
                GetParameter(ParmKeywordType, EDataType.VarChar, 50, EKeywordTypeUtils.GetValue(keywordType)),
                GetParameter(ParmKeywordId, EDataType.Integer, keywordId)
            };

            ExecuteNonQuery(SqlUpdateKeywrods, parms);

            DataProviderWx.KeywordMatchDao.DeleteByKeywordId(keywordId);

            foreach (var str in TranslateUtils.StringCollectionToStringList(keywords, ' '))
            {
                var keyword = str.Trim();
                if (!string.IsNullOrEmpty(keyword))
                {
                    DataProviderWx.KeywordMatchDao.Insert(new KeywordMatchInfo(0, publishmentSystemId, keyword, keywordId, false, keywordType, matchType));
                }
            }
        }
Пример #13
0
        public KeywordInfo GetAvaliableKeywordInfo(int publishmentSystemId, EKeywordType keywordType)
        {
            KeywordInfo keywordInfo = null;

            var parms = new IDataParameter[]
            {
                GetParameter(ParmPublishmentSystemId, EDataType.Integer, publishmentSystemId),
                GetParameter(ParmIsDisabled, EDataType.VarChar, 18, false.ToString()),
                GetParameter(ParmKeywordType, EDataType.VarChar, 50, EKeywordTypeUtils.GetValue(keywordType))
            };

            using (var rdr = ExecuteReader(SqlSelectAvaliable, parms))
            {
                if (rdr.Read())
                {
                    keywordInfo = new KeywordInfo(rdr.GetInt32(0), rdr.GetInt32(1), rdr.GetValue(2).ToString(), TranslateUtils.ToBool(rdr.GetValue(3).ToString()), EKeywordTypeUtils.GetEnumType(rdr.GetValue(4).ToString()), EMatchTypeUtils.GetEnumType(rdr.GetValue(5).ToString()), rdr.GetValue(6).ToString(), rdr.GetDateTime(7), rdr.GetInt32(8));
                }
                rdr.Close();
            }

            return(keywordInfo);
        }
Пример #14
0
        public List <KeywordInfo> GetKeywordInfoList(int publishmentSystemID, EKeywordType keywordType)
        {
            var list = new List <KeywordInfo>();

            var parms = new IDataParameter[]
            {
                GetParameter(PARM_PUBLISHMENT_SYSTEM_ID, EDataType.Integer, publishmentSystemID),
                GetParameter(PARM_KEYWORD_TYPE, EDataType.VarChar, 50, EKeywordTypeUtils.GetValue(keywordType))
            };

            using (var rdr = ExecuteReader(SQL_SELECT_ALL_BY_TYPE, parms))
            {
                while (rdr.Read())
                {
                    var keywordInfo = new KeywordInfo(rdr.GetInt32(0), rdr.GetInt32(1), rdr.GetValue(2).ToString(), TranslateUtils.ToBool(rdr.GetValue(3).ToString()), EKeywordTypeUtils.GetEnumType(rdr.GetValue(4).ToString()), EMatchTypeUtils.GetEnumType(rdr.GetValue(5).ToString()), rdr.GetValue(6).ToString(), rdr.GetDateTime(7), rdr.GetInt32(8));
                    list.Add(keywordInfo);
                }
                rdr.Close();
            }

            return(list);
        }
Пример #15
0
        public KeywordInfo GetAvaliableKeywordInfo(int publishmentSystemID, EKeywordType keywordType)
        {
            KeywordInfo keywordInfo = null;

            var parms = new IDataParameter[]
            {
                GetParameter(PARM_PUBLISHMENT_SYSTEM_ID, EDataType.Integer, publishmentSystemID),
                GetParameter(PARM_IS_DISABLED, EDataType.VarChar, 18, false.ToString()),
                GetParameter(PARM_KEYWORD_TYPE, EDataType.VarChar, 50, EKeywordTypeUtils.GetValue(keywordType))
            };

            using (var rdr = ExecuteReader(SQL_SELECT_AVALIABLE, parms))
            {
                if (rdr.Read())
                {
                    keywordInfo = new KeywordInfo(rdr.GetInt32(0), rdr.GetInt32(1), rdr.GetValue(2).ToString(), TranslateUtils.ToBool(rdr.GetValue(3).ToString()), EKeywordTypeUtils.GetEnumType(rdr.GetValue(4).ToString()), EMatchTypeUtils.GetEnumType(rdr.GetValue(5).ToString()), rdr.GetValue(6).ToString(), rdr.GetDateTime(7), rdr.GetInt32(8));
                }
                rdr.Close();
            }

            return(keywordInfo);
        }
Пример #16
0
        public void Update(int publishmentSystemID, int keywordID, EKeywordType keywordType, EMatchType matchType, string keywords)
        {
            var parms = new IDataParameter[]
            {
                GetParameter(PARM_KEYWORDS, EDataType.NVarChar, 255, keywords),
                GetParameter(PARM_KEYWORD_TYPE, EDataType.VarChar, 50, EKeywordTypeUtils.GetValue(keywordType)),
                GetParameter(PARM_KEYWORD_ID, EDataType.Integer, keywordID)
            };

            ExecuteNonQuery(SQL_UPDATE_KEYWRODS, parms);

            DataProviderWX.KeywordMatchDAO.DeleteByKeywordID(keywordID);

            foreach (var str in TranslateUtils.StringCollectionToStringList(keywords, ' '))
            {
                var keyword = str.Trim();
                if (!string.IsNullOrEmpty(keyword))
                {
                    DataProviderWX.KeywordMatchDAO.Insert(new KeywordMatchInfo(0, publishmentSystemID, keyword, keywordID, false, keywordType, matchType));
                }
            }
        }
Пример #17
0
        public List <KeywordInfo> GetKeywordInfoList(int publishmentSystemId, EKeywordType keywordType)
        {
            var list = new List <KeywordInfo>();

            var parms = new IDataParameter[]
            {
                GetParameter(ParmPublishmentSystemId, EDataType.Integer, publishmentSystemId),
                GetParameter(ParmKeywordType, EDataType.VarChar, 50, EKeywordTypeUtils.GetValue(keywordType))
            };

            using (var rdr = ExecuteReader(SqlSelectAllByType, parms))
            {
                while (rdr.Read())
                {
                    var keywordInfo = new KeywordInfo(rdr.GetInt32(0), rdr.GetInt32(1), rdr.GetValue(2).ToString(), TranslateUtils.ToBool(rdr.GetValue(3).ToString()), EKeywordTypeUtils.GetEnumType(rdr.GetValue(4).ToString()), EMatchTypeUtils.GetEnumType(rdr.GetValue(5).ToString()), rdr.GetValue(6).ToString(), rdr.GetDateTime(7), rdr.GetInt32(8));
                    list.Add(keywordInfo);
                }
                rdr.Close();
            }

            return(list);
        }
Пример #18
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemId");
            _appointmentId     = Body.GetQueryInt("appointmentID");
            _appointmentItemId = Body.GetQueryInt("appointmentItemID");

            var selectImageClick  = ModalSelectImage.GetOpenWindowString(PublishmentSystemInfo, TbContentImageUrl.ClientID);
            var uploadImageClick  = ModalUploadImageSingle.GetOpenWindowStringToTextBox(PublishmentSystemId, TbContentImageUrl.ClientID);
            var cuttingImageClick = ModalCuttingImage.GetOpenWindowStringWithTextBox(PublishmentSystemId, TbContentImageUrl.ClientID);
            var previewImageClick = ModalMessage.GetOpenWindowStringToPreviewImage(PublishmentSystemId, TbContentImageUrl.ClientID);

            LtlContentImageUrl.Text = $@"
                      <a class=""btn"" href=""javascript:;"" onclick=""{selectImageClick};return false;"" title=""选择""><i class=""icon-th""></i></a>
                      <a class=""btn"" href=""javascript:;"" onclick=""{uploadImageClick};return false;"" title=""上传""><i class=""icon-arrow-up""></i></a>
                      <a class=""btn"" href=""javascript:;"" onclick=""{cuttingImageClick};return false;"" title=""裁切""><i class=""icon-crop""></i></a>
                      <a class=""btn"" href=""javascript:;"" onclick=""{previewImageClick};return false;"" title=""预览""><i class=""icon-eye-open""></i></a>";

            var selectVideoClick  = ModalSelectVideo.GetOpenWindowString(PublishmentSystemInfo, TbContentVideoUrl.ClientID);
            var uploadVideoClick  = ModalUploadVideo.GetOpenWindowStringToTextBox(PublishmentSystemId, TbContentVideoUrl.ClientID);
            var previewVideoClick = ModalMessage.GetOpenWindowStringToPreviewVideoByUrl(PublishmentSystemId, TbContentVideoUrl.ClientID);

            LtlContentVideoUrl.Text = $@"
                      <a class=""btn"" href=""javascript:;"" onclick=""{selectVideoClick};return false;"" title=""选择""><i class=""icon-th""></i></a>
                      <a class=""btn"" href=""javascript:;"" onclick=""{uploadVideoClick};return false;"" title=""上传""><i class=""icon-arrow-up""></i></a>
                      <a class=""btn"" href=""javascript:;"" onclick=""{previewVideoClick};return false;"" title=""预览""><i class=""icon-eye-open""></i></a>";

            if (!IsPostBack)
            {
                var pageTitle = _appointmentId > 0 ? "编辑微预约" : "添加微预约";
                BreadCrumb(AppManager.WeiXin.LeftMenu.IdFunction, AppManager.WeiXin.LeftMenu.Function.IdAppointment, pageTitle, AppManager.WeiXin.Permission.WebSite.Appointment);
                LtlPageTitle.Text = pageTitle;

                LtlImageUrl.Text =
                    $@"<img id=""preview_imageUrl"" src=""{AppointmentManager.GetImageUrl(PublishmentSystemInfo,
                        string.Empty)}"" width=""370"" align=""middle"" />";
                LtlTopImageUrl.Text =
                    $@"<img id=""preview_topImageUrl"" src=""{AppointmentManager.GetItemTopImageUrl(
                        PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />";
                LtlResultTopImageUrl.Text =
                    $@"<img id=""preview_resultTopImageUrl"" src=""{AppointmentManager.GetContentResultTopImageUrl(
                        PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />";
                LtlContentImageUrl.Text =
                    $@"<img id=""preview_contentImageUrl"" src=""{AppointmentManager.GetContentImageUrl(
                        PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />";

                LtlEndImageUrl.Text =
                    $@"<img id=""preview_endImageUrl"" src=""{AppointmentManager.GetEndImageUrl(PublishmentSystemInfo,
                        string.Empty)}"" width=""370"" align=""middle"" />";

                if (_appointmentId == 0)
                {
                    DtbEndDate.DateTime = DateTime.Now.AddMonths(1);
                }
                else
                {
                    var appointmentInfo = DataProviderWx.AppointmentDao.GetAppointmentInfo(_appointmentId);

                    if (appointmentInfo != null)
                    {
                        TbKeywords.Text       = DataProviderWx.KeywordDao.GetKeywords(appointmentInfo.KeywordId);
                        CbIsEnabled.Checked   = !appointmentInfo.IsDisabled;
                        DtbStartDate.DateTime = appointmentInfo.StartDate;
                        DtbEndDate.DateTime   = appointmentInfo.EndDate;
                        TbTitle.Text          = appointmentInfo.Title;
                        if (!string.IsNullOrEmpty(appointmentInfo.ImageUrl))
                        {
                            LtlImageUrl.Text =
                                $@"<img id=""preview_imageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                    PublishmentSystemInfo, appointmentInfo.ImageUrl)}"" width=""370"" align=""middle"" />";
                        }
                        if (!string.IsNullOrEmpty(appointmentInfo.ContentResultTopImageUrl))
                        {
                            LtlResultTopImageUrl.Text =
                                $@"<img id=""preview_resultTopImageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                    PublishmentSystemInfo, appointmentInfo.ContentResultTopImageUrl)}"" width=""370"" align=""middle"" />";
                        }

                        TbSummary.Text = appointmentInfo.Summary;

                        TbEndTitle.Text   = appointmentInfo.EndTitle;
                        TbEndSummary.Text = appointmentInfo.EndSummary;
                        if (!string.IsNullOrEmpty(appointmentInfo.EndImageUrl))
                        {
                            LtlEndImageUrl.Text =
                                $@"<img id=""preview_endImageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                    PublishmentSystemInfo, appointmentInfo.EndImageUrl)}"" width=""370"" align=""middle"" />";
                        }

                        ImageUrl.Value          = appointmentInfo.ImageUrl;
                        ContentImageUrl.Value   = appointmentInfo.ContentImageUrl;
                        ResultTopImageUrl.Value = appointmentInfo.ContentResultTopImageUrl;
                        EndImageUrl.Value       = appointmentInfo.EndImageUrl;
                        #region 拓展属性
                        #region 姓名
                        if (appointmentInfo.IsFormRealName == "True")
                        {
                            CbIsFormRealName.Checked = true;
                            TbFormRealNameTitle.Text = appointmentInfo.FormRealNameTitle;
                        }
                        else if (string.IsNullOrEmpty(appointmentInfo.IsFormRealName))
                        {
                            CbIsFormRealName.Checked = true;
                            TbFormRealNameTitle.Text = "姓名";
                        }
                        else
                        {
                            CbIsFormRealName.Checked = false;
                            TbFormRealNameTitle.Text = appointmentInfo.FormRealNameTitle;
                        }
                        #endregion
                        #region 电话
                        if (appointmentInfo.IsFormMobile == "True")
                        {
                            CbIsFormMobile.Checked = true;
                            TbFormMobileTitle.Text = appointmentInfo.FormMobileTitle;
                        }
                        else if (string.IsNullOrEmpty(appointmentInfo.IsFormMobile))
                        {
                            CbIsFormMobile.Checked = true;
                            TbFormMobileTitle.Text = "电话";
                        }
                        else
                        {
                            CbIsFormMobile.Checked = false;
                            TbFormMobileTitle.Text = appointmentInfo.FormMobileTitle;
                        }
                        #endregion
                        #region 邮箱
                        if (appointmentInfo.IsFormEmail == "True")
                        {
                            CbIsFormEmail.Checked = true;
                            TbFormEmailTitle.Text = appointmentInfo.FormEmailTitle;
                        }
                        else if (string.IsNullOrEmpty(appointmentInfo.IsFormEmail))
                        {
                            CbIsFormEmail.Checked = true;
                            TbFormEmailTitle.Text = "电话";
                        }
                        else
                        {
                            CbIsFormEmail.Checked = false;
                            TbFormEmailTitle.Text = appointmentInfo.FormEmailTitle;
                        }
                        #endregion

                        _appointmentItemId = DataProviderWx.AppointmentItemDao.GetItemId(PublishmentSystemId, _appointmentId);

                        var configExtendInfoList = DataProviderWx.ConfigExtendDao.GetConfigExtendInfoList(PublishmentSystemId, appointmentInfo.Id, EKeywordTypeUtils.GetValue(EKeywordType.Appointment));
                        var itemBuilder          = new StringBuilder();
                        foreach (var configExtendInfo in configExtendInfoList)
                        {
                            if (string.IsNullOrEmpty(configExtendInfo.IsVisible))
                            {
                                configExtendInfo.IsVisible = "checked=checked";
                            }
                            else if (configExtendInfo.IsVisible == "True")
                            {
                                configExtendInfo.IsVisible = "checked=checked";
                            }
                            else
                            {
                                configExtendInfo.IsVisible = "";
                            }
                            itemBuilder.AppendFormat(@"{{id: '{0}', attributeName: '{1}',isVisible:'{2}'}},", configExtendInfo.Id, configExtendInfo.AttributeName, configExtendInfo.IsVisible);
                        }
                        if (itemBuilder.Length > 0)
                        {
                            itemBuilder.Length--;
                        }
                        LtlAwardItems.Text =
                            $@"itemController.itemCount = {configExtendInfoList.Count};itemController.items = [{itemBuilder}];";
                        #endregion
                    }
                }

                if (_appointmentItemId > 0)
                {
                    var appointmentItemInfo = DataProviderWx.AppointmentItemDao.GetItemInfo(_appointmentItemId);
                    if (appointmentItemInfo != null)
                    {
                        TbItemTitle.Text               = appointmentItemInfo.Title;
                        TopImageUrl.Value              = appointmentItemInfo.TopImageUrl;
                        CbIsDescription.Checked        = appointmentItemInfo.IsDescription;
                        TbDescriptionTitle.Text        = appointmentItemInfo.DescriptionTitle;
                        TbDescription.Text             = appointmentItemInfo.Description;
                        CbIsImageUrl.Checked           = appointmentItemInfo.IsImageUrl;
                        TbImageUrlTitle.Text           = appointmentItemInfo.ImageUrlTitle;
                        TbContentImageUrl.Text         = appointmentItemInfo.ImageUrl;
                        CbIsVideoUrl.Checked           = appointmentItemInfo.IsVideoUrl;
                        TbVideoUrlTitle.Text           = appointmentItemInfo.VideoUrlTitle;
                        TbContentVideoUrl.Text         = appointmentItemInfo.VideoUrl;
                        CbIsImageUrlCollection.Checked = appointmentItemInfo.IsImageUrlCollection;
                        TbImageUrlCollectionTitle.Text = appointmentItemInfo.ImageUrlCollectionTitle;
                        ImageUrlCollection.Value       = appointmentItemInfo.ImageUrlCollection;
                        LargeImageUrlCollection.Value  = appointmentItemInfo.LargeImageUrlCollection;
                        CbIsMap.Checked   = appointmentItemInfo.IsMap;
                        TbMapTitle.Text   = appointmentItemInfo.MapTitle;
                        TbMapAddress.Text = appointmentItemInfo.MapAddress;
                        CbIsTel.Checked   = appointmentItemInfo.IsTel;
                        TbTelTitle.Text   = appointmentItemInfo.TelTitle;
                        TbTel.Text        = appointmentItemInfo.Tel;


                        if (!string.IsNullOrEmpty(appointmentItemInfo.TopImageUrl))
                        {
                            LtlTopImageUrl.Text =
                                $@"<img id=""preview_imageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                    PublishmentSystemInfo, appointmentItemInfo.TopImageUrl)}"" width=""370"" align=""middle"" />";
                        }
                        if (!string.IsNullOrEmpty(appointmentItemInfo.MapAddress))
                        {
                            LtlMap.Text =
                                $@"<iframe style=""width:100%;height:100%;background-color:#ffffff;margin-bottom:15px;"" scrolling=""auto"" frameborder=""0"" width=""100%"" height=""100%"" src=""{MapManager.GetMapUrl(PublishmentSystemInfo, TbMapAddress.Text)}""></iframe>";
                        }
                        if (!string.IsNullOrEmpty(appointmentItemInfo.ImageUrlCollection))
                        {
                            var scriptBuilder = new StringBuilder();
                            scriptBuilder.AppendFormat(@"
addImage('{0}','{1}');
", appointmentItemInfo.ImageUrlCollection, appointmentItemInfo.LargeImageUrlCollection);

                            LtlScript.Text = $@"
$(document).ready(function(){{
	{scriptBuilder}
}});
";
                        }
                    }
                }

                BtnReturn.Attributes.Add("onclick",
                                         $@"location.href=""{PageAppointment.GetRedirectUrl(PublishmentSystemId)}"";return false");
            }
        }
Пример #19
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;
                }
                else if (phStep3.Visible)
                {
                    selectedStep = 3;
                }
                else if (phStep4.Visible)
                {
                    selectedStep = 4;
                }

                phStep1.Visible = phStep2.Visible = phStep3.Visible = false;

                if (selectedStep == 1)
                {
                    var isConflict       = false;
                    var conflictKeywords = string.Empty;
                    if (!string.IsNullOrEmpty(tbKeywords.Text))
                    {
                        if (appointmentID > 0)
                        {
                            var appointmentInfo = DataProviderWX.AppointmentDAO.GetAppointmentInfo(appointmentID);
                            isConflict = KeywordManager.IsKeywordUpdateConflict(PublishmentSystemId, appointmentInfo.KeywordID, PageUtils.FilterXss(tbKeywords.Text), out conflictKeywords);
                        }
                        else
                        {
                            isConflict = KeywordManager.IsKeywordInsertConflict(PublishmentSystemId, PageUtils.FilterXss(tbKeywords.Text), out conflictKeywords);
                        }
                    }

                    if (isConflict)
                    {
                        FailMessage($"触发关键词“{conflictKeywords}”已存在,请设置其他关键词");
                    }
                    else
                    {
                        phStep2.Visible = true;
                    }
                }
                else if (selectedStep == 2)
                {
                    var isItemReady         = true;
                    var appointmentItemInfo = new AppointmentItemInfo();
                    appointmentItemInfo.PublishmentSystemID = PublishmentSystemId;
                    if (appointmentItemID > 0)
                    {
                        appointmentItemInfo = DataProviderWX.AppointmentItemDAO.GetItemInfo(appointmentItemID);
                    }

                    appointmentItemInfo.AppointmentID           = appointmentID;
                    appointmentItemInfo.Title                   = PageUtils.FilterXss(tbItemTitle.Text);
                    appointmentItemInfo.TopImageUrl             = topImageUrl.Value;
                    appointmentItemInfo.IsDescription           = cbIsDescription.Checked;
                    appointmentItemInfo.DescriptionTitle        = tbDescriptionTitle.Text;
                    appointmentItemInfo.Description             = tbDescription.Text;
                    appointmentItemInfo.IsImageUrl              = cbIsImageUrl.Checked;
                    appointmentItemInfo.ImageUrlTitle           = tbImageUrlTitle.Text;
                    appointmentItemInfo.ImageUrl                = tbContentImageUrl.Text;
                    appointmentItemInfo.IsVideoUrl              = cbIsVideoUrl.Checked;
                    appointmentItemInfo.VideoUrlTitle           = tbVideoUrlTitle.Text;
                    appointmentItemInfo.VideoUrl                = tbContentVideoUrl.Text;
                    appointmentItemInfo.IsImageUrlCollection    = cbIsImageUrlCollection.Checked;
                    appointmentItemInfo.ImageUrlCollectionTitle = tbImageUrlCollectionTitle.Text;
                    appointmentItemInfo.ImageUrlCollection      = imageUrlCollection.Value;
                    appointmentItemInfo.LargeImageUrlCollection = largeImageUrlCollection.Value;
                    appointmentItemInfo.IsMap                   = cbIsMap.Checked;
                    appointmentItemInfo.MapTitle                = tbMapTitle.Text;
                    appointmentItemInfo.MapAddress              = tbMapAddress.Text;
                    appointmentItemInfo.IsTel                   = cbIsTel.Checked;
                    appointmentItemInfo.TelTitle                = tbTelTitle.Text;
                    appointmentItemInfo.Tel = tbTel.Text;

                    try
                    {
                        if (appointmentItemID > 0)
                        {
                            DataProviderWX.AppointmentItemDAO.Update(appointmentItemInfo);
                            Body.AddLog(PublishmentSystemId, "修改预约项目", $"预约项目:{tbTitle.Text}");
                        }
                        else
                        {
                            appointmentItemID = DataProviderWX.AppointmentItemDAO.Insert(appointmentItemInfo);

                            Body.AddLog(PublishmentSystemId, "新增预约项目", $"预约项目:{tbTitle.Text}");
                        }
                    }
                    catch (Exception ex)
                    {
                        isItemReady = false;
                        FailMessage(ex, "微预约项目设置失败!");
                    }

                    if (isItemReady)
                    {
                        phStep3.Visible = true;
                    }
                    else
                    {
                        phStep2.Visible = true;
                    }
                }
                else if (selectedStep == 3)
                {
                    var isItemReady = true;
                    var itemCount   = TranslateUtils.ToInt(Request.Form["itemCount"]);

                    var itemIDList        = TranslateUtils.StringCollectionToIntList(Request.Form["itemID"]);
                    var attributeNameList = TranslateUtils.StringCollectionToStringList(Request.Form["itemAttributeName"]);

                    var itemIsVisible = "off";
                    if (!string.IsNullOrEmpty(Request.Form["itemIsVisible"]))
                    {
                        itemIsVisible = Request.Form["itemIsVisible"];
                    }

                    var isVisibleList = TranslateUtils.StringCollectionToStringList(itemIsVisible);

                    if (isVisibleList.Count < itemIDList.Count)
                    {
                        for (var i = isVisibleList.Count; i < itemIDList.Count; i++)
                        {
                            isVisibleList.Add("off");
                        }
                    }

                    var configExtendInfoList = new List <ConfigExtendInfo>();
                    for (var i = 0; i < itemCount; i++)
                    {
                        var configExtendInfo = new ConfigExtendInfo {
                            ID = itemIDList[i], PublishmentSystemID = PublishmentSystemId, KeywordType = EKeywordTypeUtils.GetValue(EKeywordType.Appointment), FunctionID = appointmentID, AttributeName = attributeNameList[i], IsVisible = isVisibleList[i]
                        };

                        if (string.IsNullOrEmpty(configExtendInfo.AttributeName))
                        {
                            FailMessage("保存失败,属性名称为必填项");
                            isItemReady = false;
                        }
                        if (string.IsNullOrEmpty(configExtendInfo.IsVisible))
                        {
                            FailMessage("保存失败,是否必填为显示项");
                            isItemReady = false;
                        }

                        if (configExtendInfo.IsVisible == "on")
                        {
                            configExtendInfo.IsVisible = "True";
                        }
                        else
                        {
                            configExtendInfo.IsVisible = "False";
                        }

                        configExtendInfoList.Add(configExtendInfo);
                    }

                    if (isItemReady)
                    {
                        DataProviderWX.ConfigExtendDAO.DeleteAllNotInIDList(PublishmentSystemId, appointmentID, itemIDList);

                        foreach (var configExtendInfo in configExtendInfoList)
                        {
                            if (configExtendInfo.ID > 0)
                            {
                                DataProviderWX.ConfigExtendDAO.Update(configExtendInfo);
                            }
                            else
                            {
                                DataProviderWX.ConfigExtendDAO.Insert(configExtendInfo);
                            }
                        }
                    }

                    if (isItemReady)
                    {
                        phStep4.Visible = true;
                        btnSubmit.Text  = "确 认";
                    }
                    else
                    {
                        phStep3.Visible = true;
                    }
                }
                else if (selectedStep == 4)
                {
                    var appointmentInfo = new AppointmentInfo();
                    appointmentInfo.PublishmentSystemID = PublishmentSystemId;

                    if (appointmentID > 0)
                    {
                        appointmentInfo = DataProviderWX.AppointmentDAO.GetAppointmentInfo(appointmentID);
                        DataProviderWX.KeywordDAO.Update(PublishmentSystemId, appointmentInfo.KeywordID, EKeywordType.Appointment, EMatchType.Exact, tbKeywords.Text, !cbIsEnabled.Checked);
                    }
                    else
                    {
                        var keywordInfo = new KeywordInfo();

                        keywordInfo.KeywordID           = 0;
                        keywordInfo.PublishmentSystemID = PublishmentSystemId;
                        keywordInfo.Keywords            = tbKeywords.Text;
                        keywordInfo.IsDisabled          = !cbIsEnabled.Checked;
                        keywordInfo.KeywordType         = EKeywordType.Appointment;
                        keywordInfo.MatchType           = EMatchType.Exact;
                        keywordInfo.Reply   = string.Empty;
                        keywordInfo.AddDate = DateTime.Now;
                        keywordInfo.Taxis   = 0;

                        appointmentInfo.KeywordID = DataProviderWX.KeywordDAO.Insert(keywordInfo);
                    }

                    appointmentInfo.StartDate = dtbStartDate.DateTime;
                    appointmentInfo.EndDate   = dtbEndDate.DateTime;
                    appointmentInfo.Title     = tbTitle.Text;
                    appointmentInfo.ImageUrl  = imageUrl.Value;
                    appointmentInfo.ContentResultTopImageUrl = resultTopImageUrl.Value;
                    appointmentInfo.Summary         = tbSummary.Text;
                    appointmentInfo.ContentIsSingle = true;
                    appointmentInfo.EndTitle        = tbEndTitle.Text;
                    appointmentInfo.EndImageUrl     = endImageUrl.Value;
                    appointmentInfo.EndSummary      = tbEndSummary.Text;

                    appointmentInfo.IsFormRealName    = cbIsFormRealName.Checked ? "True" : "False";
                    appointmentInfo.FormRealNameTitle = tbFormRealNameTitle.Text;
                    appointmentInfo.IsFormMobile      = cbIsFormMobile.Checked ? "True" : "False";
                    appointmentInfo.FormMobileTitle   = tbFormMobileTitle.Text;
                    appointmentInfo.IsFormEmail       = cbIsFormEmail.Checked ? "True" : "False";
                    appointmentInfo.FormEmailTitle    = tbFormEmailTitle.Text;

                    try
                    {
                        if (appointmentID > 0)
                        {
                            DataProviderWX.AppointmentDAO.Update(appointmentInfo);

                            Body.AddLog(PublishmentSystemId, "修改微预约", $"微预约:{tbTitle.Text}");
                            SuccessMessage("修改微预约成功!");
                        }
                        else
                        {
                            appointmentID = DataProviderWX.AppointmentDAO.Insert(appointmentInfo);
                            DataProviderWX.AppointmentItemDAO.UpdateAppointmentID(PublishmentSystemId, appointmentID);
                            DataProviderWX.ConfigExtendDAO.UpdateFuctionID(PublishmentSystemId, appointmentID);
                            Body.AddLog(PublishmentSystemId, "添加微预约", $"微预约:{tbTitle.Text}");
                            SuccessMessage("添加微预约成功!");
                        }

                        AddWaitAndRedirectScript(PageAppointment.GetRedirectUrl(PublishmentSystemId));
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, "微预约设置失败!");
                    }

                    btnSubmit.Visible = false;
                    btnReturn.Visible = false;
                }
            }
        }
Пример #20
0
        private int GetMaxTaxis(int publishmentSystemID, EKeywordType keywordType)
        {
            string sqlString =
                $"SELECT MAX(Taxis) FROM wx_Keyword WHERE PublishmentSystemID = {publishmentSystemID} AND KeywordType = '{EKeywordTypeUtils.GetValue(keywordType)}'";

            return(BaiRongDataProvider.DatabaseDao.GetIntResult(sqlString));
        }
Пример #21
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;
                }
                else if (PhStep3.Visible)
                {
                    selectedStep = 3;
                }
                else if (PhStep4.Visible)
                {
                    selectedStep = 4;
                }
                else if (PhStep5.Visible)
                {
                    selectedStep = 5;
                }

                PhStep1.Visible = false;
                PhStep2.Visible = false;
                PhStep3.Visible = false;
                PhStep4.Visible = false;
                PhStep5.Visible = false;

                if (selectedStep == 1)
                {
                    var isConflict       = false;
                    var conflictKeywords = string.Empty;
                    if (!string.IsNullOrEmpty(TbKeywords.Text))
                    {
                        if (_appointmentId > 0)
                        {
                            var appointmentInfo = DataProviderWx.AppointmentDao.GetAppointmentInfo(_appointmentId);
                            isConflict = KeywordManager.IsKeywordUpdateConflict(PublishmentSystemId, appointmentInfo.KeywordId, TbKeywords.Text, out conflictKeywords);
                        }
                        else
                        {
                            isConflict = KeywordManager.IsKeywordInsertConflict(PublishmentSystemId, TbKeywords.Text, out conflictKeywords);
                        }
                    }

                    if (isConflict)
                    {
                        FailMessage($"触发关键词“{conflictKeywords}”已存在,请设置其他关键词");
                        PhStep1.Visible = true;
                    }
                    else
                    {
                        PhStep2.Visible = true;
                    }
                }
                else if (selectedStep == 2)
                {
                    PhStep3.Visible = true;
                }
                else if (selectedStep == 3)
                {
                    PhStep4.Visible = true;
                }
                else if (selectedStep == 4)
                {
                    var isItemReady = true;
                    var itemCount   = TranslateUtils.ToInt(Request.Form["itemCount"]);

                    var itemIdList        = TranslateUtils.StringCollectionToIntList(Request.Form["itemID"]);
                    var attributeNameList = TranslateUtils.StringCollectionToStringList(Request.Form["itemAttributeName"]);

                    var itemIsVisible = "off";
                    if (!string.IsNullOrEmpty(Request.Form["itemIsVisible"]))
                    {
                        itemIsVisible = Request.Form["itemIsVisible"];
                    }

                    var isVisibleList = TranslateUtils.StringCollectionToStringList(itemIsVisible);

                    if (isVisibleList.Count < itemIdList.Count)
                    {
                        for (var i = isVisibleList.Count; i < itemIdList.Count; i++)
                        {
                            isVisibleList.Add("off");
                        }
                    }

                    var configExtendInfoList = new List <ConfigExtendInfo>();
                    for (var i = 0; i < itemCount; i++)
                    {
                        var configExtendInfo = new ConfigExtendInfo {
                            Id = itemIdList[i], PublishmentSystemId = PublishmentSystemId, KeywordType = EKeywordTypeUtils.GetValue(EKeywordType.Appointment), FunctionId = _appointmentId, AttributeName = attributeNameList[i], IsVisible = isVisibleList[i]
                        };

                        if (string.IsNullOrEmpty(configExtendInfo.AttributeName))
                        {
                            FailMessage("保存失败,属性名称为必填项");
                            isItemReady = false;
                        }
                        if (string.IsNullOrEmpty(configExtendInfo.IsVisible))
                        {
                            FailMessage("保存失败,是否必填为显示项");
                            isItemReady = false;
                        }

                        if (configExtendInfo.IsVisible == "on")
                        {
                            configExtendInfo.IsVisible = "True";
                        }
                        else
                        {
                            configExtendInfo.IsVisible = "False";
                        }

                        configExtendInfoList.Add(configExtendInfo);
                    }

                    if (isItemReady)
                    {
                        DataProviderWx.ConfigExtendDao.DeleteAllNotInIdList(PublishmentSystemId, _appointmentId, itemIdList);

                        foreach (var configExtendInfo in configExtendInfoList)
                        {
                            if (configExtendInfo.Id > 0)
                            {
                                DataProviderWx.ConfigExtendDao.Update(configExtendInfo);
                            }
                            else
                            {
                                DataProviderWx.ConfigExtendDao.Insert(configExtendInfo);
                            }
                        }
                    }

                    if (isItemReady)
                    {
                        PhStep5.Visible = true;
                        BtnSubmit.Text  = "确 认";
                    }
                    else
                    {
                        PhStep4.Visible = true;
                    }
                }
                else if (selectedStep == 5)
                {
                    var appointmentInfo = new AppointmentInfo();
                    appointmentInfo.PublishmentSystemId = PublishmentSystemId;

                    if (_appointmentId > 0)
                    {
                        appointmentInfo = DataProviderWx.AppointmentDao.GetAppointmentInfo(_appointmentId);
                        DataProviderWx.KeywordDao.Update(PublishmentSystemId, appointmentInfo.KeywordId,
                                                         EKeywordType.Appointment, EMatchType.Exact, TbKeywords.Text, !CbIsEnabled.Checked);
                    }
                    else
                    {
                        var keywordInfo = new KeywordInfo();

                        keywordInfo.KeywordId           = 0;
                        keywordInfo.PublishmentSystemId = PublishmentSystemId;
                        keywordInfo.Keywords            = TbKeywords.Text;
                        keywordInfo.IsDisabled          = !CbIsEnabled.Checked;
                        keywordInfo.KeywordType         = EKeywordType.Appointment;
                        keywordInfo.MatchType           = EMatchType.Exact;
                        keywordInfo.Reply   = string.Empty;
                        keywordInfo.AddDate = DateTime.Now;
                        keywordInfo.Taxis   = 0;

                        appointmentInfo.KeywordId = DataProviderWx.KeywordDao.Insert(keywordInfo);
                    }

                    appointmentInfo.StartDate = DtbStartDate.DateTime;
                    appointmentInfo.EndDate   = DtbEndDate.DateTime;
                    appointmentInfo.Title     = TbTitle.Text;
                    appointmentInfo.ImageUrl  = ImageUrl.Value;
                    ;
                    appointmentInfo.Summary = TbSummary.Text;

                    appointmentInfo.ContentImageUrl          = ContentImageUrl.Value;
                    appointmentInfo.ContentDescription       = TbContentDescription.Text;
                    appointmentInfo.ContentResultTopImageUrl = ContentResultTopImageUrl.Value;
                    appointmentInfo.ContentIsSingle          = false;

                    appointmentInfo.EndTitle    = TbEndTitle.Text;
                    appointmentInfo.EndImageUrl = EndImageUrl.Value;
                    appointmentInfo.EndSummary  = TbEndSummary.Text;

                    appointmentInfo.IsFormRealName    = CbIsFormRealName.Checked ? "True" : "False";
                    appointmentInfo.FormRealNameTitle = TbFormRealNameTitle.Text;
                    appointmentInfo.IsFormMobile      = CbIsFormMobile.Checked ? "True" : "False";
                    appointmentInfo.FormMobileTitle   = TbFormMobileTitle.Text;
                    appointmentInfo.IsFormEmail       = CbIsFormEmail.Checked ? "True" : "False";
                    appointmentInfo.FormEmailTitle    = TbFormEmailTitle.Text;

                    try
                    {
                        if (_appointmentId > 0)
                        {
                            DataProviderWx.AppointmentDao.Update(appointmentInfo);

                            Body.AddSiteLog(PublishmentSystemId, "修改微预约", $"微预约:{TbTitle.Text}");
                            SuccessMessage("修改微预约成功!");
                        }
                        else
                        {
                            _appointmentId = DataProviderWx.AppointmentDao.Insert(appointmentInfo);

                            DataProviderWx.AppointmentItemDao.UpdateAppointmentId(PublishmentSystemId,
                                                                                  _appointmentId);

                            Body.AddSiteLog(PublishmentSystemId, "添加微预约", $"微预约:{TbTitle.Text}");
                            SuccessMessage("添加微预约成功!");
                        }

                        AddWaitAndRedirectScript(PageAppointment.GetRedirectUrl(PublishmentSystemId));
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, "微预约设置失败!");
                    }

                    BtnSubmit.Visible = false;
                    BtnReturn.Visible = false;
                }
            }
        }
Пример #22
0
        public int GetCount(int publishmentSystemID, EKeywordType keywordType)
        {
            string sqlString =
                $"SELECT COUNT(*) FROM wx_Keyword WHERE PublishmentSystemID = {publishmentSystemID} AND KeywordType = '{EKeywordTypeUtils.GetValue(keywordType)}'";

            return(BaiRongDataProvider.DatabaseDao.GetIntResult(sqlString));
        }
Пример #23
0
        public void Sync(int publishmentSystemID)
        {
            DeleteAll(publishmentSystemID);

            var menuInfoList = DataProviderWX.MenuDAO.GetMenuInfoList(publishmentSystemID, 0);

            foreach (var menuInfo in menuInfoList)
            {
                var navigationType = ENavigationType.Url;
                if (menuInfo.MenuType == EMenuType.Site)
                {
                    navigationType = ENavigationType.Site;
                }
                else if (menuInfo.MenuType == EMenuType.Keyword)
                {
                    navigationType = ENavigationType.Function;
                }
                var keywordType = EKeywordType.Text;
                var functionID  = 0;
                if (menuInfo.MenuType == EMenuType.Keyword && !string.IsNullOrEmpty(menuInfo.Keyword))
                {
                    var keywordID = DataProviderWX.KeywordMatchDAO.GetKeywordIDByMPController(publishmentSystemID, menuInfo.Keyword);
                    if (keywordID > 0)
                    {
                        var keywordInfo = DataProviderWX.KeywordDAO.GetKeywordInfo(keywordID);
                        functionID = KeywordManager.GetFunctionID(keywordInfo);
                    }
                }

                var webMenuInfo = new WebMenuInfo {
                    PublishmentSystemID = publishmentSystemID, MenuName = menuInfo.MenuName, NavigationType = ENavigationTypeUtils.GetValue(navigationType), Url = menuInfo.Url, ChannelID = menuInfo.ChannelID, ContentID = menuInfo.ContentID, KeywordType = EKeywordTypeUtils.GetValue(keywordType), FunctionID = functionID, ParentID = 0
                };

                var menuID = Insert(webMenuInfo);

                var subMenuInfoList = DataProviderWX.MenuDAO.GetMenuInfoList(publishmentSystemID, menuInfo.MenuID);
                if (subMenuInfoList != null && subMenuInfoList.Count > 0)
                {
                    foreach (var subMenuInfo in subMenuInfoList)
                    {
                        navigationType = ENavigationType.Url;
                        if (subMenuInfo.MenuType == EMenuType.Site)
                        {
                            navigationType = ENavigationType.Site;
                        }
                        else if (subMenuInfo.MenuType == EMenuType.Keyword)
                        {
                            navigationType = ENavigationType.Function;
                        }
                        keywordType = EKeywordType.Text;
                        functionID  = 0;
                        if (subMenuInfo.MenuType == EMenuType.Keyword && !string.IsNullOrEmpty(subMenuInfo.Keyword))
                        {
                            var keywordID = DataProviderWX.KeywordMatchDAO.GetKeywordIDByMPController(publishmentSystemID, subMenuInfo.Keyword);
                            if (keywordID > 0)
                            {
                                var keywordInfo = DataProviderWX.KeywordDAO.GetKeywordInfo(keywordID);
                                functionID = KeywordManager.GetFunctionID(keywordInfo);
                            }
                        }

                        var subWebMenuInfo = new WebMenuInfo {
                            PublishmentSystemID = publishmentSystemID, MenuName = subMenuInfo.MenuName, NavigationType = ENavigationTypeUtils.GetValue(navigationType), Url = subMenuInfo.Url, ChannelID = subMenuInfo.ChannelID, ContentID = subMenuInfo.ContentID, KeywordType = EKeywordTypeUtils.GetValue(keywordType), FunctionID = functionID, ParentID = menuID
                        };

                        Insert(subWebMenuInfo);
                    }
                }
            }
        }
        public void ExportAppointmentContentCSV(string filePath, List <AppointmentContentInfo> appointmentContentInfolList, string appointmentTitle, int appointmentID)
        {
            var appointmentInfo = DataProviderWX.AppointmentDAO.GetAppointmentInfo(appointmentID);

            var head = new List <string>();

            head.Add("序号");
            head.Add("预约名称");
            if (appointmentInfo.IsFormRealName == "True")
            {
                head.Add(appointmentInfo.FormRealNameTitle);
            }
            if (appointmentInfo.IsFormMobile == "True")
            {
                head.Add(appointmentInfo.FormMobileTitle);
            }
            if (appointmentInfo.IsFormEmail == "True")
            {
                head.Add(appointmentInfo.FormEmailTitle);
            }
            head.Add("预约时间");
            head.Add("预约状态");
            head.Add("留言");
            var configExtendInfoList = DataProviderWX.ConfigExtendDAO.GetConfigExtendInfoList(PublishmentSystemId, appointmentID, EKeywordTypeUtils.GetValue(EKeywordType.Appointment));

            foreach (var cList in configExtendInfoList)
            {
                head.Add(cList.AttributeName);
            }

            var rows = new List <List <string> >();

            var index = 1;

            foreach (var applist in appointmentContentInfolList)
            {
                var row = new List <string>();

                row.Add((index++).ToString());
                row.Add(appointmentTitle);
                if (appointmentInfo.IsFormRealName == "True")
                {
                    row.Add(applist.RealName);
                }
                if (appointmentInfo.IsFormMobile == "True")
                {
                    row.Add(applist.Mobile);
                }
                if (appointmentInfo.IsFormEmail == "True")
                {
                    row.Add(applist.Email);
                }
                row.Add(DateUtils.GetDateAndTimeString(applist.AddDate));
                row.Add(EAppointmentStatusUtils.GetText(EAppointmentStatusUtils.GetEnumType(applist.Status)));
                row.Add(applist.Message);

                var SettingsXML = applist.SettingsXML.Replace("{", "").Replace("}", "");
                var arr         = SettingsXML.Split(',');
                if (arr[0] != "")
                {
                    for (var i = 0; i < arr.Length; i++)
                    {
                        var arr1 = arr[i].Replace("\"", "").Split(':');
                        row.Add(arr1[1]);
                    }
                }
                rows.Add(row);
            }

            CSVUtils.Export(filePath, head, rows);
        }
Пример #25
0
        public bool UpdateTaxisToDown(int publishmentSystemID, EKeywordType keywordType, int keywordID)
        {
            string sqlString =
                $"SELECT TOP 1 KeywordID, Taxis FROM wx_Keyword WHERE (Taxis < (SELECT Taxis FROM wx_Keyword WHERE KeywordID = {keywordID})) AND PublishmentSystemID = {publishmentSystemID} AND KeywordType = '{EKeywordTypeUtils.GetValue(keywordType)}' ORDER BY Taxis DESC";
            var lowerID    = 0;
            var lowerTaxis = 0;

            using (var rdr = ExecuteReader(sqlString))
            {
                if (rdr.Read())
                {
                    lowerID    = rdr.GetInt32(0);
                    lowerTaxis = rdr.GetInt32(1);
                }
                rdr.Close();
            }

            var selectedTaxis = GetTaxis(keywordID);

            if (lowerID > 0)
            {
                SetTaxis(keywordID, lowerTaxis);
                SetTaxis(lowerID, selectedTaxis);
                return(true);
            }
            return(false);
        }
Пример #26
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemId");
            _appointmentId     = Body.GetQueryInt("appointmentID");
            _appointmentItemId = Body.GetQueryInt("appointmentItemID");

            SpContents.ControlToPaginate = RptContents;
            SpContents.ItemsPerPage      = 30;
            SpContents.SelectCommand     = DataProviderWx.AppointmentItemDao.GetSelectString(PublishmentSystemId, _appointmentId);
            SpContents.SortField         = AlbumAttribute.Id;
            SpContents.SortMode          = SortMode.ASC;
            RptContents.ItemDataBound   += rptContents_ItemDataBound;

            if (!IsPostBack)
            {
                var pageTitle = _appointmentId > 0 ? "编辑微预约" : "添加微预约";
                BreadCrumb(AppManager.WeiXin.LeftMenu.IdFunction, AppManager.WeiXin.LeftMenu.Function.IdAppointment, pageTitle, AppManager.WeiXin.Permission.WebSite.Appointment);

                LtlPageTitle.Text = pageTitle;

                LtlImageUrl.Text =
                    $@"<img id=""preview_imageUrl"" src=""{AppointmentManager.GetImageUrl(PublishmentSystemInfo,
                        string.Empty)}"" width=""370"" align=""middle"" />";
                LtlContentImageUrl.Text =
                    $@"<img id=""preview_contentImageUrl"" src=""{AppointmentManager.GetContentImageUrl(
                        PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />";
                LtlContentResultTopImageUrl.Text =
                    $@"<img id=""preview_contentResultTopImageUrl"" src=""{AppointmentManager.GetContentResultTopImageUrl(
                        PublishmentSystemInfo, string.Empty)}"" width=""370"" align=""middle"" />";
                LtlEndImageUrl.Text =
                    $@"<img id=""preview_endImageUrl"" src=""{AppointmentManager.GetEndImageUrl(PublishmentSystemInfo,
                        string.Empty)}"" width=""370"" align=""middle"" />";

                SpContents.DataBind();

                BtnAdd.Attributes.Add("onclick", ModalAppointmentItemAdd.GetOpenWindowStringToAdd(PublishmentSystemId, _appointmentId, 0));

                //string urlDelete = PageUtils.AddQueryString(BackgroundAppointmentMultipleAdd.GetRedirectUrl(base.PublishmentSystemId, this.appointmentID,this.tbTitle.Text), "Delete", "True");
                //this.btnDelete.Attributes.Add("onclick", PageUtils.GetRedirectStringWithCheckBoxValueAndAlert(urlDelete, "IDCollection", "IDCollection", "请选择需要删除的微预约项目", "此操作将删除所选微预约项目,确认吗?"));

                if (_appointmentId == 0)
                {
                    DtbEndDate.DateTime = DateTime.Now.AddMonths(1);
                }
                else
                {
                    var appointmentInfo = DataProviderWx.AppointmentDao.GetAppointmentInfo(_appointmentId);

                    if (appointmentInfo != null)
                    {
                        TbKeywords.Text       = DataProviderWx.KeywordDao.GetKeywords(appointmentInfo.KeywordId);
                        CbIsEnabled.Checked   = !appointmentInfo.IsDisabled;
                        DtbStartDate.DateTime = appointmentInfo.StartDate;
                        DtbEndDate.DateTime   = appointmentInfo.EndDate;
                        TbTitle.Text          = appointmentInfo.Title;
                        if (!string.IsNullOrEmpty(appointmentInfo.ImageUrl))
                        {
                            LtlImageUrl.Text =
                                $@"<img id=""preview_imageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                    PublishmentSystemInfo, appointmentInfo.ImageUrl)}"" width=""370"" align=""middle"" />";
                        }
                        TbSummary.Text = appointmentInfo.Summary;
                        if (!string.IsNullOrEmpty(appointmentInfo.ContentImageUrl))
                        {
                            LtlContentImageUrl.Text =
                                $@"<img id=""preview_contentImageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                    PublishmentSystemInfo, appointmentInfo.ContentImageUrl)}"" width=""370"" align=""middle"" />";
                        }
                        if (!string.IsNullOrEmpty(appointmentInfo.ContentResultTopImageUrl))
                        {
                            LtlContentResultTopImageUrl.Text =
                                $@"<img id=""preview_contentResultTopImageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                    PublishmentSystemInfo, appointmentInfo.ContentResultTopImageUrl)}"" width=""370"" align=""middle"" />";
                        }

                        TbContentDescription.Text = appointmentInfo.ContentDescription;

                        TbEndTitle.Text   = appointmentInfo.EndTitle;
                        TbEndSummary.Text = appointmentInfo.EndSummary;
                        if (!string.IsNullOrEmpty(appointmentInfo.EndImageUrl))
                        {
                            LtlEndImageUrl.Text =
                                $@"<img id=""preview_endImageUrl"" src=""{PageUtility.ParseNavigationUrl(
                                    PublishmentSystemInfo, appointmentInfo.EndImageUrl)}"" width=""370"" align=""middle"" />";
                        }

                        ImageUrl.Value                 = appointmentInfo.ImageUrl;
                        ContentImageUrl.Value          = appointmentInfo.ContentImageUrl;
                        ContentResultTopImageUrl.Value = appointmentInfo.ContentResultTopImageUrl;
                        EndImageUrl.Value              = appointmentInfo.EndImageUrl;
                        #region 拓展属性
                        #region 姓名
                        if (appointmentInfo.IsFormRealName == "True")
                        {
                            CbIsFormRealName.Checked = true;
                            TbFormRealNameTitle.Text = appointmentInfo.FormRealNameTitle;
                        }
                        else if (string.IsNullOrEmpty(appointmentInfo.IsFormRealName))
                        {
                            CbIsFormRealName.Checked = true;
                            TbFormRealNameTitle.Text = "姓名";
                        }
                        else
                        {
                            CbIsFormRealName.Checked = false;
                            TbFormRealNameTitle.Text = appointmentInfo.FormRealNameTitle;
                        }
                        #endregion
                        #region 电话
                        if (appointmentInfo.IsFormMobile == "True")
                        {
                            CbIsFormMobile.Checked = true;
                            TbFormMobileTitle.Text = appointmentInfo.FormMobileTitle;
                        }
                        else if (string.IsNullOrEmpty(appointmentInfo.IsFormMobile))
                        {
                            CbIsFormMobile.Checked = true;
                            TbFormMobileTitle.Text = "电话";
                        }
                        else
                        {
                            CbIsFormMobile.Checked = false;
                            TbFormMobileTitle.Text = appointmentInfo.FormMobileTitle;
                        }
                        #endregion
                        #region 邮箱
                        if (appointmentInfo.IsFormEmail == "True")
                        {
                            CbIsFormEmail.Checked = true;
                            TbFormEmailTitle.Text = appointmentInfo.FormEmailTitle;
                        }
                        else if (string.IsNullOrEmpty(appointmentInfo.IsFormEmail))
                        {
                            CbIsFormEmail.Checked = true;
                            TbFormEmailTitle.Text = "邮箱";
                        }
                        else
                        {
                            CbIsFormEmail.Checked = false;
                            TbFormEmailTitle.Text = appointmentInfo.FormEmailTitle;
                        }
                        #endregion

                        _appointmentItemId = DataProviderWx.AppointmentItemDao.GetItemId(PublishmentSystemId, _appointmentId);

                        var configExtendInfoList = DataProviderWx.ConfigExtendDao.GetConfigExtendInfoList(PublishmentSystemId, appointmentInfo.Id, EKeywordTypeUtils.GetValue(EKeywordType.Appointment));
                        var itemBuilder          = new StringBuilder();
                        foreach (var configExtendInfo in configExtendInfoList)
                        {
                            if (string.IsNullOrEmpty(configExtendInfo.IsVisible))
                            {
                                configExtendInfo.IsVisible = "checked=checked";
                            }
                            else if (configExtendInfo.IsVisible == "True")
                            {
                                configExtendInfo.IsVisible = "checked=checked";
                            }
                            else
                            {
                                configExtendInfo.IsVisible = "";
                            }
                            itemBuilder.AppendFormat(@"{{id: '{0}', attributeName: '{1}',isVisible:'{2}'}},", configExtendInfo.Id, configExtendInfo.AttributeName, configExtendInfo.IsVisible);
                        }
                        if (itemBuilder.Length > 0)
                        {
                            itemBuilder.Length--;
                        }
                        LtlAwardItems.Text =
                            $@"itemController.itemCount = {configExtendInfoList.Count};itemController.items = [{itemBuilder}];";
                        #endregion
                    }
                }

                BtnReturn.Attributes.Add("onclick",
                                         $@"location.href=""{PageAppointment.GetRedirectUrl(PublishmentSystemId)}"";return false");
            }
        }
Пример #27
0
        public bool UpdateTaxisToUp(int publishmentSystemId, EKeywordType keywordType, int keywordId)
        {
            string sqlString =
                $"SELECT TOP 1 KeywordID, Taxis FROM wx_Keyword WHERE (Taxis > (SELECT Taxis FROM wx_Keyword WHERE KeywordID = {keywordId})) AND PublishmentSystemID = {publishmentSystemId} AND KeywordType = '{EKeywordTypeUtils.GetValue(keywordType)}' ORDER BY Taxis";
            var higherId    = 0;
            var higherTaxis = 0;

            using (var rdr = ExecuteReader(sqlString))
            {
                if (rdr.Read())
                {
                    higherId    = rdr.GetInt32(0);
                    higherTaxis = rdr.GetInt32(1);
                }
                rdr.Close();
            }

            var selectedTaxis = GetTaxis(keywordId);

            if (higherId > 0)
            {
                SetTaxis(keywordId, higherTaxis);
                SetTaxis(higherId, selectedTaxis);
                return(true);
            }
            return(false);
        }