public int Delete(Role Role_Code) { DBHelper db = new DBHelper(); DbCommand cmd = db.GetSqlStringCommand("DELETE FROM Role WHERE Role_Code = '" + Role_Code.Role_Code+"'"); return db.ExecuteNonQuery(cmd); }
private Role DataRowToBean(DataRow row) { Role Role = new Role(); Role.Role_Code = Guid.Parse(UtilData.DBObjectToString(row["Role_Code"])); Role.Role_Name = UtilData.DBObjectToString(row["Role_Name"]); Role.DES = UtilData.DBObjectToString(row["DES"]); return Role; }
public int Update(Role Role) { DBHelper db = new DBHelper(); DbCommand cmd = db.GetStoredProcCommand("p_Role_update"); db.AddInParameter(cmd, "@Role_Code", DbType.Guid, Role.Role_Code); db.AddInParameter(cmd, "@Role_Name", DbType.String, Role.Role_Name); db.AddInParameter(cmd, "@DES", DbType.String, Role.DES); return db.ExecuteNonQuery(cmd); }
public int Save(Role Role) { DBHelper db = new DBHelper(); DbCommand cmd = db.GetStoredProcCommand("p_Role_insert");//返回主键 db.AddInParameter(cmd, "@Role_Name", DbType.String, Role.Role_Name); db.AddInParameter(cmd, "@DES", DbType.String, Role.DES); object res = db.ExecuteScalar(cmd); return res == null ? -1 :1; }