public static IList <FormApproveListEntity> Get(FormType formType) { var sql = string.Format("select {0} from form_approve_list where form_type = @p_form_type order by sequence", COLUMN_SQL); var db = DatabaseFactory.CreateDatabase(); var dc = db.GetSqlStringCommand(sql); db.AddInParameter(dc, "p_form_type", DbType.Int32, (int)formType); var list = new List <FormApproveListEntity>(); using (var reader = db.ExecuteReader(dc)) { while (reader.Read()) { var entity = new FormApproveListEntity(); entity.Init(reader); list.Add(entity); } } return(list); }
public static FormApproveListEntity Get(string id) { var sql = string.Format("select {0} from form_approve_list where id = @p_id", COLUMN_SQL); var db = DatabaseFactory.CreateDatabase(); var dc = db.GetSqlStringCommand(sql); db.AddInParameter(dc, "p_id", DbType.String, id); using (var reader = db.ExecuteReader(dc)) { if (reader.Read()) { var entity = new FormApproveListEntity(); entity.Init(reader); return(entity); } } return(null); }