/// <summary> /// 得到一个对象实体 /// </summary> public XCLShouCang.Model.v_WebType GetModel(long WebTypeID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 WebTypeID,ParentID,WebTypeGid,ParentGid,TypeName,TypeURL,TypeDescription,IcoURL,FK_UserID,Sort,IsShare,IsFolder,IsReadOnly,CreatorName,CreateTime,UpdateName,UpdateTime,IsDel,IsHasChildWebType,FK_UserName from v_WebType "); strSql.Append(" where WebTypeID=@WebTypeID "); SqlParameter[] parameters = { new SqlParameter("@WebTypeID", SqlDbType.BigInt, 8) }; parameters[0].Value = WebTypeID; XCLShouCang.Model.v_WebType model = new XCLShouCang.Model.v_WebType(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public XCLShouCang.Model.v_WebType DataRowToModel(DataRow row) { XCLShouCang.Model.v_WebType model = new XCLShouCang.Model.v_WebType(); if (row != null) { if (row["WebTypeID"] != null && row["WebTypeID"].ToString() != "") { model.WebTypeID = long.Parse(row["WebTypeID"].ToString()); } if (row["ParentID"] != null && row["ParentID"].ToString() != "") { model.ParentID = long.Parse(row["ParentID"].ToString()); } if (row["WebTypeGid"] != null) { model.WebTypeGid = row["WebTypeGid"].ToString(); } if (row["ParentGid"] != null) { model.ParentGid = row["ParentGid"].ToString(); } if (row["TypeName"] != null) { model.TypeName = row["TypeName"].ToString(); } if (row["TypeURL"] != null) { model.TypeURL = row["TypeURL"].ToString(); } if (row["TypeDescription"] != null) { model.TypeDescription = row["TypeDescription"].ToString(); } if (row["IcoURL"] != null) { model.IcoURL = row["IcoURL"].ToString(); } if (row["FK_UserID"] != null && row["FK_UserID"].ToString() != "") { model.FK_UserID = long.Parse(row["FK_UserID"].ToString()); } if (row["Sort"] != null && row["Sort"].ToString() != "") { model.Sort = long.Parse(row["Sort"].ToString()); } if (row["IsShare"] != null && row["IsShare"].ToString() != "") { model.IsShare = int.Parse(row["IsShare"].ToString()); } if (row["IsFolder"] != null && row["IsFolder"].ToString() != "") { model.IsFolder = int.Parse(row["IsFolder"].ToString()); } if (row["IsReadOnly"] != null && row["IsReadOnly"].ToString() != "") { model.IsReadOnly = int.Parse(row["IsReadOnly"].ToString()); } if (row["CreatorName"] != null) { model.CreatorName = row["CreatorName"].ToString(); } if (row["CreateTime"] != null && row["CreateTime"].ToString() != "") { model.CreateTime = DateTime.Parse(row["CreateTime"].ToString()); } if (row["UpdateName"] != null) { model.UpdateName = row["UpdateName"].ToString(); } if (row["UpdateTime"] != null && row["UpdateTime"].ToString() != "") { model.UpdateTime = DateTime.Parse(row["UpdateTime"].ToString()); } if (row["IsDel"] != null && row["IsDel"].ToString() != "") { model.IsDel = int.Parse(row["IsDel"].ToString()); } if (row["IsHasChildWebType"] != null && row["IsHasChildWebType"].ToString() != "") { model.IsHasChildWebType = int.Parse(row["IsHasChildWebType"].ToString()); } if (row["FK_UserName"] != null) { model.FK_UserName = row["FK_UserName"].ToString(); } } return(model); }