예제 #1
0
        //从控件上传文件
        public void fileUpload(int num)
        {
            string spic = "";

            if (num == 1)
            {
                #region 微博上传
                if (filepic_weibo.PostedFile != null && filepic_weibo.PostedFile.FileName != "")
                {
                    if (!Directory.Exists(Server.MapPath(Global_Upload.ErWeiImgPath)))         //判断目录是否存在
                    {
                        Directory.CreateDirectory(Server.MapPath(Global_Upload.ErWeiImgPath)); //创建目录
                    }
                    spic = DoClass.UploadFile(filepic_weibo.PostedFile, Global_Upload.Imgsize, Global_Upload.ImgType, Global_Upload.ErWeiImgPath);

                    if (spic == "-1")
                    {
                        return;
                    }
                    else if (spic == "0")
                    {
                        return;
                    }
                    else
                    {
                        //ViewState["img1Name"] = spic;
                        spic = Global_Upload.ErWeiImgPath + spic;
                        // ViewState["newsImg1"] = spic;
                        lblImgWeiBo.Text = spic;
                        BaseConfigService.SetValue(11111, spic);
                    }
                }
                #endregion
            }
        }
예제 #2
0
        /// <summary>
        /// 保存事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            BaseConfigService.SetValue(1, this.txtMonthValue.Text.Trim());
            BaseConfigService.SetValue(2, this.txtYearValue.Text.Trim());

            BaseConfigService.SetValue(5, this.txtVideo.Text.Trim());
            BaseConfigService.SetValue(11, this.txtBase1.Text.Trim());
            BaseConfigService.SetValue(12, this.txtBase2.Text.Trim());
            BaseConfigService.SetValue(13, this.txtBase3.Text.Trim());
            BaseConfigService.SetValue(14, this.txtBase4.Text.Trim());
            BaseConfigService.SetValue(15, this.txtBase5.Text.Trim());
            BaseConfigService.SetValue(16, this.txtBase6.Text.Trim());
            BaseConfigService.SetValue(17, this.txtBase7.Text.Trim());
            BaseConfigService.SetValue(18, this.txtBase8.Text.Trim());
            BaseConfigService.SetValue(19, this.txtBase9.Text.Trim());

            BaseConfigService.SetValue(20, this.txtBase12.Text.Trim());
            BaseConfigService.SetValue(21, this.txtBase13.Text.Trim());
            BaseConfigService.SetValue(22, this.txtBase14.Text.Trim());
            BaseConfigService.SetValue(23, this.txtBase15.Text.Trim());
            BaseConfigService.SetValue(39, this.tb_id.Text.Trim());
            BaseConfigService.SetValue(40, this.tb_secret.Text.Trim());
            BaseConfigService.SetValue(41, this.tb_URL.Text.Trim());
            string spic = "";

            if (this.FileUpload1.PostedFile != null && FileUpload1.PostedFile.FileName != "")
            {
                if (!Directory.Exists(Server.MapPath(Global_Upload.NewsImgPath)))         //判断目录是否存在
                {
                    Directory.CreateDirectory(Server.MapPath(Global_Upload.NewsImgPath)); //创建目录
                }
                spic = DoClass.UploadFile(FileUpload1.PostedFile, Global_Upload.Imgsize, Global_Upload.ImgType, Global_Upload.NewsImgPath);

                if (spic == "-1")
                {
                    return;
                }
                else if (spic == "0")
                {
                    return;
                }
                else
                {
                    spic         = Global_Upload.NewsImgPath + spic;
                    lblURL1.Text = spic;
                }
            }
            if (this.FileUpload2.PostedFile != null && FileUpload2.PostedFile.FileName != "")
            {
                if (!Directory.Exists(Server.MapPath(Global_Upload.NewsImgPath)))         //判断目录是否存在
                {
                    Directory.CreateDirectory(Server.MapPath(Global_Upload.NewsImgPath)); //创建目录
                }
                spic = DoClass.UploadFile(FileUpload2.PostedFile, Global_Upload.Imgsize, Global_Upload.ImgType, Global_Upload.NewsImgPath);

                if (spic == "-1")
                {
                    return;
                }
                else if (spic == "0")
                {
                    return;
                }
                else
                {
                    spic         = Global_Upload.NewsImgPath + spic;
                    lblURL2.Text = spic;
                }
            }
            if (this.FileUpload3.PostedFile != null && FileUpload3.PostedFile.FileName != "")
            {
                if (!Directory.Exists(Server.MapPath(Global_Upload.NewsImgPath)))         //判断目录是否存在
                {
                    Directory.CreateDirectory(Server.MapPath(Global_Upload.NewsImgPath)); //创建目录
                }
                spic = DoClass.UploadFile(FileUpload3.PostedFile, Global_Upload.Imgsize, Global_Upload.ImgType, Global_Upload.NewsImgPath);

                if (spic == "-1")
                {
                    return;
                }
                else if (spic == "0")
                {
                    return;
                }
                else
                {
                    spic         = Global_Upload.NewsImgPath + spic;
                    lblURL3.Text = spic;
                }
            }
            if (this.FileUpload4.PostedFile != null && FileUpload4.PostedFile.FileName != "")
            {
                if (!Directory.Exists(Server.MapPath(Global_Upload.NewsImgPath)))         //判断目录是否存在
                {
                    Directory.CreateDirectory(Server.MapPath(Global_Upload.NewsImgPath)); //创建目录
                }
                spic = DoClass.UploadFile(FileUpload4.PostedFile, Global_Upload.Imgsize, Global_Upload.ImgType, Global_Upload.NewsImgPath);

                if (spic == "-1")
                {
                    return;
                }
                else if (spic == "0")
                {
                    return;
                }
                else
                {
                    spic         = Global_Upload.NewsImgPath + spic;
                    lblURL4.Text = spic;
                }
            }
            if (this.FileUpload5.PostedFile != null && FileUpload5.PostedFile.FileName != "")
            {
                if (!Directory.Exists(Server.MapPath(Global_Upload.NewsImgPath)))         //判断目录是否存在
                {
                    Directory.CreateDirectory(Server.MapPath(Global_Upload.NewsImgPath)); //创建目录
                }
                spic = DoClass.UploadFile(FileUpload5.PostedFile, Global_Upload.Imgsize, Global_Upload.ImgType, Global_Upload.NewsImgPath);

                if (spic == "-1")
                {
                    return;
                }
                else if (spic == "0")
                {
                    return;
                }
                else
                {
                    spic         = Global_Upload.NewsImgPath + spic;
                    lblURL5.Text = spic;
                }
            }
            BaseConfigService.SetValue(24, this.lblURL1.Text.Trim());
            BaseConfigService.SetValue(25, this.lblURL2.Text.Trim());
            BaseConfigService.SetValue(26, this.lblURL3.Text.Trim());
            BaseConfigService.SetValue(27, this.lblURL4.Text.Trim());
            BaseConfigService.SetValue(28, this.lblURL5.Text.Trim());
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('保存成功!');", true);
        }
예제 #3
0
 /// <summary>
 /// 保存事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Button1_Click(object sender, EventArgs e)
 {
     BaseConfigService.SetValue(222222, this.content2.Value.Trim().Replace("'", "\""));
     ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "alert('保存成功!');", true);
 }