//上传图片 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>"); } }
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); } }
//上传图片 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>"); } }
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; }
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); }
/// <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)); }
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); } } }
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); } }
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); } }
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); } } }
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); } }
/// <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)); }