public static Post GetPost(int postId, int loadType) { DataLayer dataLayer = new DataLayer(); List<Post> result = dataLayer.GetPost(postId); if (result != null && result.Count > 0) { result[0].ImageList = dataLayer.ListImage(null, result[0].PostId, (int)ImageType.Room, loadType); return result[0]; } return null; }
public static List<District> ListDistrict(int? cityId, int? districtId, bool insertAllItem) { List<District> result = new DataLayer().ListDistrict(cityId, districtId); if (insertAllItem) { District rt = new District(); rt.Name = "Tất cả"; result.Insert(0, rt); } return result; //return new DataLayer().ListDistrict(cityId, districtId); }
public static void DeleteRecord(long id, Type recordType) { DataLayer temp = new DataLayer(); String type = recordType.ToString(); temp.DeleteRecord(id, type.Substring(type.LastIndexOf(".") + 1, (type.Length - (type.LastIndexOf(".") + 1)))); }
public static void DeleteRecord(Record record) { DataLayer dl = new DataLayer(); String type = record.GetType().ToString(); dl.DeleteRecord(Utilities.ToLong(record.RecordId), type.Substring(type.LastIndexOf(".") + 1, (type.Length - (type.LastIndexOf(".") + 1)))); }
public static void SavePostList(List<Post> postList) { if (postList != null && postList.Count > 0) { DataLayer dataLayer = new DataLayer(); List<Post> oldPosts = dataLayer.SearchPost(postList[0].PostTypeId, null, null, null, null, null, null, null, null, null, null, null, DateTime.Today, DateTime.Now, null, null, false); foreach (Post saveItem in postList) { if (oldPosts.Count(i => i.PersonName == saveItem.PersonName && i.PhoneNumber == saveItem.PhoneNumber && i.Address == saveItem.Address && i.Price == saveItem.Price && i.PostTypeId == saveItem.PostTypeId) == 0) { SavePost(saveItem); } } } }
public static List<RealestateType> ListRealestateType(bool insertAllItem) { List<RealestateType> result = new DataLayer().ListRealestateType(); if (insertAllItem) { RealestateType rt = new RealestateType(); rt.Name = "Tất cả"; result.Insert(0, rt); } return result; }