From 6c0935ba9e456aecb286edde399c0186f4e137c3 Mon Sep 17 00:00:00 2001 From: j502647092 Date: Fri, 19 Jun 2015 15:12:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A,=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E9=83=A8=E5=88=86=E6=97=A0=E6=95=88=E6=95=B0=E6=8D=AE?= =?UTF-8?q?...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CitySunlight.v12.suo | Bin 105472 -> 105472 bytes CitySunlight/Account/UserManager.cs | 39 +++++-- CitySunlight/CitySunlight.csproj | 2 - CitySunlight/HttpUtils.cs | 45 ++++++++ CitySunlight/Product/ProductClassManager.cs | 50 +++++++-- CitySunlight/Utils.cs | 109 -------------------- 6 files changed, 121 insertions(+), 124 deletions(-) delete mode 100644 CitySunlight/Utils.cs diff --git a/CitySunlight.v12.suo b/CitySunlight.v12.suo index 8c107b56ff4938a34d5af0c34b65934415d0f61d..1b55759ec949ac4f76856c2030bcbdde4d253976 100644 GIT binary patch delta 1542 zcmcIjeM}rx5P$F7y*uFCZp*=O7d|dqS~)rBp`eujhXO)DLJuU-ihz6=p%}idwAWNw zG*Z))YIkf&V=A(##Lw8?CfrreRs|AcYsB^s4M`Pij4?6B#MaPi)p^GrwCX?o!Vt?%vSfG=#hYy%?RdgLRpIt z5O*S6h*HEx1pL9J*z-}TM7R;@2$tXhl3*yiF51hcXfG_zjJE&kC4=Mf1&(uB)@)Q*u`GA25%`HKrC4Cx z1ckGrB_~9e>pqF{JzbBW{6N=Fqx?|UKZY;F-&Ko25x*+9sW?4;7UO>nS|kHV>CGSu z5~yn=b30bp!AgFyGK-%^*Ioz+E|6^Xd>C&pFW&@-YeT2;<}NCM#}LoIk8e|O#qQFi zDv6p~@X@Ge0soddm@(w>$Ixf5b|uMVRvu~>YXc_5mv7RVY6GMFgZVCyE0f^))+JgE zorVW{5vsXwiG7K$AiKz2FloyGxw{)YqbcI; z8{GA8E$y7E`FY*gh1u|z=qBAdhFP~`BkYXANOu=_8j{sJ;*}~V-HhSu&7JsSMMMcZ zh3;=hDN>W``H%3n6MPvpFqKe8Uf~|90lsMYwmtqk5^@W?m)dG3+MxAMmT>NDc{R z1&>ZpK)8+G1Czc6eg+8})(I<8d$?dxIptW6>zFIvuUN~u$FDbPe(Qd!`VC6=2Jy2) z3r9ke-<^N$=o@uKQ%5=0wpKkbO~=n|rBA?OXdO6Da@y0op5cQyLfqn zHmvty*TSOaPPRm&(cIcdHQE~1%KNk-jKvcZqMQ}Nlp&wb7lUO9=0Y?i!cQDm*Mi6* zB(N|l5u##}aeO|6LJ~xR3{kXCm`NSdWTPH?xX3pXW8TP|dZbKd;;A|t3zMI|8f!>1 z+z{t|;zTw#9%ql%RQpkDk8V2b|Jj?mCaAp$>Ws<+<3HOI(Ov=@q81^MIwfhW$?1sw zvq}9aM#k_SXGMhiaA0S#-yf!5zyT%soj`A{?~bl0{jT4l47H8E)C2SaZfzkkkrgYL>s` zZ~^MGrE>G^=X&qfMNG$xSpKbvO?$mL<&4S?-Q;rSiy$RK=CUz~Nh@)hIF=NNR^w)c zct(3gg@yMDUGhAZ!fSGOPEbtchAs9@a~{O*>{ypS=f_ext(qL!k+j=1-(Y*W=1OT= z{GO+UT}}P>Juk^_NusZ@kM#aeOYKK(S3H35V1W-7i{gLc1_I;i;?l=Qg$_p{7@K>w zq*P5cEM8Yq{lqX!EQz_hpw*XK;_oiEsy`skRd9q=P{eI3A6l;!lx8zG$2KrMD@4`` zPhFGrG6d`TtNMhjg2>I_G? z`QKA!6BCw=1c;mQ_+%X)+$M&`s9*ICENq7vPzM&Mb=s$GQ!w#=_88S4CNsXaF~y0S}yoMmPse& trytimes = new Dictionary(); private static SqlHelper sql = new SqlHelper("Data Source=.;Initial Catalog=myApplication;User ID=sa;Password=325325"); - + /// + /// 登录错误增加错误次数 + /// + /// 用户名 + /// 错误次数 public static int ErrLogin(String username) { return UpdateTimes(username, true); } - + /// + /// 获取错误次数 + /// + /// 用户名 + /// public static int GetTimes(String username) { return UpdateTimes(username, false); } - + /// + /// 更新错误次数 + /// + /// 用户名 + /// 是否添加 + /// private static int UpdateTimes(String username, bool add) { if (!trytimes.ContainsKey(username)) @@ -34,7 +47,12 @@ namespace CitySunlight } return trytimes[username]; } - + /// + /// 用户登录 + /// + /// 用户名 + /// 密码 + /// 是否登录成功 public static bool LoginUser(String username, String password) { DataTable dt = sql.ExecuteDataTable("select * from " + tbname + " where UserName='" + username + "' and PassWord='" + password + "'", CommandType.Text); @@ -46,7 +64,11 @@ namespace CitySunlight UpdateTimes(username, true); return false; } - + /// + /// 检查用户是否存在 + /// + /// 用户名 + /// 是否存在 public static bool isExist(String username) { DataTable dt = sql.ExecuteDataTable("select * from " + tbname + " where UserName='" + username + "'", CommandType.Text); @@ -56,7 +78,12 @@ namespace CitySunlight } return false; } - + /// + /// 注册用户 + /// + /// 用户名 + /// 密码 + /// 是否注册成功 public static bool RegisterUser(String username, String password) { int insert = sql.ExecuteNonQuery("insert into " + tbname + "(UserName,PassWord) values('" + username + "','" + password + "')"); diff --git a/CitySunlight/CitySunlight.csproj b/CitySunlight/CitySunlight.csproj index 26d0e4f..05323fc 100644 --- a/CitySunlight/CitySunlight.csproj +++ b/CitySunlight/CitySunlight.csproj @@ -69,7 +69,6 @@ - @@ -147,7 +146,6 @@ Login.aspx - diff --git a/CitySunlight/HttpUtils.cs b/CitySunlight/HttpUtils.cs index 69ee69b..35ee892 100644 --- a/CitySunlight/HttpUtils.cs +++ b/CitySunlight/HttpUtils.cs @@ -7,6 +7,11 @@ namespace CitySunlight { public static class HttpUtils { + /// + /// 通过标签名获取数据 + /// + /// 标签名称 + /// 标签数据 public static String getElementsbyName(String tagName) { if (HttpContext.Current.Request.Form[tagName] != null) @@ -14,6 +19,11 @@ namespace CitySunlight else return null; } + /// + /// 查询Get标签数据 + /// + /// Get标签 + /// 标签数据 public static String getQueryString(String tagName) { if (HttpContext.Current.Request.QueryString[tagName] != null) @@ -21,6 +31,11 @@ namespace CitySunlight else return null; } + /// + /// 通过标签获取文件数据 + /// + /// 文件标签 + /// 文件数据 public static HttpPostedFile getFilebyName(String tagName) { HttpPostedFile file = HttpContext.Current.Request.Files[tagName]; @@ -29,18 +44,38 @@ namespace CitySunlight else return null; } + /// + /// 获得1970年1月1日到现在的秒数 + /// + /// 1970年1月1日到现在的秒数 public static long currentTimeMillis() { return (long)((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds); } + /// + /// 添加Td + /// + /// Td的html代码 public static String addTd() { return ""; } + /// + /// 添加Td(带内容) + /// + /// 内容 + /// Td带内容的Html代码 public static String addTd(String s) { return String.Format("{0}", s); } + /// + /// 可配置大小的Td标签 + /// + /// 内容 + /// 宽 + /// 高 + /// public static String addTd(String s, int col, int row) { String td = "{0}", s); } + /// + /// String尝试转换为Int(扩展方法) + /// + /// + /// public static int ToInt(this string s) { int i; @@ -57,6 +97,11 @@ namespace CitySunlight } return i; } + /// + /// String尝试转换为decimal(扩展方法) + /// + /// + /// public static decimal Todecimal(this string s) { decimal i; diff --git a/CitySunlight/Product/ProductClassManager.cs b/CitySunlight/Product/ProductClassManager.cs index 54e04cb..a023538 100644 --- a/CitySunlight/Product/ProductClassManager.cs +++ b/CitySunlight/Product/ProductClassManager.cs @@ -12,12 +12,21 @@ namespace CitySunlight //分类表名 public const String tbname = "tb_proclass"; - //获得分类列表默认选择第一个 + /// + /// 获得分类列表的Html代码,默认选择第一个 + /// + /// 列表名 + /// 分类列表的Html代码 public static String getOptionString(String name) { return getOptionString(name, "0"); } - //获得分类列表 可以配置选项 + /// + /// 获得分类列表的Html代码,可配置选项(数据库部分) + /// + /// 列表名 + /// 列表选项 + /// 分类列表的Html代码 public static String getOptionString(String name, String df) { String html = ""; return html; } - //获得分类名称通过ID + /// + /// 通过ID获得分类名称(数据库部分) + /// + /// 分类ID + /// 分类名称 public static String getClassName(int Nid) { DataTable dt = sql.ExecuteDataTable("select * from " + tbname + " where nid='" + Nid + "'", CommandType.Text); @@ -41,16 +54,30 @@ namespace CitySunlight else return "分类已被删除"; } - //判断分类是否存在 + /// + /// 判断分类是否存在(数据库部分) + /// + /// 分类名称 + /// 是否存在 public static bool isExist(String name) { return sql.ExecuteDataTable("select * from " + tbname + " where ProClassName='" + name + "'", CommandType.Text).Rows.Count > 0; } + /// + /// 通过Id判断分类是否存在(数据库部分) + /// + /// 分类ID + /// 是否存在 public static bool isExist(int nid) { return sql.ExecuteDataTable("select * from " + tbname + " where Nid='" + nid + "'", CommandType.Text).Rows.Count > 0; } - //添加分类 + /// + /// 添加分类(数据库部分) + /// + /// + /// + /// 是否成功 public static bool addclass(int Pid, String classname) { int j = sql.ExecuteNonQuery("insert into " + tbname + "(Pid,ProClassName) values('" + Pid + "','" + classname + "')", CommandType.Text); @@ -58,7 +85,11 @@ namespace CitySunlight return true; return false; } - //删除分类 + /// + /// 删除分类(数据库部分) + /// + /// + /// 是否成功 public static bool removeclass(int Nid) { if (Nid != 0) @@ -69,7 +100,12 @@ namespace CitySunlight } return false; } - //修改分类 + /// + /// 修改分类(数据库部分) + /// + /// 分类ID + /// 修改后的名称 + /// 是否成功 public static bool editclass(int Nid, String cname) { if (Nid != 0) diff --git a/CitySunlight/Utils.cs b/CitySunlight/Utils.cs deleted file mode 100644 index 59de9fd..0000000 --- a/CitySunlight/Utils.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Linq; -using System.Text; -using System.Web; - -namespace CitySunlight -{ - - - - public static class Utils - { - public static IList ToItemInfoList(this DataTable t, string pFieldValue, string pFieldText) - { - IList list = new List(); - if (t == null) - { - return list; - } - - foreach (DataRow row in t.Rows) - { - list.Add(ItemInfo.Create(row[pFieldValue].ToString(), row[pFieldText].ToString())); - } - - return list; - } - - public static string GetSelect(IList pInfolist, string pControlName, string pEditValue, string pFirstValue, string pFirstText) - { - StringBuilder sbStr = new StringBuilder(); - sbStr.Append("