您目前尚未登陆,请选择【登陆】或【注册
首页->全站代码->IFNuke1.1.0版源码>>MySpace/UI/MySpaceModuleBase.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:IFNuke1.1.0版源码
当前文件:文件类型 IFnuke110/MySpace/UI/MySpaceModuleBase.cs打开代码结构图
普通视图
		            
1using System; 2using System.Collections.Generic; 3using System.Text; 4using System.Web; 5using System.Drawing; 6 7using IFNuke.Data; 8using IFNuke.Web.Security; 9using IFNuke.Web; 10using IFNuke.Web.UI.Modules; 11using IFNuke.MySpaces.BO; 12 13namespace IFNuke.MySpaces.UI 14{ 15 public class MySpaceModuleBase : PortalModuleBase 16 { 17 protected Dictionary<string, string> MySpaceSettings 18 { 19 get 20 { 21 if (HttpContext.Current.Items["MySpaceSettings"] == null) 22 { 23 24 HttpContext.Current.Items["MySpaceSettings"] = (new MySpaceSetting(PortalSetting.Id)).Settings; 25 26 } 27 return (Dictionary<string, string> )HttpContext.Current.Items["MySpaceSettings"]; 28 } 29 } 30 31 protected int MySpaceId 32 { 33 get 34 { 35 object o = ViewState["MySpaceId"]; 36 return (o == null) ? MagicValue.IdNull : (int)o; 37 } 38 set 39 { 40 ViewState["MySpaceId"] = value; 41 } 42 } 43 44 protected int CategoryId 45 { 46 get 47 { 48 object o = ViewState["CategoryId"]; 49 return (o == null) ? MagicValue.IdNull : (int)o; 50 } 51 set 52 { 53 ViewState["CategoryId"] = value; 54 } 55 } 56 57 protected int PostId 58 { 59 get 60 { 61 object o = ViewState["PostId"]; 62 return (o == null) ? MagicValue.IdNull : (int)o; 63 } 64 set 65 { 66 ViewState["PostId"] = value; 67 } 68 } 69 70 protected int AlbumId 71 { 72 get 73 { 74 object o = ViewState["AlbumId"]; 75 return (o == null) ? MagicValue.IdNull : (int)o; 76 } 77 set 78 { 79 ViewState["AlbumId"] = value; 80 } 81 } 82 83 protected int PhotoId 84 { 85 get 86 { 87 object o = ViewState["PhotoId"]; 88 return (o == null) ? MagicValue.IdNull : (int)o; 89 } 90 set 91 { 92 ViewState["PhotoId"] = value; 93 } 94 } 95 96 protected bool CanOperation 97 { 98 get 99 { 100 object o = ViewState["CanOperation"]; 101 return o == null ? false : (bool)o; 102 } 103 set 104 { 105 ViewState["CanOperation"] = value; 106 } 107 108 } 109 110 protected virtual void InitProperties() 111 { 112 if (Request.QueryString["MySpaceId"] != null) 113 MySpaceId = Int32.Parse(Request.QueryString["MySpaceId"]); 114 else 115 { 116 MySpaceId = IFNuke.MySpaces.BO.MySpace.GetSingleSpaceId(PortalSetting.Id); 117 } 118 if (Request.QueryString["CategoryId"] != null) 119 CategoryId = Int32.Parse(Request.QueryString["CategoryId"]); 120 if (Request.QueryString["PostId"] != null) 121 PostId = Int32.Parse(Request.QueryString["PostId"]); 122 if (Request.QueryString["AlbumId"] != null) 123 AlbumId = Int32.Parse(Request.QueryString["AlbumId"]); 124 if (Request.QueryString["PhotoId"] != null) 125 PhotoId = Int32.Parse(Request.QueryString["PhotoId"]); 126 CanOperation = GetCanOperation(); 127 } 128 129 protected virtual bool GetCanOperation() 130 { 131 if (CurrentUser.IsAuthenticated && PortalSecurity.IsEditMode()) 132 { 133 return PortalSecurity.IsPortalAdmin(); 134 } 135 else 136 return false; 137 } 138 139 public static Size ResizePhoto(int width, int height, int maxWidth, int maxHeight) 140 { 141 decimal Max_Width = (decimal)maxWidth; 142 decimal Max_Height = (decimal)maxHeight; 143 144 decimal Aspect_Ratio = Max_Width / maxHeight; 145 146 int newWidth, newHeight; 147 148 decimal originalWidth = (decimal)width; 149 decimal originalHeight = (decimal)height; 150 151 if (originalWidth > Max_Width || originalHeight > Max_Height) 152 { 153 decimal factor; 154 if (originalWidth / originalHeight > Aspect_Ratio) 155 { 156 factor = originalWidth / Max_Width; 157 //newWidth = Convert.ToInt32(originalWidth / factor); 158 //newHeight = Convert.ToInt32(originalHeight / factor); 159 } 160 else 161 { 162 factor = originalHeight / maxHeight; 163 //newWidth = Convert.ToInt32(originalWidth / factor); 164 //newHeight = Convert.ToInt32(originalHeight / factor); 165 } 166 newWidth = Convert.ToInt32(originalWidth / factor); 167 newHeight = Convert.ToInt32(originalHeight / factor); 168 } 169 else 170 { 171 newWidth = width; 172 newHeight = height; 173 } 174 return new Size(newWidth, newHeight); 175 } 176 } 177} 178
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:IFNuke1.1.0版源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号