Exemplo n.º 1
0
        public void Update(ConfigExtendInfo configExtendInfo)
        {
            IDataParameter[] parms = null;
            var sqlUpdate          = BaiRongDataProvider.TableStructureDao.GetUpdateSqlString(configExtendInfo.ToNameValueCollection(), ConnectionString, TableName, out parms);

            ExecuteNonQuery(sqlUpdate, parms);
        }
Exemplo n.º 2
0
        public int Insert(ConfigExtendInfo configExtendInfo)
        {
            var configExtendId = 0;

            IDataParameter[] parms = null;

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

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

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

            return(configExtendId);
        }
Exemplo n.º 3
0
        public int Insert(ConfigExtendInfo configExtendInfo)
        {
            var configExtendID = 0;

            IDataParameter[] parms = null;

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

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

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

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

            return(configExtendID);
        }
Exemplo n.º 4
0
        public List <ConfigExtendInfo> GetConfigExtendInfoList(int publishmentSystemId, int functionId, string keywordType)
        {
            var list = new List <ConfigExtendInfo>();

            string sqlWhere =
                $"WHERE {ConfigExtendAttribute.PublishmentSystemId} = {publishmentSystemId} AND {ConfigExtendAttribute.FunctionId} = {functionId} AND {ConfigExtendAttribute.KeywordType}='{keywordType}' ";
            var sqlSelect = BaiRongDataProvider.TableStructureDao.GetSelectSqlString(ConnectionString, TableName, 0, SqlUtils.Asterisk, sqlWhere, null);

            using (var rdr = ExecuteReader(sqlSelect))
            {
                while (rdr.Read())
                {
                    var configExtendInfo = new ConfigExtendInfo(rdr);
                    list.Add(configExtendInfo);
                }
                rdr.Close();
            }

            return(list);
        }
Exemplo n.º 5
0
        public List <ConfigExtendInfo> GetConfigExtendInfoList(int publishmentSystemID, int functionID, string keywordType)
        {
            var list = new List <ConfigExtendInfo>();

            string SQL_WHERE =
                $"WHERE {ConfigExtendAttribute.PublishmentSystemID} = {publishmentSystemID} AND {ConfigExtendAttribute.FunctionID} = {functionID} AND {ConfigExtendAttribute.KeywordType}='{keywordType}' ";
            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 configExtendInfo = new ConfigExtendInfo(rdr);
                    list.Add(configExtendInfo);
                }
                rdr.Close();
            }

            return(list);
        }
Exemplo n.º 6
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;
                }
            }
        }
Exemplo n.º 7
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;
                }
            }
        }