/// <summary> /// 更新一条数据 /// </summary> public bool Update(Model.Sys_RoleMenuMapping model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update Sys_RoleMenuMapping set "); strSql.Append("RoleID=@RoleID,"); strSql.Append("MenuID=@MenuID,"); strSql.Append("MenuCode=@MenuCode"); strSql.Append(" where "); SqlParameter[] parameters = { new SqlParameter("@RoleID", SqlDbType.Int, 4), new SqlParameter("@MenuID", SqlDbType.Int, 4), new SqlParameter("@MenuCode", SqlDbType.Int, 4) }; parameters[0].Value = model.RoleID; parameters[1].Value = model.MenuID; parameters[2].Value = model.MenuCode; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.Sys_RoleMenuMapping model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Sys_RoleMenuMapping("); strSql.Append("RoleID,MenuID,MenuCode)"); strSql.Append(" values ("); strSql.Append("@RoleID,@MenuID,@MenuCode)"); SqlParameter[] parameters = { new SqlParameter("@RoleID", SqlDbType.Int, 4), new SqlParameter("@MenuID", SqlDbType.Int, 4), new SqlParameter("@MenuCode", SqlDbType.Int, 4) }; parameters[0].Value = model.RoleID; parameters[1].Value = model.MenuID; parameters[2].Value = model.MenuCode; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.Sys_RoleMenuMapping DataRowToModel(DataRow row) { Model.Sys_RoleMenuMapping model = new Model.Sys_RoleMenuMapping(); if (row != null) { if (row["RoleID"] != null && row["RoleID"].ToString() != "") { model.RoleID = int.Parse(row["RoleID"].ToString()); } if (row["MenuID"] != null && row["MenuID"].ToString() != "") { model.MenuID = int.Parse(row["MenuID"].ToString()); } if (row["MenuCode"] != null && row["MenuCode"].ToString() != "") { model.MenuCode = int.Parse(row["MenuCode"].ToString()); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.Sys_RoleMenuMapping GetModel() { //该表无主键信息,请自定义主键/条件字段 StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 RoleID,MenuID,MenuCode from Sys_RoleMenuMapping "); strSql.Append(" where "); SqlParameter[] parameters = { }; Model.Sys_RoleMenuMapping model = new Model.Sys_RoleMenuMapping(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }