RoadFlow2.1 临时演示

Default.aspx.cs 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. namespace WebForm.Platform.WorkFlowSign
  8. {
  9. public partial class Default : Common.BasePage
  10. {
  11. protected void Page_Load(object sender, EventArgs e)
  12. {
  13. if (IsPostBack)
  14. {
  15. if (FileUpload1.HasFile)
  16. {
  17. var file = FileUpload1.PostedFile;
  18. if (file.ContentLength > 0)
  19. {
  20. string extname = System.IO.Path.GetExtension(file.FileName);
  21. if (extname.IsNullOrEmpty() || (extname.ToLower() != ".gif" && extname.ToLower() != ".jpg") && extname.ToLower() != ".png")
  22. {
  23. Response.Write("<script>alert('只能上传gif,jpg,png类型的图片文件!'); window.location = window.location;</script>");
  24. Response.End();
  25. }
  26. string filename = string.Concat(Server.MapPath(WebForm.Common.Tools.BaseUrl + "/Files/UserSigns/"), RoadFlow.Platform.Users.CurrentUserID, ".gif");
  27. FileUpload1.SaveAs(filename);
  28. RoadFlow.Platform.Log.Add("修改了签名", filename, RoadFlow.Platform.Log.Types.流程相关);
  29. Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('上传成功!'); window.location = window.location;", true);
  30. }
  31. }
  32. if (!Request.Form["reset"].IsNullOrEmpty())
  33. {
  34. string filename = string.Concat(Server.MapPath(WebForm.Common.Tools.BaseUrl + "/Files/UserSigns/"), RoadFlow.Platform.Users.CurrentUserID, ".gif");
  35. if (System.IO.File.Exists(filename))
  36. {
  37. System.IO.File.Delete(filename);
  38. RoadFlow.Platform.Log.Add("恢复了签名", filename, RoadFlow.Platform.Log.Types.流程相关);
  39. }
  40. Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('已恢复为默认签名!'); window.location = window.location;", true);
  41. }
  42. }
  43. }
  44. }
  45. }