diff --git a/CitySunlight.v12.suo b/CitySunlight.v12.suo index 8c107b5..1b55759 100644 Binary files a/CitySunlight.v12.suo and b/CitySunlight.v12.suo differ diff --git a/CitySunlight/Account/UserManager.cs b/CitySunlight/Account/UserManager.cs index 7df65e7..72d6922 100644 --- a/CitySunlight/Account/UserManager.cs +++ b/CitySunlight/Account/UserManager.cs @@ -11,17 +11,30 @@ namespace CitySunlight private const String tbname = "tb_user"; private static Dictionary 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("