📄 datahelper.cs
字号:
public static c_MessageInfo Init_c_MessageInfo(IDataReader reader) { c_MessageInfo _c_MessageInfo = new c_MessageInfo(); _c_MessageInfo.ID = Int32.Parse(reader["ID"].ToString()); _c_MessageInfo.Title = reader["Title"].ToString(); _c_MessageInfo.Content = reader["Content"].ToString(); _c_MessageInfo.RegisterID = reader["RegisterID"]==System.DBNull.Value?_c_MessageInfo.RegisterID:Int32.Parse(reader["RegisterID"].ToString()); _c_MessageInfo.OrherRegisterID = reader["OrherRegisterID"]==System.DBNull.Value?_c_MessageInfo.OrherRegisterID:Int32.Parse(reader["OrherRegisterID"].ToString()); _c_MessageInfo.MessageType = reader["MessageType"]==System.DBNull.Value?_c_MessageInfo.MessageType:Int32.Parse(reader["MessageType"].ToString()); _c_MessageInfo.PostDate = reader["PostDate"]==System.DBNull.Value?_c_MessageInfo.PostDate:System.DateTime.Parse(reader["PostDate"].ToString()); return _c_MessageInfo; } #endregion
#region c_OnlineUserInfo public static c_OnlineUserInfo Init_c_OnlineUserInfo(IDataReader reader) { c_OnlineUserInfo _c_OnlineUserInfo = new c_OnlineUserInfo(); _c_OnlineUserInfo.ID = Int32.Parse(reader["ID"].ToString()); _c_OnlineUserInfo.OnlineRegisterID = reader["OnlineRegisterID"]==System.DBNull.Value?_c_OnlineUserInfo.OnlineRegisterID:Int32.Parse(reader["OnlineRegisterID"].ToString()); _c_OnlineUserInfo.IsHidden = reader["IsHidden"]==System.DBNull.Value?_c_OnlineUserInfo.IsHidden:Boolean.Parse(reader["IsHidden"].ToString()); _c_OnlineUserInfo.LoginTime = reader["LoginTime"]==System.DBNull.Value?_c_OnlineUserInfo.LoginTime:System.DateTime.Parse(reader["LoginTime"].ToString()); _c_OnlineUserInfo.IP = reader["IP"].ToString(); return _c_OnlineUserInfo; } #endregion
#region c_SortInfo public static c_SortInfo Init_c_SortInfo(IDataReader reader) { c_SortInfo _c_SortInfo = new c_SortInfo(); _c_SortInfo.ID = Int32.Parse(reader["ID"].ToString()); _c_SortInfo.RegsiterID = reader["RegsiterID"]==System.DBNull.Value?_c_SortInfo.RegsiterID:Int32.Parse(reader["RegsiterID"].ToString()); _c_SortInfo.SortName = reader["SortName"].ToString(); _c_SortInfo.SortType = reader["SortType"]==System.DBNull.Value?_c_SortInfo.SortType:Int32.Parse(reader["SortType"].ToString()); _c_SortInfo.IsVisible = reader["IsVisible"]==System.DBNull.Value?_c_SortInfo.IsVisible:Boolean.Parse(reader["IsVisible"].ToString()); _c_SortInfo.OrderID = reader["OrderID"]==System.DBNull.Value?_c_SortInfo.OrderID:Int32.Parse(reader["OrderID"].ToString()); return _c_SortInfo; } #endregion
#region c_UserInfo public static c_UserInfo Init_c_UserInfo(IDataReader reader) { c_UserInfo _c_UserInfo = new c_UserInfo(); _c_UserInfo.ID = Int32.Parse(reader["ID"].ToString()); _c_UserInfo.Username = reader["Username"].ToString(); _c_UserInfo.Password = reader["Password"].ToString(); _c_UserInfo.SecurityPassword = reader["SecurityPassword"].ToString(); _c_UserInfo.Email = reader["Email"].ToString(); _c_UserInfo.FamilyName = reader["FamilyName"].ToString(); _c_UserInfo.FirstName = reader["FirstName"].ToString(); _c_UserInfo.NiceName = reader["NiceName"].ToString(); _c_UserInfo.Sex = reader["Sex"]==System.DBNull.Value?_c_UserInfo.Sex:Int32.Parse(reader["Sex"].ToString()); _c_UserInfo.Birthday = reader["Birthday"]==System.DBNull.Value?_c_UserInfo.Birthday:System.DateTime.Parse(reader["Birthday"].ToString()); _c_UserInfo.CountryID = reader["CountryID"]==System.DBNull.Value?_c_UserInfo.CountryID:Int32.Parse(reader["CountryID"].ToString()); _c_UserInfo.ProvinceID = reader["ProvinceID"]==System.DBNull.Value?_c_UserInfo.ProvinceID:Int32.Parse(reader["ProvinceID"].ToString()); _c_UserInfo.CityID = reader["CityID"]==System.DBNull.Value?_c_UserInfo.CityID:Int32.Parse(reader["CityID"].ToString()); _c_UserInfo.RegisterDate = reader["RegisterDate"]==System.DBNull.Value?_c_UserInfo.RegisterDate:System.DateTime.Parse(reader["RegisterDate"].ToString()); _c_UserInfo.StateID = reader["StateID"]==System.DBNull.Value?_c_UserInfo.StateID:Int32.Parse(reader["StateID"].ToString()); _c_UserInfo.LastIP = reader["LastIP"].ToString(); _c_UserInfo.ThisIP = reader["ThisIP"].ToString(); _c_UserInfo.LastLoginDate = reader["LastLoginDate"]==System.DBNull.Value?_c_UserInfo.LastLoginDate:System.DateTime.Parse(reader["LastLoginDate"].ToString()); _c_UserInfo.ThisLoginDate = reader["ThisLoginDate"]==System.DBNull.Value?_c_UserInfo.ThisLoginDate:System.DateTime.Parse(reader["ThisLoginDate"].ToString()); _c_UserInfo.DegreeID = reader["DegreeID"]==System.DBNull.Value?_c_UserInfo.DegreeID:Int32.Parse(reader["DegreeID"].ToString()); _c_UserInfo.BeginSeviceDate = reader["BeginSeviceDate"]==System.DBNull.Value?_c_UserInfo.BeginSeviceDate:System.DateTime.Parse(reader["BeginSeviceDate"].ToString()); _c_UserInfo.EndSeviceDate = reader["EndSeviceDate"]==System.DBNull.Value?_c_UserInfo.EndSeviceDate:System.DateTime.Parse(reader["EndSeviceDate"].ToString()); _c_UserInfo.Hits = reader["Hits"]==System.DBNull.Value?_c_UserInfo.Hits:Int32.Parse(reader["Hits"].ToString()); _c_UserInfo.LoginTimes = reader["LoginTimes"]==System.DBNull.Value?_c_UserInfo.LoginTimes:Int32.Parse(reader["LoginTimes"].ToString()); _c_UserInfo.Integral = reader["Integral"]==System.DBNull.Value?_c_UserInfo.Integral:Int32.Parse(reader["Integral"].ToString()); _c_UserInfo.Grade = reader["Grade"]==System.DBNull.Value?_c_UserInfo.Grade:Int32.Parse(reader["Grade"].ToString()); _c_UserInfo.Idiograph = reader["Idiograph"].ToString(); _c_UserInfo.Icon = reader["Icon"].ToString(); _c_UserInfo.Ideal = reader["Ideal"].ToString(); return _c_UserInfo; } #endregion
#region c_UserDataInfo public static c_UserDataInfo Init_c_UserDataInfo(IDataReader reader) { c_UserDataInfo _c_UserDataInfo = new c_UserDataInfo(); _c_UserDataInfo.ID = Int32.Parse(reader["ID"].ToString()); _c_UserDataInfo.RegisterID = reader["RegisterID"]==System.DBNull.Value?_c_UserDataInfo.RegisterID:Int32.Parse(reader["RegisterID"].ToString()); _c_UserDataInfo.BodilyID = reader["BodilyID"]==System.DBNull.Value?_c_UserDataInfo.BodilyID:Int32.Parse(reader["BodilyID"].ToString()); _c_UserDataInfo.Job = reader["Job"].ToString(); _c_UserDataInfo.EducationID = reader["EducationID"]==System.DBNull.Value?_c_UserDataInfo.EducationID:Int32.Parse(reader["EducationID"].ToString()); _c_UserDataInfo.EarningID = reader["EarningID"]==System.DBNull.Value?_c_UserDataInfo.EarningID:Int32.Parse(reader["EarningID"].ToString()); _c_UserDataInfo.Tel = reader["Tel"].ToString(); _c_UserDataInfo.HowKnowID = reader["HowKnowID"]==System.DBNull.Value?_c_UserDataInfo.HowKnowID:Int32.Parse(reader["HowKnowID"].ToString()); _c_UserDataInfo.IsOpen = reader["IsOpen"]==System.DBNull.Value?_c_UserDataInfo.IsOpen:Boolean.Parse(reader["IsOpen"].ToString()); _c_UserDataInfo.QQ = reader["QQ"]==System.DBNull.Value?_c_UserDataInfo.QQ:Int32.Parse(reader["QQ"].ToString()); _c_UserDataInfo.Msn = reader["Msn"].ToString(); _c_UserDataInfo.Homepage = reader["Homepage"].ToString(); return _c_UserDataInfo; } #endregion
#region c_ArticleInfo public static c_ArticleInfo Init_c_ArticleInfo(IDataReader reader) { c_ArticleInfo _c_ArticleInfo = new c_ArticleInfo(); _c_ArticleInfo.ID = Int32.Parse(reader["ID"].ToString()); _c_ArticleInfo.PostDate = reader["PostDate"]==System.DBNull.Value?_c_ArticleInfo.PostDate:System.DateTime.Parse(reader["PostDate"].ToString()); _c_ArticleInfo.Title = reader["Title"].ToString(); _c_ArticleInfo.Content = reader["Content"].ToString(); _c_ArticleInfo.ArticleType = reader["ArticleType"]==System.DBNull.Value?_c_ArticleInfo.ArticleType:Int32.Parse(reader["ArticleType"].ToString()); _c_ArticleInfo.SortID = reader["SortID"]==System.DBNull.Value?_c_ArticleInfo.SortID:Int32.Parse(reader["SortID"].ToString()); _c_ArticleInfo.RegisterID = reader["RegisterID"]==System.DBNull.Value?_c_ArticleInfo.RegisterID:Int32.Parse(reader["RegisterID"].ToString()); _c_ArticleInfo.Hits = reader["Hits"]==System.DBNull.Value?_c_ArticleInfo.Hits:Int32.Parse(reader["Hits"].ToString()); _c_ArticleInfo.CommentCount = reader["CommentCount"]==System.DBNull.Value?_c_ArticleInfo.CommentCount:Int32.Parse(reader["CommentCount"].ToString()); return _c_ArticleInfo; } #endregion
#region c_PhotoInfo public static c_PhotoInfo Init_c_PhotoInfo(IDataReader reader) { c_PhotoInfo _c_PhotoInfo = new c_PhotoInfo(); _c_PhotoInfo.ID = Int32.Parse(reader["ID"].ToString()); _c_PhotoInfo.PhotoName = reader["PhotoName"].ToString(); _c_PhotoInfo.PhotoExplian = reader["PhotoExplian"].ToString(); _c_PhotoInfo.PostDate = reader["PostDate"]==System.DBNull.Value?_c_PhotoInfo.PostDate:System.DateTime.Parse(reader["PostDate"].ToString()); _c_PhotoInfo.SortID = reader["SortID"]==System.DBNull.Value?_c_PhotoInfo.SortID:Int32.Parse(reader["SortID"].ToString()); _c_PhotoInfo.RegisterID = reader["RegisterID"]==System.DBNull.Value?_c_PhotoInfo.RegisterID:Int32.Parse(reader["RegisterID"].ToString()); _c_PhotoInfo.IsUpLoad = reader["IsUpLoad"]==System.DBNull.Value?_c_PhotoInfo.IsUpLoad:Boolean.Parse(reader["IsUpLoad"].ToString()); _c_PhotoInfo.PhotoType = reader["PhotoType"]==System.DBNull.Value?_c_PhotoInfo.PhotoType:Int32.Parse(reader["PhotoType"].ToString()); _c_PhotoInfo.CircleID = reader["CircleID"]==System.DBNull.Value?_c_PhotoInfo.CircleID:Int32.Parse(reader["CircleID"].ToString()); _c_PhotoInfo.ImageName = reader["ImageName"].ToString(); _c_PhotoInfo.PhotoSize = reader["PhotoSize"]==System.DBNull.Value?_c_PhotoInfo.PhotoSize:Int32.Parse(reader["PhotoSize"].ToString()); _c_PhotoInfo.OrderID = Int32.Parse(reader["OrderID"].ToString()); _c_PhotoInfo.Hits = reader["Hits"]==System.DBNull.Value?_c_PhotoInfo.Hits:Int32.Parse(reader["Hits"].ToString()); _c_PhotoInfo.CommentCount = reader["CommentCount"]==System.DBNull.Value?_c_PhotoInfo.CommentCount:Int32.Parse(reader["CommentCount"].ToString()); return _c_PhotoInfo; } #endregion
#region c_MusicInfo public static c_MusicInfo Init_c_MusicInfo(IDataReader reader) { c_MusicInfo _c_MusicInfo = new c_MusicInfo(); _c_MusicInfo.ID = Int32.Parse(reader["ID"].ToString()); _c_MusicInfo.PostDate = reader["PostDate"]==System.DBNull.Value?_c_MusicInfo.PostDate:System.DateTime.Parse(reader["PostDate"].ToString()); _c_MusicInfo.MusicName = reader["MusicName"].ToString(); _c_MusicInfo.MusicSize = reader["MusicSize"]==System.DBNull.Value?_c_MusicInfo.MusicSize:Int32.Parse(reader["MusicSize"].ToString()); _c_MusicInfo.Singer = reader["Singer"].ToString(); _c_MusicInfo.MusicUrl = reader["MusicUrl"].ToString(); _c_MusicInfo.IsUpLoad = reader["IsUpLoad"]==System.DBNull.Value?_c_MusicInfo.IsUpLoad:Boolean.Parse(reader["IsUpLoad"].ToString()); _c_MusicInfo.Format = reader["Format"].ToString(); _c_MusicInfo.Explain = reader["Explain"].ToString(); _c_MusicInfo.RegisterID = reader["RegisterID"]==System.DBNull.Value?_c_MusicInfo.RegisterID:Int32.Parse(reader["RegisterID"].ToString()); _c_MusicInfo.SortID = reader["SortID"]==System.DBNull.Value?_c_MusicInfo.SortID:Int32.Parse(reader["SortID"].ToString()); return _c_MusicInfo; } #endregion
#region c_UserDataCountInfo public static c_UserDataCountInfo Init_c_UserDataCountInfo(IDataReader reader) { c_UserDataCountInfo _c_UserDataCountInfo = new c_UserDataCountInfo(); _c_UserDataCountInfo.ID = Int32.Parse(reader["ID"].ToString()); _c_UserDataCountInfo.RegisterID = reader["RegisterID"]==System.DBNull.Value?_c_UserDataCountInfo.RegisterID:Int32.Parse(reader["RegisterID"].ToString()); _c_UserDataCountInfo.ArticleCount = reader["ArticleCount"]==System.DBNull.Value?_c_UserDataCountInfo.ArticleCount:Int32.Parse(reader["ArticleCount"].ToString()); _c_UserDataCountInfo.DiaryCount = reader["DiaryCount"]==System.DBNull.Value?_c_UserDataCountInfo.DiaryCount:Int32.Parse(reader["DiaryCount"].ToString()); _c_UserDataCountInfo.AddressCount = reader["AddressCount"]==System.DBNull.Value?_c_UserDataCountInfo.AddressCount:Int32.Parse(reader["AddressCount"].ToString()); _c_UserDataCountInfo.PhotoCount = reader["PhotoCount"]==System.DBNull.Value?_c_UserDataCountInfo.PhotoCount:Int32.Parse(reader["PhotoCount"].ToString()); _c_UserDataCountInfo.PicCount = reader["PicCount"]==System.DBNull.Value?_c_UserDataCountInfo.PicCount:Int32.Parse(reader["PicCount"].ToString()); _c_UserDataCountInfo.FavoriteCount = reader["FavoriteCount"]==System.DBNull.Value?_c_UserDataCountInfo.FavoriteCount:Int32.Parse(reader["FavoriteCount"].ToString()); _c_UserDataCountInfo.FriendCount = reader["FriendCount"]==System.DBNull.Value?_c_UserDataCountInfo.FriendCount:Int32.Parse(reader["FriendCount"].ToString()); _c_UserDataCountInfo.MemoCount = reader["MemoCount"]==System.DBNull.Value?_c_UserDataCountInfo.MemoCount:Int32.Parse(reader["MemoCount"].ToString()); _c_UserDataCountInfo.MessageCount = reader["MessageCount"]==System.DBNull.Value?_c_UserDataCountInfo.MessageCount:Int32.Parse(reader["MessageCount"].ToString()); _c_UserDataCountInfo.MusicCount = reader["MusicCount"]==System.DBNull.Value?_c_UserDataCountInfo.MusicCount:Int32.Parse(reader["MusicCount"].ToString()); _c_UserDataCountInfo.CommentCount = reader["CommentCount"]==System.DBNull.Value?_c_UserDataCountInfo.CommentCount:Int32.Parse(reader["CommentCount"].ToString()); _c_UserDataCountInfo.UseCapabilitySize = reader["UseCapabilitySize"]==System.DBNull.Value?_c_UserDataCountInfo.UseCapabilitySize:Int32.Parse(reader["UseCapabilitySize"].ToString()); _c_UserDataCountInfo.PhotoCapabilitySize = reader["PhotoCapabilitySize"]==System.DBNull.Value?_c_UserDataCountInfo.PhotoCapabilitySize:Int32.Parse(reader["PhotoCapabilitySize"].ToString()); _c_UserDataCountInfo.MusicCapabilitySize = reader["MusicCapabilitySize"]==System.DBNull.Value?_c_UserDataCountInfo.MusicCapabilitySize:Int32.Parse(reader["MusicCapabilitySize"].ToString()); _c_UserDataCountInfo.UpdateDate = reader["UpdateDate"]==System.DBNull.Value?_c_UserDataCountInfo.UpdateDate:System.DateTime.Parse(reader["UpdateDate"].ToString()); return _c_UserDataCountInfo; } #endregion
#region c_GuestBookInfo public static c_GuestBookInfo Init_c_GuestBookInfo(IDataReader reader) { c_GuestBookInfo _c_GuestBookInfo = new c_GuestBookInfo(); _c_GuestBookInfo.ID = Int32.Parse(reader["ID"].ToString()); _c_GuestBookInfo.NiceName = reader["NiceName"].ToString(); _c_GuestBookInfo.Content = reader["Content"].ToString(); _c_GuestBookInfo.RePost = reader["RePost"].ToString(); _c_GuestBookInfo.RegisterID = reader["RegisterID"]==System.DBNull.Value?_c_GuestBookInfo.RegisterID:Int32.Parse(reader["RegisterID"].ToString()); _c_GuestBookInfo.PostDate = reader["PostDate"]==System.DBNull.Value?_c_GuestBookInfo.PostDate:System.DateTime.Parse(reader["PostDate"].ToString()); return _c_GuestBookInfo; } #endregion
#region Helpers
public static string CheckNullString(object obj)
{
if(obj is DBNull)
{
return null;
}
return (string)obj;
}
public static object CheckNull(string text)
{
if(text != null && text.Trim().Length > 0)
{
return text;
}
return DBNull.Value;
}
public static string CheckNull(object obj)
{
return (string) obj;
}
public static string CheckNull(DBNull obj)
{
return null;
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -