private DataGridViewModel <Dictionary <string, object> > GetListPhoto(string keyWordName, int typeId, int pageIndex, int pageSize, PhotoListOrder enumOrd) { DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >(); DbQueryResult photoList = GalleryHelper.GetPhotoList(keyWordName, typeId, pageIndex, pageSize, enumOrd, 0); List <Dictionary <string, object> > list = DataHelper.DataTableToDictionary(photoList.Data); foreach (Dictionary <string, object> item in list) { PhotoGalleryInfo photoGalleryInfo = item.ToObject <PhotoGalleryInfo>(); item.Add("Globals", Globals.GetImageServerUrl()); item.Add("SubPhotoName", GalleryHelper.TruncStr(photoGalleryInfo.PhotoName, 20)); } dataGridViewModel.rows = list; dataGridViewModel.total = photoList.TotalRecords; return(dataGridViewModel); }
public static bool AddPhote(int categoryId, string photoName, string photoPath, int fileSize, int supplierId) { PhotoGalleryDao photoGalleryDao = new PhotoGalleryDao(); if (categoryId <= 0 && supplierId > 0) { categoryId = photoGalleryDao.GetDefaultPhotoCategoryId(supplierId); } PhotoGalleryInfo model = new PhotoGalleryInfo { CategoryId = categoryId, FileSize = fileSize, LastUpdateTime = DateTime.Now, PhotoName = photoName, PhotoPath = photoPath, UploadTime = DateTime.Now, SupplierId = supplierId }; return(photoGalleryDao.Add(model, null) > 0); }