public Spread.Model.Admin GetLogModel() { Spread.Model.Admin admin = new Spread.Model.Admin(); admin.Id = int.Parse(HttpContext.Current.Request.Cookies["AdminState"]["AdminNo"]); admin.UserName = Spread.Common.Function.UrlDecode(HttpContext.Current.Request.Cookies["AdminState"]["AdminName"]); admin.ReadName = Spread.Common.Function.UrlDecode(HttpContext.Current.Request.Cookies["AdminState"]["ReadName"]); admin.UserPwd = Spread.Common.Function.UrlDecode(HttpContext.Current.Request.Cookies["AdminState"]["UserPwd"]); return admin; }
/// <summary> /// 获得数据列表 /// </summary> public List<Spread.Model.Admin> DataTableToList(DataTable dt) { List<Spread.Model.Admin> modelList = new List<Spread.Model.Admin>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Spread.Model.Admin model; for (int n = 0; n < rowsCount; n++) { model = new Spread.Model.Admin(); if(dt.Rows[n]["Id"].ToString()!="") { model.Id=int.Parse(dt.Rows[n]["Id"].ToString()); } model.UserName=dt.Rows[n]["UserName"].ToString(); model.UserPwd=dt.Rows[n]["UserPwd"].ToString(); model.ReadName=dt.Rows[n]["ReadName"].ToString(); model.UserEmail=dt.Rows[n]["UserEmail"].ToString(); if(dt.Rows[n]["UserType"].ToString()!="") { model.UserType=int.Parse(dt.Rows[n]["UserType"].ToString()); } model.UserLevel=dt.Rows[n]["UserLevel"].ToString(); if(dt.Rows[n]["IsLock"].ToString()!="") { model.IsLock=Convert.ToBoolean(dt.Rows[n]["IsLock"].ToString()); } modelList.Add(model); } } return modelList; }