//AdminUser pagination list public List <Domain.UserDetails> GetPaginationList(PaginateListRequestModel model) { List <Domain.UserDetails> list = null; DataProvider.ExecuteCmd(GetConnection, "dbo.Users_Admin_Select" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@CurrentPage", model.CurrentPage); paramCollection.AddWithValue("@ItemsPerPage", model.ItemsPerPage); }, map : delegate(IDataReader reader, short set) { UserDetails p = new UserDetails(); int startingIndex = 0; p.Id = reader.GetSafeString(startingIndex++); p.UserName = reader.GetSafeString(startingIndex++); p.FirstName = reader.GetSafeString(startingIndex++); p.LastName = reader.GetSafeString(startingIndex++); p.PhoneNumber = reader.GetSafeString(startingIndex++); p.Email = reader.GetSafeString(startingIndex++); p.DateAdded = reader.GetSafeDateTime(startingIndex++); p.DateModified = reader.GetSafeDateTime(startingIndex++); p.UserType = reader.GetSafeInt32(startingIndex++); if (list == null) { list = new List <UserDetails>(); } list.Add(p); } ); return(list); }
public List <Domain.Blog> ListBlogsByWebsiteId(PaginateListRequestModel model, int websiteId) { List <Domain.Blog> list = null; DataProvider.ExecuteCmd(GetConnection, "dbo.WebsiteBlogs_ListBlogsByWebsiteId" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@CurrentPage", model.CurrentPage); paramCollection.AddWithValue("@ItemsPerPage", model.ItemsPerPage); paramCollection.AddWithValue("@websiteId", websiteId); } , map : delegate(IDataReader reader, short set) { Domain.Website w = new Domain.Website(); Domain.Blog p = new Domain.Blog(); Domain.BlogMedia bm = new Domain.BlogMedia(); int startingIndex = 0; w.ID = reader.GetSafeInt32(startingIndex++); p.Id = reader.GetSafeInt32(startingIndex++); p.Title = reader.GetSafeString(startingIndex++); p.PublishDate = reader.GetSafeDateTime(startingIndex++); p.Slug = reader.GetSafeString(startingIndex++); p.UserId = reader.GetSafeString(startingIndex++); p.PageContent = reader.GetSafeString(startingIndex++); p.IsFeatured = reader.GetSafeBool(startingIndex++); bm.BlogId = reader.GetSafeInt32(startingIndex++); bm.IsCoverPhoto = reader.GetSafeBool(startingIndex++); bm.ID = reader.GetSafeInt32(startingIndex++); bm.MediaType = reader.GetSafeString(startingIndex++); bm.Path = reader.GetSafeString(startingIndex++); bm.FileName = reader.GetSafeString(startingIndex++); bm.FileType = reader.GetSafeString(startingIndex++); bm.Title = reader.GetSafeString(startingIndex++); bm.Description = reader.GetSafeString(startingIndex++); bm.CreatedDate = reader.GetSafeDateTime(startingIndex++); bm.ModifiedDate = reader.GetSafeDateTime(startingIndex++); bm.ThumbnailPath = reader.GetSafeString(startingIndex++); p.Media = bm; if (list == null) { list = new List <Domain.Blog>(); } list.Add(p); }); return(list); }
public List <Domain.Blog> GetBlogsLatestToOldest(PaginateListRequestModel model) { List <Domain.Blog> list = null; DataProvider.ExecuteCmd(GetConnection, "dbo.Blog_Listingstwo" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@CurrentPage", model.CurrentPage); paramCollection.AddWithValue("@ItemsPerPage", model.ItemsPerPage); } , map : delegate(IDataReader reader, short set) { Domain.Blog p = new Domain.Blog(); Domain.BlogMedia bm = new Domain.BlogMedia(); int startingIndex = 0; p.Id = reader.GetSafeInt32(startingIndex++); p.Title = reader.GetSafeString(startingIndex++); p.PublishDate = reader.GetSafeDateTime(startingIndex++); p.UserId = reader.GetSafeString(startingIndex++); p.PageContent = reader.GetSafeString(startingIndex++); p.Slug = reader.GetSafeString(startingIndex++); bm.BlogId = reader.GetSafeInt32(startingIndex++); bm.IsCoverPhoto = reader.GetSafeBool(startingIndex++); bm.ID = reader.GetSafeInt32(startingIndex++); bm.MediaType = reader.GetSafeString(startingIndex++); bm.Path = reader.GetSafeString(startingIndex++); bm.FileName = reader.GetSafeString(startingIndex++); bm.FileType = reader.GetSafeString(startingIndex++); bm.Title = reader.GetSafeString(startingIndex++); bm.Description = reader.GetSafeString(startingIndex++); if (list == null) { list = new List <Domain.Blog>(); } if (bm.ID == 0) { p.Media = null; } else { p.Media = bm; } list.Add(p); }); return(list); }
// Pagiantion list public List <Domain.EVA_Attribute> GetPaginationList(PaginateListRequestModel model) { List <Domain.EVA_Attribute> list = null; DataProvider.ExecuteCmd(GetConnection, "dbo.EVA_Attribute_Select" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@CurrentPage", model.CurrentPage); paramCollection.AddWithValue("@ItemsPerPage", model.ItemsPerPage); paramCollection.AddWithValue("@Query", model.Query); }, map : delegate(IDataReader reader, short set) { Domain.EVA_Attribute p = new Domain.EVA_Attribute(); int startingIndex = 0; //startingOrdinal p.ID = reader.GetSafeInt32(startingIndex++); p.Name = reader.GetSafeString(startingIndex++); p.Slug = reader.GetSafeString(startingIndex++); p.Description = reader.GetSafeString(startingIndex++); int TypeID = reader.GetSafeInt32(startingIndex++); p.DataType = (AttributesDataType)TypeID; if (list == null) { list = new List <Domain.EVA_Attribute>(); } list.Add(p); } ); return(list); }
// list dealer records public List <EVA_Record> ListVehicleRecordByDealerID(int DealerID, PaginateListRequestModel model)//for other one only id as param { List <EVA_Record> myList = null; DataProvider.ExecuteCmd(GetConnection, "dbo.EVA_Records_Select_By_DealerID" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@DealerID", DealerID); paramCollection.AddWithValue("@CurrentPage", model.CurrentPage); paramCollection.AddWithValue("@ItemsPerPage", model.ItemsPerPage); }, map : delegate(IDataReader reader, short set) { if (set == 0) { EVA_Record p = new EVA_Record(); int startingIndex = 0; //startingOrdinal p.ID = reader.GetSafeInt32(startingIndex++); p.EntityID = reader.GetSafeInt32(startingIndex++); p.WebsiteId = reader.GetSafeInt32(startingIndex++); p.Value = new List <Value>(); p.Pictures = new List <Domain.Media>(); //this line only give a empty []; if (myList == null) { myList = new List <EVA_Record>(); } myList.Add(p); } else if (set == 1) { Value x = new Value(); int startingIndex = 0; //startingOrdinal x.RecordID = reader.GetSafeInt32(startingIndex++); x.AttributeID = reader.GetSafeInt32(startingIndex++); x.ValueString = reader.GetSafeString(startingIndex++); x.ValueInt = reader.GetSafeInt32(startingIndex++); x.ValueDecimal = reader.GetSafeDecimal(startingIndex++); x.ValueText = reader.GetSafeString(startingIndex++); x.ValueGeo = reader.GetSafeDecimal(startingIndex++); x.AttributeSlug = reader.GetSafeString(startingIndex++); x.AttributeName = reader.GetSafeString(startingIndex++); //insert loop here for (int i = 0; i < myList.Count; i++) { if (myList[i].ID == x.RecordID) { myList[i].Value.Add(x); break; } } // within the loop p.Value.Add(x); } else if (set == 2) { Domain.Media w = new Domain.Media(); int startingIndex = 0; //startingOrdinal w.ID = reader.GetSafeInt32(startingIndex++); w.MediaType = reader.GetSafeString(startingIndex++); w.Path = reader.GetSafeString(startingIndex++); w.FileName = reader.GetSafeString(startingIndex++); w.FileType = reader.GetSafeString(startingIndex++); w.Title = reader.GetSafeString(startingIndex++); w.Description = reader.GetSafeString(startingIndex++); w.UserID = reader.GetSafeString(startingIndex++); w.ThumbnailPath = reader.GetSafeString(startingIndex++); w.CreatedDate = reader.GetSafeDateTime(startingIndex++); w.ModifiedDate = reader.GetSafeDateTime(startingIndex++); w.MediaId = reader.GetSafeInt32(startingIndex++); w.RecordId = reader.GetSafeInt32(startingIndex++); w.DealerId = reader.GetSafeInt32(startingIndex++); w.IsCoverPhoto = reader.GetSafeBool(startingIndex++); //insert loop here for (int y = 0; y < myList.Count; y++) { if (myList[y].ID == w.RecordId) { myList[y].Pictures.Add(w); break; } } } } ); return(myList); }
// new function that calls two services public List <EVA_Record> ListRecordByEntity(int id, PaginateListRequestModel model)//for other one only id as param { List <EVA_Record> myList = null; DataProvider.ExecuteCmd(GetConnection, "dbo.EVA_List_Records_By_Entity" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@EntityID", id); paramCollection.AddWithValue("@CurrentPage", model.CurrentPage); paramCollection.AddWithValue("@ItemsPerPage", model.ItemsPerPage); }, map : delegate(IDataReader reader, short set) { if (set == 0) { EVA_Record p = new EVA_Record(); int startingIndex = 0; //startingOrdinal p.ID = reader.GetSafeInt32(startingIndex++); p.EntityID = reader.GetSafeInt32(startingIndex++); p.WebsiteId = reader.GetSafeInt32(startingIndex++); p.Value = new List <Value>(); if (myList == null) { myList = new List <EVA_Record>(); } myList.Add(p); } else if (set == 1) { Value x = new Value(); int startingIndex = 0; //startingOrdinal x.RecordID = reader.GetSafeInt32(startingIndex++); x.AttributeID = reader.GetSafeInt32(startingIndex++); x.ValueString = reader.GetSafeString(startingIndex++); x.ValueInt = reader.GetSafeInt32(startingIndex++); x.ValueDecimal = reader.GetSafeDecimal(startingIndex++); x.ValueText = reader.GetSafeString(startingIndex++); x.ValueGeo = reader.GetSafeDecimal(startingIndex++); x.AttributeSlug = reader.GetSafeString(startingIndex++); x.AttributeName = reader.GetSafeString(startingIndex++); //insert loop here for (int i = 0; i < myList.Count; i++) { if (myList[i].ID == x.RecordID) { myList[i].Value.Add(x); break; } } // within the loop p.Value.Add(x); } } ); return(myList); }