Esempio n. 1
0
 public M_InfoSite GetInfoModel()
 {
     string path = this.DirName + @"\infosite.config";
     if (!File.Exists(path))
     {
         return null;
     }
     XmlDocument document = new XmlDocument();
     document.Load(path);
     M_InfoSite site = new M_InfoSite();
     XmlNode node = document.ChildNodes[1];
     site.InfoCreateNum = int.Parse(node.ChildNodes[0].InnerText);
     site.SpecialInfoCreateNum = int.Parse(node.ChildNodes[1].InnerText);
     site.SearchTime = int.Parse(node.ChildNodes[2].InnerText);
     site.SearchResultPageSize = int.Parse(node.ChildNodes[3].InnerText);
     site.IsOpenViewerDig = bool.Parse(node.ChildNodes[4].InnerText);
     site.ImgUploadType = node.ChildNodes[5].InnerText.Trim();
     site.VideoUploadType = node.ChildNodes[6].InnerText.Trim();
     site.AudioUploadType = node.ChildNodes[7].InnerText.Trim();
     site.SoftUploadType = node.ChildNodes[8].InnerText.Trim();
     site.OtherUploadType = node.ChildNodes[9].InnerText.Trim();
     site.HistoryTime = int.Parse(node.ChildNodes[10].InnerText);
     return site;
 }
Esempio n. 2
0
 public B_Create()
 {
     this.SiteModel = this.SiteBll.GetSiteModel();
     this.InfoSiteModel = this.SiteBll.GetInfoModel();
     if (this.SiteModel.IsAbsPathType)
     {
         this.HostAddress = this.SiteModel.Domain;
     }
     else
     {
         this.HostAddress = Param.ApplicationRootPath;
     }
 }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AdminBll.CheckMulitLogin();
        AdminModel = AdminBll.GetLoginModel();
        AdminUserModel = AdminBll.GetModel(AdminModel.UserId);

        litMsg.Text = "";
        SiteModel = SiteBll.GetSiteModel();
        InfoSiteModel = SiteBll.GetInfoModel();
        if (SiteModel == null)
        {
            Function.ShowSysMsg(0, "<li>全站参数获取错误</li>");
        }
        txtTemplatePath.Attributes.Add("readonly", "");
        txtUpdateDateTime.Attributes.Add("readonly", "");
        txtHeaderColor.Attributes.Add("readonly", "");
        txtViewer.Attributes.Add("readonly", "");
        HistoryTime = InfoSiteModel.HistoryTime;
        if (!string.IsNullOrEmpty(Request.QueryString["ChId"]))
        {
            try
            {
                ChannelId = int.Parse(Request.QueryString["ChId"]);
            }
            catch { }
        }
        if (!ColumnBll.ChkHasColumnByChId(ChannelId))
        {
            Function.ShowSysMsg(0, "<li>本频道下没有栏目,不能添加信息</li><li>建议您先添加栏目</li><li><a href='info/SetColumn.aspx?ChId=" + ChannelId + "'>添加栏目</a> <a href='info/ColumnList.aspx?ChId=" + ChannelId + "'>栏目管理</a></li>");
        }
        ChannelModel = ChannelId <= 0 ? null : ChannelBll.GetChannel(ChannelId);
        if (ChannelModel == null || ChannelModel.ModelType != 1)
        {
            Function.ShowSysMsg(0, "<li>频道参数错误</li>");
        }
        //保存路径
        InfoModel = InfoModelBll.GetModel(ChannelModel.ModelType);
        FilePicPath.Text = InfoModel.UploadPath + "|" + InfoModel.UploadSize.ToString();
        if (!string.IsNullOrEmpty(Request.QueryString["ColId"]))
        {
            try
            {
                ColumnId = int.Parse(Request.QueryString["ColId"]);
            }
            catch { }
        }
        ColumnModel = ColumnId <= 0 ? null : ColumnBll.GetColumn(ColumnId);
        if (ColumnId > 0 && ColumnModel == null)
        {
            Function.ShowSysMsg(0, "<li>所选栏目不存在或已经被删除</li>");
        }

        if (Request.QueryString["Id"] != null && Request.QueryString["Id"] != "")
        {
            try
            {
                ArticleId = int.Parse(Request.QueryString["Id"]);
            }
            catch { }
        }
        if (ArticleId > 0 && !AdminGroupBll.Power_Channel(ChannelId, ColumnId, AdminUserModel.GroupId, 3))
        {
            Function.ShowSysMsg(0, "<li>你没有该栏目下的修改权限</li>");
        }
        if (!IsPostBack)
        {
            txtUpdateDateTime.Text = DateTime.Now.ToString("yyyy-MM-dd");
            if (HistoryTime == 0)
            {
                txtExpireTime.Text = "9999-01-01";
            }
            else
            {
                txtExpireTime.Text = DateTime.Now.AddDays(HistoryTime).ToString("yyyy-MM-dd");
            }
            for (int i = 0; i <= 20; i++)
            {
                ddlHeaderSize.Items.Add(new ListItem(i + "px", i + "px"));
                ddlHeaderSize.SelectedValue = "12px";
            }
            if (ArticleId > 0)
                litNav.Text = "<a href='ColumnList.aspx?Chid=" + ChannelId + "'>" + ChannelModel.ChName + "</a> &gt;&gt; 修改" + ChannelModel.TypeName;
            else
                litNav.Text = "<a href='ColumnList.aspx?Chid=" + ChannelId + "'>" + ChannelModel.ChName + "</a> &gt;&gt; 添加" + ChannelModel.TypeName;
            BindSpeacil();
            BindGroup();
            if (ArticleId > 0)
            {
                ShowInfo(ArticleId);
            }
        }
    }
Esempio n. 4
0
 public void SetInfoSite(M_InfoSite model)
 {
     string path = this.DirName + @"\infosite.config";
     if (!File.Exists(path))
     {
         XmlTextWriter writer = new XmlTextWriter(path, Encoding.UTF8);
         writer.Formatting = Formatting.Indented;
         writer.WriteStartDocument();
         writer.WriteStartElement("InfoSite");
         writer.WriteElementString("InfoCreateNum", model.InfoCreateNum.ToString());
         writer.WriteElementString("SpecialInfoCreateNum", model.SpecialInfoCreateNum.ToString());
         writer.WriteElementString("SearchTime", model.SearchTime.ToString());
         writer.WriteElementString("SearchResultPageSize", model.SearchResultPageSize.ToString());
         writer.WriteElementString("IsOpenViewerDig", model.IsOpenViewerDig.ToString());
         writer.WriteElementString("ImgUploadType", model.ImgUploadType);
         writer.WriteElementString("VideoUploadType", model.VideoUploadType);
         writer.WriteElementString("AudioUploadType", model.AudioUploadType);
         writer.WriteElementString("SoftUploadType", model.SoftUploadType);
         writer.WriteElementString("OtherUploadType", model.OtherUploadType);
         writer.WriteElementString("HistoryTime", model.HistoryTime.ToString());
         writer.WriteEndElement();
         writer.WriteEndDocument();
         writer.Flush();
         writer.Close();
     }
     else
     {
         XmlDocument document = new XmlDocument();
         document.Load(path);
         XmlNode node = document.ChildNodes[1];
         node.ChildNodes[0].InnerText = model.InfoCreateNum.ToString();
         node.ChildNodes[1].InnerText = model.SpecialInfoCreateNum.ToString();
         node.ChildNodes[2].InnerText = model.SearchTime.ToString();
         node.ChildNodes[3].InnerText = model.SearchResultPageSize.ToString();
         node.ChildNodes[4].InnerText = model.IsOpenViewerDig.ToString();
         node.ChildNodes[5].InnerText = model.ImgUploadType;
         node.ChildNodes[6].InnerText = model.VideoUploadType;
         node.ChildNodes[7].InnerText = model.AudioUploadType;
         node.ChildNodes[8].InnerText = model.SoftUploadType;
         node.ChildNodes[9].InnerText = model.OtherUploadType;
         node.ChildNodes[10].InnerText = model.HistoryTime.ToString();
         document.Save(path);
     }
 }
Esempio n. 5
0
    protected void btnSumbit_Click(object sender, EventArgs e)
    {
        if(txtSequenceNum.Text.Trim().Length==0)
        {
            Function.ShowSysMsg(0, "<li>产品序列号必须填写</li><li><a href='javascript:history.back()'>返回上一页</a></li>");
        }
        if (txtDomain.Text.Trim().Length == 0)
        {
            Function.ShowSysMsg(0, "<li>站点域名必须填写</li><li><a href='javascript:history.back()'>返回上一页</a></li>");
        }
         if(txtIndexTemplatePath.Text.Trim().Length==0)
        {
            Function.ShowSysMsg(0, "<li>首页模版必须选择</li><li><a href='javascript:history.back()'>返回上一页</a></li>");
        }

        if(chkBoxIsTestEmail.Checked&&(txtEmailServerAddress.Text.Trim().Length==0||txtServerUserName.Text.Trim().Length==0||(txtServerUserPass.Text.Trim().Length==0&&litUserPass.Text.Length==0)))
        {
             Function.ShowSysMsg(0, "<li>选择了注册时邮箱验证,邮件发送设置必须填写</li><li><a href='javascript:history.back()'>返回上一页</a></li>");
        }
        if(chkBoxIsTestEmail.Checked)
        {
            if(!Regex.IsMatch(txtServerUserName.Text.Trim(),@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*",RegexOptions.IgnoreCase))
            {
                Function.ShowSysMsg(0, "<li>发送邮件的地址名称格式不正确</li><li><a href='javascript:history.back()'>返回上一页</a></li>");
            }
        }
        if (txtFilterStr.Text.Length > 1000)
        {
            Function.ShowSysMsg(0, "<li>过滤关键字不能超过1000个字</li><li><a href='javascript:history.back()'>返回上一页</a></li>");
        }
        if(txtGUnitName.Text.Trim().Length==0)
        {
            Function.ShowSysMsg(0, "<li>金币单位必须填写</li><li><a href='javascript:history.back()'>返回上一页</a></li>");
        }

        M_Site siteModel = new M_Site();
        M_InfoSite infoModel = new  M_InfoSite();

        siteModel.SiteName = txtSiteName.Text;
        siteModel.Domain = txtDomain.Text;
        siteModel.LogoAddress = txtLogoAddress.Text;

        siteModel.BannerAddress = txtBannerAddress.Text;
        siteModel.Keyword = txtKeyword.Text;
        siteModel.KeyContent = txtKeyContent.Text;
        siteModel.SequenceNum = txtSequenceNum.Text;

        if (Request.Form["txtIndexTemplatePath"] != null && Request.Form["txtIndexTemplatePath"] != "")
        {
            siteModel.IndexTemplatePath = Request.Form["txtIndexTemplatePath"];
        }

        if (rdPageType1.Checked)
        {
            siteModel.PageType = 1;
        }
        else if (rdPageType2.Checked)
        {
            siteModel.PageType = 2;
        }
        else if (rdPageType3.Checked)
        {
            siteModel.PageType = 3;
        }
        else if (rdPageType4.Checked)
        {
            siteModel.PageType = 4;
        }

        siteModel.IsStaticType = chkBoxIsStaticType.Checked;

        if (rdIsAbsPathType2.Checked)
        {
            siteModel.IsAbsPathType = true;
        }
        else
        {
            siteModel.IsAbsPathType = false;
        }

        siteModel.CopyRight = txtCopyRight.Text;

        siteModel.DefaultUserGroup = 0;
        siteModel.IsAllowRegsite = chkBoxAllowRegiste.Checked;
        siteModel.IsTestEmail = chkBoxIsTestEmail.Checked;
        siteModel.IsLoginValidate = chkBoxIsLoginValidate.Checked;
        siteModel.IsCommentValidate = chkBoxIsCommentValidate.Checked;
        siteModel.IsAllowCommentNoName = chkBoxIsAllowCommentNoName.Checked;
        siteModel.IsAddCommentEditor = chkBoxIsAddCommentEditor.Checked;
        siteModel.FilterStr = txtFilterStr.Text;
        siteModel.GUnitName = txtGUnitName.Text;
        try
        {
            siteModel.LogErrorNum = int.Parse(txtLoginErrorNum.Text);
        }
        catch
        {
            siteModel.LogErrorNum = 0;
        }

        siteModel.IsOpenInvite = chkBoxIsOpenInvite.Checked;

        try
        {
            siteModel.GNumber = int.Parse(txtGNumber.Text.Trim());
        }
        catch { siteModel.GNumber = 0; }
        try
        {
            siteModel.G_Day = int.Parse(txtG_Day.Text);
        }
        catch { siteModel.G_Day = 0; }
        try
        {
            siteModel.G_Score = int.Parse(txtG_Score.Text);
        }
        catch { siteModel.G_Score = 0; }
        try
        {
            siteModel.LoginScore = int.Parse(txtLoginScore.Text);
        }
        catch { siteModel.LoginScore = 0; }

        if (rdIsImgWaterMark2.Checked)
        {
            siteModel.IsImgWaterMark = true;
        }
        else
        {
            siteModel.IsImgWaterMark = false;
        }

        siteModel.WaterMarkStr = txtWaterMarkStr.Text;
        try
        {
            siteModel.WaterMarkFontSize = int.Parse(txtWaterMarkFontSize.Text);
        }
        catch
        {
            siteModel.WaterMarkFontSize = 0;
        }
        siteModel.WaterMarkFontName = ddlWaterMarkFontName.SelectedValue;
        if (Request.Form["txtWaterMarkFontColor"] != null && Request.Form["txtWaterMarkFontColor"] != "")
        {
            siteModel.WaterMarkFontColor = Request.Form["txtWaterMarkFontColor"];
        }
        siteModel.WaterMarkIsBold = chkBoxWaterMarkIsBold.Checked;

        siteModel.WaterMarkPath = txtWaterMarkPath.Text;
        siteModel.WaterMarkHW = txtWaterMarkH.Text + "|" + txtWaterMarkW.Text;
        try
        {
            siteModel.WaterMarkLight = int.Parse(txtWaterMarkLight.Text);
        }
        catch
        {
            siteModel.WaterMarkLight = 0;
        }
        siteModel.WaterMarkPos = int.Parse(ddlWaterMarkPos.SelectedValue);

        siteModel.EmailServerAddress = txtEmailServerAddress.Text;
        siteModel.EmailServerUserName = txtServerUserName.Text;
        if (txtServerUserPass.Text.Trim().Length != 0)
        {
            siteModel.EmailServerUserPass = txtServerUserPass.Text;
        }
        else
        {
            siteModel.EmailServerUserPass = litUserPass.Text;
        }

        siteModel.IsOpenRZM = chkBoxIsOpenRZM.Checked;
        try
        {
            siteModel.DisabledLoginTime = int.Parse(txtDisabledLoginTime.Text.Trim());
        }
        catch
        {
            siteModel.DisabledLoginTime = 0;
        }
        try
        {
            siteModel.UserClassCount = int.Parse(txtUserClassCount.Text.Trim());
        }
        catch
        {
            siteModel.UserClassCount = 0;
        }
        siteModel.IsOpenRegLink = chkBosIsOpenRegLink.Checked;
        siteModel.IsCheckLink = chkIsCheckLink.Checked;

        try
        {
            infoModel.InfoCreateNum = int.Parse(txtInfoCreateNum.Text);
            if (infoModel.InfoCreateNum < 50 || infoModel.InfoCreateNum > 5000)
            {
                infoModel.InfoCreateNum = 100;
            }
        }
        catch
        {
            infoModel.InfoCreateNum = 100;
        }
        try
        {
            infoModel.SpecialInfoCreateNum = int.Parse(txtSpecialInfoCreateNum.Text);
        }
        catch
        {
            infoModel.SpecialInfoCreateNum = 0;
        }

        try
        {
            infoModel.SearchTime = int.Parse(txtSearchTime.Text);
        }
        catch
        {
            infoModel.SearchTime = 0;
        }

        try
        {
            infoModel.SearchResultPageSize = int.Parse(txtSearchResultPageSize.Text);
        }
        catch
        {
            infoModel.SearchResultPageSize = 0;
        }
        infoModel.IsOpenViewerDig = chkBoxIsOpenViewerDig.Checked;

        infoModel.ImgUploadType = txtUploadType.Text.Trim();
        infoModel.VideoUploadType = txtUploadVideoType.Text.Trim();
        infoModel.AudioUploadType = txtUploadAudioType.Text.Trim();
        infoModel.SoftUploadType = txtUploadSoftType.Text.Trim();
        infoModel.OtherUploadType = txtUploadOtherType.Text.Trim();
        try
        {
            infoModel.HistoryTime = int.Parse(txtHistoryTime.Text.Trim());
        }
        catch
        {
            infoModel.HistoryTime = 0;
        }

        B_Log.Add(LogType.Update, "配置全站参数设置成功");
        Bll.SetSite(siteModel);
        Bll.SetInfoSite(infoModel);
        Function.ShowSysMsg(1, "<li>全站参数设置成功</li><li><a href='javascript:history.back()'>返回上一页</a></li>");
    }