public Models.ReasonCategoryResultDo GetReasonCategoryList(Models.ReasonCriteriaDo criteria) { Models.ReasonCategoryResultDo result = new Models.ReasonCategoryResultDo(); db.CreateCommand(new Utils.SQL.SQLCommandHandler((Utils.SQL.ASQLDbCommand command) => { command.CommandText = "[dbo].[sp_Get_ReasonCategoryList]"; command.CommandType = System.Data.CommandType.StoredProcedure; command.AddParameter(typeof(int), "ReasonGroupID", criteria.ReasonGroupID); command.AddParameter(typeof(int), "ReasonCategoryID", criteria.ReasonCategoryID); command.AddParameter(typeof(string), "Name", criteria.Name); System.Collections.IList[] dbls = command.ToList(typeof(Models.ReasonCategoryDo), typeof(Models.ReasonBrandDo)); if (dbls != null) { List <Models.ReasonCategoryDo> dbrcs = dbls[0] as List <Models.ReasonCategoryDo>; List <Models.ReasonBrandDo> dbrbs = dbls[1] as List <Models.ReasonBrandDo>; if (dbrcs != null) { result.Rows = dbrcs; result.TotalRecords = result.Rows.Count; if (dbrbs != null) { foreach (Models.ReasonCategoryDo category in result.Rows) { category.Brands = dbrbs.FindAll(x => x.ReasonGroupID == category.ReasonGroupID && x.ReasonCategoryID == category.ReasonCategoryID); } } } } })); return(result); }
public Models.ReasonResultDo GetReasonList(Models.ReasonCriteriaDo criteria) { Models.ReasonResultDo result = new Models.ReasonResultDo(); db.CreateCommand(new Utils.SQL.SQLCommandHandler((Utils.SQL.ASQLDbCommand command) => { command.CommandText = "[dbo].[sp_Get_ReasonList]"; command.CommandType = System.Data.CommandType.StoredProcedure; command.AddParameter(typeof(int), "ReasonGroupID", criteria.ReasonGroupID); command.AddParameter(typeof(int), "ReasonCategoryID", criteria.ReasonCategoryID); command.AddParameter(typeof(int), "ReasonID", criteria.ReasonID); command.AddParameter(typeof(string), "Name", criteria.Name); command.AddParameter(typeof(string), "Brand", criteria.Brand); result.Rows = command.ToList <Models.ReasonDo>(); if (result.Rows != null) { result.TotalRecords = result.Rows.Count; } })); return(result); }