コード例 #1
0
ファイル: UserImgFile.aspx.cs プロジェクト: holdbase/IES2
 //上传图片
 public void shangchuan()
 {
     int id = UserService.CurrentUser.UserID;
     bool rs = false;
     List<IES.Resource.Model.Attachment> list = IES.Service.FileService.AttachmentUpload();
     if (list.Count == 1)
     {
         string guid = list[0].Guid;
         int sourceid = id;
         string source = "User";
         IES.Resource.Model.Attachment atmt = new IES.Resource.Model.Attachment { Guid = guid, Source = source, SourceID = sourceid };
         rs = IES.Service.FileService.AttachmentRelation(atmt);
         if (rs == true)
         {
             Page.ClientScript.RegisterStartupScript(this.GetType(), "js", "successMsg();", true);
         }
         else
         {
             Response.Write("<script>alert('上传失败');</script>");
         }
     }
     else
     {
         Response.Write("<script>alert('没有找到图片');</script>");
     }
 }
コード例 #2
0
ファイル: UserImgFile.ashx.cs プロジェクト: holdbase/IES2
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int            id  = UserService.CurrentUser.UserID;
            bool           rs  = false;
            HttpPostedFile hpf = HttpContext.Current.Request.Files["imgfile"];
            List <IES.Resource.Model.Attachment> list = IES.Service.FileService.AttachmentUpload();

            if (list.Count == 1)
            {
                string guid     = list[0].Guid;
                int    sourceid = id;
                string source   = "User";
                IES.Resource.Model.Attachment atmt = new IES.Resource.Model.Attachment {
                    Guid = guid, Source = source, SourceID = sourceid
                };
                rs = IES.Service.FileService.AttachmentRelation(atmt);
            }
            if (rs == true)
            {
                context.Response.Write("修改成功");
            }
            else
            {
                context.Response.Write(hpf.FileName);
            }
        }
コード例 #3
0
        //上传图片
        public void shangchuan()
        {
            int  id = UserService.CurrentUser.UserID;
            bool rs = false;
            List <IES.Resource.Model.Attachment> list = IES.Service.FileService.AttachmentUpload();

            if (list.Count == 1)
            {
                string guid     = list[0].Guid;
                int    sourceid = id;
                string source   = "User";
                IES.Resource.Model.Attachment atmt = new IES.Resource.Model.Attachment {
                    Guid = guid, Source = source, SourceID = sourceid
                };
                rs = IES.Service.FileService.AttachmentRelation(atmt);
                if (rs == true)
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "js", "successMsg();", true);
                }
                else
                {
                    Response.Write("<script>alert('上传失败');</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('没有找到图片');</script>");
            }
        }
コード例 #4
0
ファイル: UploadFile.aspx.cs プロジェクト: holdbase/IES2
 public static bool File_Upload(int source_id, string sourceName, List<IES.Resource.Model.Attachment> list)
 {
     bool flag = false;
     for (int i = 0; i < list.Count; i++)
     {
         string guid = list[i].Guid;
         int sourceid = source_id;
         string source = sourceName;
         IES.Resource.Model.Attachment atmt = new IES.Resource.Model.Attachment { Guid = guid, Source = source, SourceID = sourceid };
         flag = IES.Service.FileService.AttachmentRelation(atmt);
     }
     return flag;
 }
コード例 #5
0
        public static bool File_Upload(int source_id, string sourceName, List <IES.Resource.Model.Attachment> list)
        {
            bool flag = false;

            for (int i = 0; i < list.Count; i++)
            {
                string guid     = list[i].Guid;
                int    sourceid = source_id;
                string source   = sourceName;
                IES.Resource.Model.Attachment atmt = new IES.Resource.Model.Attachment {
                    Guid = guid, Source = source, SourceID = sourceid
                };
                flag = IES.Service.FileService.AttachmentRelation(atmt);
            }
            return(flag);
        }
コード例 #6
0
        /// <summary>
        /// 用户头像上传
        /// </summary>
        /// <param name="context"></param>
        public void UserImgUpload(HttpContext context)
        {
            int  id = IES.Service.UserService.CurrentUser.UserID;
            bool rs = false;
            List <IES.Resource.Model.Attachment> list = IES.Service.FileService.AttachmentUpload();

            if (list.Count == 1)
            {
                string guid     = list[0].Guid;
                int    sourceid = id;
                string source   = "User";
                IES.Resource.Model.Attachment atmt = new IES.Resource.Model.Attachment {
                    Guid = guid, Source = source, SourceID = sourceid
                };
                rs = IES.Service.FileService.AttachmentRelation(atmt);
            }
            context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(list));
        }
コード例 #7
0
ファイル: FileUpload.aspx.cs プロジェクト: holdbase/IES2
 protected void Page_Load(object sender, EventArgs e)
 {
     bool rs = false;
     List<IES.Resource.Model.Attachment> list = IES.Service.FileService.AttachmentUpload();
     for (int i = 0; i < list.Count; i++)
     {
         string guid = list[i].Guid;
         int sourceid = 1;
         string source = "ForumTopic";
         IES.Resource.Model.Attachment atmt = new IES.Resource.Model.Attachment { Guid = guid, Source = source, SourceID = sourceid };
         rs = IES.Service.FileService.AttachmentRelation(atmt);
         if (rs)
         {
             Response.Write(true);
         }
         else
         {
             Response.Write(false);
         }
     }
 }
コード例 #8
0
ファイル: FileUpload.ashx.cs プロジェクト: holdbase/IES2
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     bool rs = false;
     List<IES.Resource.Model.Attachment> list = IES.Service.FileService.AttachmentUpload();
     for (int i = 0; i < list.Count; i++)
     {
         string guid = list[i].Guid;
         int sourceid = 1;
         string source = "ForumTopic";
         IES.Resource.Model.Attachment atmt = new IES.Resource.Model.Attachment { Guid = guid, Source = source, SourceID = sourceid };
         rs = IES.Service.FileService.AttachmentRelation(atmt);
     }
     if (rs)
     {
         context.Response.Write(1);
     }
     else
     {
         context.Response.Write(0);
     }
 }
コード例 #9
0
ファイル: UserImgFile.ashx.cs プロジェクト: holdbase/IES2
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     int id = UserService.CurrentUser.UserID;
     bool rs = false;
     HttpPostedFile hpf = HttpContext.Current.Request.Files["imgfile"];
     List<IES.Resource.Model.Attachment> list = IES.Service.FileService.AttachmentUpload();
     if (list.Count == 1)
     {
         string guid = list[0].Guid;
         int sourceid = id;
         string source = "User";
         IES.Resource.Model.Attachment atmt = new IES.Resource.Model.Attachment { Guid = guid, Source = source, SourceID = sourceid };
         rs = IES.Service.FileService.AttachmentRelation(atmt);
     }
     if (rs == true)
     {
         context.Response.Write("修改成功");
     }
     else
     {
         context.Response.Write(hpf.FileName);
     }
 }
コード例 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool rs = false;
            List <IES.Resource.Model.Attachment> list = IES.Service.FileService.AttachmentUpload();

            for (int i = 0; i < list.Count; i++)
            {
                string guid     = list[i].Guid;
                int    sourceid = 1;
                string source   = "ForumTopic";
                IES.Resource.Model.Attachment atmt = new IES.Resource.Model.Attachment {
                    Guid = guid, Source = source, SourceID = sourceid
                };
                rs = IES.Service.FileService.AttachmentRelation(atmt);
                if (rs)
                {
                    Response.Write(true);
                }
                else
                {
                    Response.Write(false);
                }
            }
        }
コード例 #11
0
ファイル: UploadFile.ashx.cs プロジェクト: holdbase/IES2
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     bool rs = false;
     int sid = Convert.ToInt32(context.Request["sourceid"]);
     string s = context.Request["source"];
     List<IES.Resource.Model.Attachment> list = IES.Service.FileService.AttachmentUpload();
     for (int i = 0; i < list.Count; i++)
     {
         string guid = list[i].Guid;
         int sourceid = sid;
         string source = s.Trim();
         IES.Resource.Model.Attachment atmt = new IES.Resource.Model.Attachment { Guid = guid, Source = source, SourceID = sourceid };
         rs = IES.Service.FileService.AttachmentRelation(atmt);
     }
     if (rs)
     {
         context.Response.Write(true);
     }
     else
     {
         context.Response.Write(false);
     }
 }
コード例 #12
0
ファイル: FileUpload.ashx.cs プロジェクト: holdbase/IES2
 /// <summary>
 /// 用户头像上传
 /// </summary>
 /// <param name="context"></param>
 public void UserImgUpload(HttpContext context)
 {
     int id = IES.Service.UserService.CurrentUser.UserID;
     bool rs = false;
     List<IES.Resource.Model.Attachment> list = IES.Service.FileService.AttachmentUpload();
     if (list.Count == 1)
     {
         string guid = list[0].Guid;
         int sourceid = id;
         string source = "User";
         IES.Resource.Model.Attachment atmt = new IES.Resource.Model.Attachment { Guid = guid, Source = source, SourceID = sourceid };
         rs = IES.Service.FileService.AttachmentRelation(atmt);
     }
     context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(list));
 }