/// <summary> /// 得到一个对象实体 /// </summary> public Gymnasium_APP.Model.MenuModel DataRowToModel(DataRow row) { Gymnasium_APP.Model.MenuModel model=new Gymnasium_APP.Model.MenuModel(); if (row != null) { if(row["RoleMenuId"]!=null && row["RoleMenuId"].ToString()!="") { model.RoleMenuId=int.Parse(row["RoleMenuId"].ToString()); } if(row["RoleId"]!=null && row["RoleId"].ToString()!="") { model.RoleId=int.Parse(row["RoleId"].ToString()); } if(row["RoleMenuBigFunctionId"]!=null && row["RoleMenuBigFunctionId"].ToString()!="") { model.RoleMenuBigFunctionId=int.Parse(row["RoleMenuBigFunctionId"].ToString()); } if(row["RoleMenuFunctionId"]!=null && row["RoleMenuFunctionId"].ToString()!="") { model.RoleMenuFunctionId=int.Parse(row["RoleMenuFunctionId"].ToString()); } if(row["IsAdd"]!=null && row["IsAdd"].ToString()!="") { model.IsAdd=int.Parse(row["IsAdd"].ToString()); } if(row["IsDelete"]!=null && row["IsDelete"].ToString()!="") { model.IsDelete=int.Parse(row["IsDelete"].ToString()); } if(row["IsModify"]!=null && row["IsModify"].ToString()!="") { model.IsModify=int.Parse(row["IsModify"].ToString()); } if(row["IsList"]!=null && row["IsList"].ToString()!="") { model.IsList=int.Parse(row["IsList"].ToString()); } if(row["IsSpecial"]!=null && row["IsSpecial"].ToString()!="") { model.IsSpecial=int.Parse(row["IsSpecial"].ToString()); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public Gymnasium_APP.Model.MenuModel GetModel(int RoleMenuId) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 RoleMenuId,RoleId,RoleMenuBigFunctionId,RoleMenuFunctionId,IsAdd,IsDelete,IsModify,IsList,IsSpecial from Menu "); strSql.Append(" where RoleMenuId=@RoleMenuId "); SqlParameter[] parameters = { new SqlParameter("@RoleMenuId", SqlDbType.Int,4) }; parameters[0].Value = RoleMenuId; Gymnasium_APP.Model.MenuModel model=new Gymnasium_APP.Model.MenuModel(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }