コード例 #1
0
ファイル: MailConfig.aspx.cs プロジェクト: zwt-zf/cms
    protected void Button1_Click(object sender, EventArgs e)
    {
        ZoomLa.Components.SiteConfigInfo obj2 = ZoomLa.Components.SiteConfig.ConfigInfo();

        obj2.MailConfig.MailFrom   = this.TextBox1.Text;
        obj2.MailConfig.MailServer = this.TextBox2.Text;
        obj2.MailConfig.Port       = int.Parse(this.TextBox3.Text);

        obj2.MailConfig.EnabledSsl = this.CheckBox1.Checked;

        // enum 数据类型怎么处理?
        //ZoomLa.ZLEnum.AuthenticationType obj3 = ZoomLa.ZLEnum.AuthenticationType();

        if (this.RadioButton1.Checked)
        {
            obj2.MailConfig.AuthenticationType = ZoomLa.ZLEnum.AuthenticationType.None;
        }
        if (this.RadioButton2.Checked)
        {
            obj2.MailConfig.AuthenticationType = ZoomLa.ZLEnum.AuthenticationType.Basic;
        }
        if (this.RadioButton3.Checked)
        {
            obj2.MailConfig.AuthenticationType = ZoomLa.ZLEnum.AuthenticationType.Ntlm;
        }

        obj2.MailConfig.MailServerUserName = this.TextBox5.Text;
        obj2.MailConfig.MailServerPassWord = this.TextBox6.Text;

        ZoomLa.Components.SiteConfig obj = new ZoomLa.Components.SiteConfig();
        obj.Update(obj2);
        Response.Write("<script>alert('配置保存成功')</script>");
    }
コード例 #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        ZoomLa.Components.SiteConfigInfo obj2 = ZoomLa.Components.SiteConfig.ConfigInfo();

        obj2.UserConfig.EnableUserReg          = this.RadioButtonList1.Items[0].Selected;//莫名其妙,这里居然可以使用 ture ,而 SiteOption.aspx 页面却不可以
        obj2.UserConfig.EmailCheckReg          = this.RadioButtonList2.Items[0].Selected;
        obj2.UserConfig.AdminCheckReg          = this.RadioButtonList3.Items[0].Selected;
        obj2.UserConfig.EnableMultiRegPerEmail = this.RadioButtonList4.Items[0].Selected;
        obj2.UserConfig.EnableCheckCodeOfReg   = this.RadioButtonList5.Items[0].Selected;

        obj2.UserConfig.UserNameLimit       = int.Parse(this.TextBox6.Text);
        obj2.UserConfig.UserNameMax         = int.Parse(this.TextBox7.Text);
        obj2.UserConfig.UserNameRegDisabled = this.TextBox8.Text;

        obj2.UserConfig.EnableCheckCodeOfLogin = this.RadioButtonList6.Items[0].Selected;
        obj2.UserConfig.EnableMultiLogin       = this.RadioButtonList7.Items[0].Selected;

        if (this.RadioButtonList8.SelectedIndex.Equals(0))
        //if (this.RadioButtonList8.Items[0].Selected) 这种写法也是对的,之前的错误是使用了 ZoomLa.Components.SiteConfig.UserConfig ,而不是 obj2.UserConfig
        {
            obj2.UserConfig.UserGetPasswordType = 1;
        }
        else
        {
            obj2.UserConfig.UserGetPasswordType = 2;
        }

        obj2.UserConfig.EmailOfRegCheck = this.TextBox12.Text;

        ZoomLa.Components.SiteConfig obj = new ZoomLa.Components.SiteConfig();
        obj.Update(obj2);
        Response.Write("<script>alert('配置保存成功')</script>");
    }
コード例 #3
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        //ZoomLa.Components.SiteConfig.ConfigInfo().SiteInfo.SiteName = this.TextBox1.Text; //没有效果

        //obj.Update(SiteInfo.SiteName) = this.TextBox1.Text; //这也是错误的,因为()中的参数数据类型不匹配

        // ZoomLa.Components.SiteConfig.ConfigInfo() 实际只是获取类的实例,对其属性 SiteInfo.SiteName 的改变实际上只是改变了实例,而没有改变 xml 数据文件
        // 必须用 ZoomLa.Components.SiteConfig 的实例的 Update() 方法更新才有效。而 Update() 方法不是static ,所以必须声明新的对象才能使用
        ZoomLa.Components.SiteConfigInfo obj2 = ZoomLa.Components.SiteConfig.ConfigInfo();

        obj2.SiteInfo.SiteName        = this.TextBox1.Text;
        obj2.SiteInfo.SiteTitle       = this.TextBox2.Text;
        obj2.SiteInfo.SiteUrl         = this.TextBox3.Text;
        obj2.SiteInfo.LogoUrl         = this.TextBox4.Text;
        obj2.SiteInfo.BannerUrl       = this.TextBox5.Text;
        obj2.SiteInfo.Webmaster       = this.TextBox6.Text;
        obj2.SiteInfo.WebmasterEmail  = this.TextBox7.Text;
        obj2.SiteInfo.Copyright       = this.TextBox8.Text;
        obj2.SiteInfo.MetaKeywords    = this.TextBox9.Text;
        obj2.SiteInfo.MetaDescription = this.TextBox10.Text;

        ZoomLa.Components.SiteConfig obj = new ZoomLa.Components.SiteConfig();
        obj.Update(obj2);
        Response.Write("<script>alert('配置保存成功')</script>");
        //被修改后,会要求重新加载 xml 文件
        //“以下文件中的行尾不一致,要将行尾标准化吗?” ? windous(CR LF) ?
    }
コード例 #4
0
 //实例化
 private static SiteConfigInfo GetInstance()
 {
     if (configMod == null)
     {
         configMod = ConfigReadFromFile();
     }
     return(configMod);
 }
コード例 #5
0
ファイル: IPLockConfig.aspx.cs プロジェクト: zwt-zf/cms
    protected void Button1_Click(object sender, EventArgs e)
    {
        ZoomLa.Components.SiteConfigInfo obj2 = ZoomLa.Components.SiteConfig.ConfigInfo();

        if (this.RadioButton1.Checked.Equals(true))
        {
            obj2.IPLockConfig.LockIPType = "0";
        }
        if (this.RadioButton2.Checked.Equals(true))
        {
            obj2.IPLockConfig.LockIPType = "1";
        }
        if (this.RadioButton3.Checked.Equals(true))
        {
            obj2.IPLockConfig.LockIPType = "2";
        }
        if (this.RadioButton4.Checked.Equals(true))
        {
            obj2.IPLockConfig.LockIPType = "3";
        }
        if (this.RadioButton5.Checked.Equals(true))
        {
            obj2.IPLockConfig.LockIPType = "4";
        }

        obj2.IPLockConfig.LockIPWhite = this.TextBox2.Text;
        obj2.IPLockConfig.LockIPBlack = this.TextBox3.Text;

        if (this.RadioButton6.Checked.Equals(true))
        {
            obj2.IPLockConfig.AdminLockIPType = "0";
        }
        if (this.RadioButton7.Checked.Equals(true))
        {
            obj2.IPLockConfig.AdminLockIPType = "1";
        }
        if (this.RadioButton8.Checked.Equals(true))
        {
            obj2.IPLockConfig.AdminLockIPType = "2";
        }
        if (this.RadioButton9.Checked.Equals(true))
        {
            obj2.IPLockConfig.AdminLockIPType = "3";
        }
        if (this.RadioButton10.Checked.Equals(true))
        {
            obj2.IPLockConfig.AdminLockIPType = "4";
        }

        obj2.IPLockConfig.AdminLockIPWhite = this.TextBox5.Text;
        obj2.IPLockConfig.AdminLockIPBlack = this.TextBox6.Text;

        ZoomLa.Components.SiteConfig obj = new ZoomLa.Components.SiteConfig();
        obj.Update(obj2);
        Response.Write("<script>alert('配置保存成功')</script>");
    }
コード例 #6
0
ファイル: WaterMarkConfig.aspx.cs プロジェクト: zwt-zf/cms
    protected void Button1_Click1(object sender, EventArgs e)
    {
        ZoomLa.Components.SiteConfigInfo obj2 = ZoomLa.Components.SiteConfig.ConfigInfo();

        obj2.WaterMarkConfig.WaterMarkType = this.RadioButtonList1.SelectedIndex + 1;

        ZoomLa.Components.SiteConfig obj = new ZoomLa.Components.SiteConfig();
        obj.Update(obj2);
        Response.Write("<script>alert('配置保存成功')</script>");
    }
コード例 #7
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        ZoomLa.Components.SiteConfigInfo obj2 = ZoomLa.Components.SiteConfig.ConfigInfo();

        obj2.ThumbsConfig.ThumbsWidth  = int.Parse(this.TextBox1.Text);
        obj2.ThumbsConfig.ThumbsHeight = int.Parse(this.TextBox2.Text);
        obj2.ThumbsConfig.ThumbsMode   = this.RadioButtonList1.SelectedIndex;  // 亏大了,以后坚决不用 RadioButton ,只用 RadioButtonList
        obj2.ThumbsConfig.AddBackColor = this.TextBox4.Text;

        ZoomLa.Components.SiteConfig obj = new ZoomLa.Components.SiteConfig();
        obj.Update(obj2);
        Response.Write("<script>alert('配置保存成功')</script>");
    }
コード例 #8
0
ファイル: WaterMarkConfig.aspx.cs プロジェクト: zwt-zf/cms
    protected void Button3_Click(object sender, EventArgs e)
    {
        ZoomLa.Components.SiteConfigInfo obj2 = ZoomLa.Components.SiteConfig.ConfigInfo();

        obj2.WaterMarkConfig.WaterMarkImageInfo.ImagePath         = this.TextBox12.Text.Trim();
        obj2.WaterMarkConfig.WaterMarkImageInfo.WaterMarkPosition = this.RadioButtonList4.SelectedItem.Text.Trim();
        //惨痛教训:更新没有效果时,有很大可能是 load 方法的代码错误,而不是更新的代码的错误
        obj2.WaterMarkConfig.WaterMarkImageInfo.WaterMarkPositionX = int.Parse(this.TextBox14.Text.Trim());
        obj2.WaterMarkConfig.WaterMarkImageInfo.WaterMarkPositionY = int.Parse(this.TextBox15.Text.Trim());


        ZoomLa.Components.SiteConfig obj = new ZoomLa.Components.SiteConfig();
        obj.Update(obj2);
        Response.Write("<script>alert('配置保存成功')</script>");
    }
コード例 #9
0
 /// <summary>
 /// 更新配置文件
 /// </summary>
 /// <param name="config"></param>
 public void Update(SiteConfigInfo config)
 {
     try
     {
         XmlSerializer serializer = new XmlSerializer(typeof(SiteConfigInfo));
         using (Stream stream = new FileStream(this.filePath, FileMode.Create, FileAccess.Write, FileShare.None))
         {
             XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces();
             namespaces.Add("", "");
             serializer.Serialize(stream, config, namespaces);
         }
     }
     catch (SecurityException exception)
     {
         throw new SecurityException(exception.Message, exception.DenySetInstance, exception.PermitOnlySetInstance, exception.Method, exception.Demanded, exception.FirstPermissionThatFailed);
     }
 }
コード例 #10
0
ファイル: WaterMarkConfig.aspx.cs プロジェクト: zwt-zf/cms
    protected void Button2_Click(object sender, EventArgs e)
    {
        ZoomLa.Components.SiteConfigInfo obj2 = ZoomLa.Components.SiteConfig.ConfigInfo();

        obj2.WaterMarkConfig.WaterMarkTextInfo.Text               = this.TextBox2.Text;
        obj2.WaterMarkConfig.WaterMarkTextInfo.FoneType           = this.TextBox3.Text;
        obj2.WaterMarkConfig.WaterMarkTextInfo.FoneSize           = int.Parse(this.TextBox4.Text);
        obj2.WaterMarkConfig.WaterMarkTextInfo.FoneColor          = this.TextBox5.Text;
        obj2.WaterMarkConfig.WaterMarkTextInfo.FoneStyle          = this.TextBox6.Text;
        obj2.WaterMarkConfig.WaterMarkTextInfo.FoneBorderColor    = this.TextBox7.Text;
        obj2.WaterMarkConfig.WaterMarkTextInfo.FoneBorder         = 1 - this.RadioButtonList2.SelectedIndex;
        obj2.WaterMarkConfig.WaterMarkTextInfo.WaterMarkPosition  = this.RadioButtonList3.SelectedItem.Text.Trim();
        obj2.WaterMarkConfig.WaterMarkTextInfo.WaterMarkPositionX = int.Parse(this.TextBox10.Text);
        obj2.WaterMarkConfig.WaterMarkTextInfo.WaterMarkPositionY = int.Parse(this.TextBox11.Text);

        ZoomLa.Components.SiteConfig obj = new ZoomLa.Components.SiteConfig();
        obj.Update(obj2);
        Response.Write("<script>alert('配置保存成功')</script>");
    }
コード例 #11
0
ファイル: SiteConfig.cs プロジェクト: caisimongit/cms-1
 /// <summary>
 /// 更新配置文件
 /// </summary>
 /// <param name="config"></param>
 public void Update(SiteConfigInfo config)
 {
     try
     {
         XmlSerializer serializer = new XmlSerializer(typeof(SiteConfigInfo));
         using (Stream stream = new FileStream(this.filePath, FileMode.Create, FileAccess.Write, FileShare.None))
         {
             XmlSerializerNamespaces namespaces = new XmlSerializerNamespaces();
             namespaces.Add("", "");
             serializer.Serialize(stream, config, namespaces);
         }
     }
     catch (SecurityException exception)
     {
         throw new SecurityException(exception.Message, exception.DenySetInstance, exception.PermitOnlySetInstance, exception.Method, exception.Demanded, exception.FirstPermissionThatFailed);
     }
 }