コード例 #1
0
ファイル: TagAjax.aspx.cs プロジェクト: sunsiz/We7CMS
        string GetTags()
        {
            int         pageIndex = We7Request.GetInt("pi", 1);
            int         pageSize  = We7Request.GetInt("ps", 10);
            List <Tags> list      = TagsHelper.GetTags(pageIndex, pageSize);

            if (list != null && list.Count > 0)
            {
                string json = JavaScriptConvert.SerializeObject(list).Replace("null", "\"\"");

                return("{\"success\":true,\"msg\":\"操作成功!\",\"Data\":" + json + "}");
            }
            else
            {
                return("{\"success\":true,\"msg\":\"无数据!\"}");
            }
        }
コード例 #2
0
ファイル: System_image.ascx.cs プロジェクト: jiaping/JPCMS
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            #region 保存设置信息

            //if (this.CheckCookie())
            //{

            //    Hashtable ht = new Hashtable();
            //    ht.Add("图片附件文字水印大小", watermarkfontsize.Text);
            //    ht.Add("JPG图片质量", attachimgquality.Text);
            //    ht.Add("图片最大高度", attachimgmaxheight.Text);
            //    ht.Add("图片最大宽度", attachimgmaxwidth.Text);

            //    foreach (DictionaryEntry de in ht)
            //    {
            //        if (!Utils.IsInt(de.Value.ToString()))
            //        {
            //            base.RegisterStartupScript("", "<script>alert('输入错误," + de.Key.ToString() + "只能是0或者正整数');window.location.href='global_attach.aspx';</script>");
            //            return;
            //        }

            //    }



            if (Convert.ToInt16(attachimgquality.Text) > 100 || (Convert.ToInt16(attachimgquality.Text) < 0))
            {
                this.Page.RegisterStartupScript("", "<script>alert('JPG图片质量只能在0-100之间');window.location.href='global_attach.aspx';</script>");
                return;
            }

            if (Convert.ToInt16(watermarktransparency.Text) > 10 || Convert.ToInt16(watermarktransparency.Text) < 1)
            {
                this.Page.RegisterStartupScript("", "<script>alert('图片水印透明度取值范围1-10');window.location.href='global_attach.aspx';</script>");
                return;
            }

            if (Convert.ToInt16(watermarkfontsize.Text) <= 0)
            {
                this.Page.RegisterStartupScript("", "<script>alert('图片附件添加文字水印的大小必须大于0');window.location.href='global_attach.aspx';</script>");
                return;
            }


            //if (Convert.ToInt16(attachimgmaxheight.Text) < 0)
            //{
            //    this.Page.RegisterStartupScript("", "<script>alert('图片最大高度必须大于或等于0');window.location.href='global_attach.aspx';</script>");
            //    return;
            //}

            //if (Convert.ToInt16(attachimgmaxwidth.Text) < 0)
            //{
            //    this.Page.RegisterStartupScript("", "<script>alert('图片最大宽度必须大于或等于0');window.location.href='global_attach.aspx';</script>");
            //    return;
            //}

            string            configFile   = Server.MapPath("~/Config/general.config");
            GeneralConfigInfo __configinfo = new GeneralConfigInfo();
            if (File.Exists(configFile))
            {
                __configinfo = GeneralConfigs.Deserialize(configFile);
            }
            //GeneralConfigInfo __configinfo = GeneralConfigs.Deserialize(Server.MapPath("~/Config/general.config"));
            __configinfo.WaterMarkStatus            = We7Request.GetInt("watermarkstatus", 0);
            __configinfo.WaterMarkType              = Convert.ToInt16(watermarktype.SelectedValue);
            __configinfo.WaterMarkText              = watermarktext.Text;
            __configinfo.WaterMarkPic               = watermarkpic.Text;
            __configinfo.WaterMarkFontName          = watermarkfontname.SelectedValue;
            __configinfo.WaterMarkFontSize          = Convert.ToInt32(watermarkfontsize.Text);
            __configinfo.WaterMarkTransparency      = Convert.ToInt16(watermarktransparency.Text);
            __configinfo.MaxWidthOfUploadedImg      = Convert.ToInt32(MaxWidthOfUploadedImgTextbox.Text);
            __configinfo.CutToMaxWidthOfUploadedImg = CuttoMaxCheckBox.Checked ? 1 : 0;

            GeneralConfigs.Serialiaze(__configinfo, Server.MapPath("~/Config/general.config"));

            Response.Redirect("system.aspx");
            //this.Page.RegisterStartupScript("PAGE", "window.location.href='sytem.aspx';");
            #endregion
        }