public void UpdatePhoto(PhotoDetails photoDetails) { int maxId = GetMaxId("tblPhotos", "Id") + 1; string query = "INSERT INTO [tblPhotos]([Id],[PhotoHeader],[ThumbnailUrl],[PhotoUrl])VALUES(" + maxId + ",'" + photoDetails.PhotoHeader + "','" + photoDetails.ThumbnailUrl + "','" + photoDetails.PhotoUrl + "');"; ExecuteNonQuery(query); }
public List<List<PhotoDetails>> LoadPhotos() { List<List<PhotoDetails>> dictPhotoDetails = new List<List<PhotoDetails>>(); List<PhotoDetails> lstInfo = new List<PhotoDetails>(); using (DataSet ds = dataAccess.LoadPhotos()) { if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { string preEvent = string.Empty; foreach (DataRow dataRow in ds.Tables[0].Rows) { string currEvent = Helper.GetDbValue(dataRow["PhotoHeader"]); if (string.IsNullOrEmpty(preEvent)) { lstInfo = new List<PhotoDetails>(); PhotoDetails companyData = new PhotoDetails() { PhotoHeader = Helper.GetDbValue(dataRow["PhotoHeader"]), PhotoUrl = Helper.GetDbValue(dataRow["PhotoUrl"]), ThumbnailUrl = Helper.GetDbValue(dataRow["ThumbnailUrl"]), }; lstInfo.Add(companyData); preEvent = currEvent; dictPhotoDetails.Add(lstInfo); } else if(preEvent.Equals(currEvent, StringComparison.OrdinalIgnoreCase)) { PhotoDetails companyData = new PhotoDetails() { PhotoHeader = Helper.GetDbValue(dataRow["PhotoHeader"]), PhotoUrl = Helper.GetDbValue(dataRow["PhotoUrl"]), ThumbnailUrl = Helper.GetDbValue(dataRow["ThumbnailUrl"]), }; lstInfo.Add(companyData); preEvent = currEvent; } else { lstInfo = new List<PhotoDetails>(); PhotoDetails companyData = new PhotoDetails() { PhotoHeader = Helper.GetDbValue(dataRow["PhotoHeader"]), PhotoUrl = Helper.GetDbValue(dataRow["PhotoUrl"]), ThumbnailUrl = Helper.GetDbValue(dataRow["ThumbnailUrl"]), }; preEvent = currEvent; lstInfo.Add(companyData); dictPhotoDetails.Add(lstInfo); } } } } return dictPhotoDetails; }
public string UpdatePhoto(PhotoDetails photoDetails) { dataAccess.UpdatePhoto(photoDetails); return "OK"; }
public string UpdatePhoto(PhotoDetails photoDetails) { try { Business business = new Business(); return business.UpdatePhoto(photoDetails); } catch (Exception ex) { return ex.Message; } }