public int AddPhotos(Photos objPhoto) { //Cannot convert type 'TributesPortal.BusinessEntities.Photos' to 'System.Collections.Generic.List<TributesPortal.BusinessE PhotoResource objPhotoAlbumResource = new PhotoResource(); IList<Photos> objLPhoto = new List<Photos>(); objLPhoto.Add(objPhoto); //IList<Photos> objListPhoto = (IList<Photos>)objLPhoto[0]; object[] param = { objLPhoto }; object objLastPhotoId = new object(); using (TransactionScope trans = new TransactionScope()) { objLastPhotoId = objPhotoAlbumResource.AddPhotoToAlbum(param); //Transaction Commited trans.Complete(); } return int.Parse(objLastPhotoId.ToString()); }
/// <summary> /// Method to get the body part of email on adding photos only. /// </summary> /// <param name="objUserInfo">Filled User Info entity</param> /// <returns>HTML string of body part</returns> private string GetEmailBody(UserInfo objUserInfo, string strAdded, Photos objPhoto) { StringBuilder sbBody = new StringBuilder(); sbBody.Append("<font style='font-size: 12px; font-family:Lucida Sans;'><p>" +objPhoto.UserName); sbBody.Append(" added new photos in the "); sbBody.Append(objPhoto.TributeName + " " + objPhoto.TributeType + " Tribute.</p>"); sbBody.Append("<p>To view the photos, follow the link below:"); sbBody.Append("<br/>"); string strLink = "http://" + objPhoto.TributeType.Replace("New Baby", "newbaby").ToLower() + "." + WebConfig.TopLevelDomain + "/" + objPhoto.TributeUrl + "/Photo.aspx" + "?PhotoId=" + objPhoto.PhotoId; //sbBody.Append("<a href='http://" + objPhoto.PathToVisit + "/Photo/PhotoView.aspx" + "?PhotoId=" + objPhoto.PhotoId + "&TributeId=" + objPhoto.UserTributeId + "&TributeName=" + objPhoto.TributeName + "&TributeType=" + objPhoto.TributeType + "&TributeUrl=" + objPhoto.TributeUrl + "&mode=link'>" + "Click here to visit the link</a>"); //sbBody.Append("<a href='http://" + objPhoto.TributeType + "." + WebConfig.TopLevelDomain + "/" + objPhoto.TributeUrl + "/Photo.aspx" + "?PhotoId=" + objPhoto.PhotoId + "'>" + "Click here to visit the link</a>"); sbBody.Append("<a href='" + strLink + "'>" + strLink + "</a></p>"); sbBody.Append("<p>---<br/>"); sbBody.Append("Your Tribute Team</p></font>"); return sbBody.ToString(); }
/// <summary> /// Method to get subject for email on adding photos only. /// </summary> /// <param name="objComment"></param> /// <returns>Subject of email in string format.</returns> private string GetEmailSubject(Photos objPhoto) { return objPhoto.UserName + " added new photos on Your Tribute..."; }
/// <summary> /// Method to send email to the list of users on adding photos only. /// </summary> /// <param name="objUsers">User Info entity containing User name and email address</param> public void SendEmail(List<UserInfo> objUsers, string strAdded, Photos objPhoto) { EmailMessages objEmail = EmailMessages.Instance; foreach (UserInfo obj in objUsers) { StringBuilder sbToEmail = new StringBuilder(); sbToEmail.Append(obj.UserEmail); sbToEmail.Append(","); objEmail.SendMessages("Your Tribute<" + WebConfig.NoreplyEmail + ">", sbToEmail.ToString(), GetEmailSubject(objPhoto), GetEmailBody(obj, strAdded, objPhoto), EmailMessages.TextFormat.Html.ToString()); } }
/// <summary> /// Method to update photo details /// </summary> /// <param name="objVid">Filled photo entity</param> public void UpdatePhotoDetails(Photos objPhotos) { PhotoResource objPhotoResource = new PhotoResource(); object[] param = { objPhotos }; using (TransactionScope trans = new TransactionScope()) { objPhotoResource.UpdatePhotoDetails(param); //Transation Commited trans.Complete(); } }
/// <summary> /// Method to update photo details. /// </summary> /// <param name="objPhoto">Filled photos entity.</param> public void UpdatePhoto(Photos objPhoto) { FacadeManager.PhotoManager.UpdatePhotoDetails(objPhoto); }
/// <summary> /// Method to get the list of photos date wise /// </summary> /// <param name="objPhotoAlbum">Photo entity containing PhotoAlbumId, pagesize and page number</param> /// <returns>List of filled Photo entity</returns> public List<Photos> GetPhotosDateWise(Photos objPhoto) { PhotoResource objPhotoResource = new PhotoResource(); object[] param = { objPhoto }; return objPhotoResource.GetPhotosDateWise(param); }
public void IsUserOwnerTest() { UserInfoManager target = new UserInfoManager(); // TODO: Initialize to an appropriate value //UserAdminOwnerInfo objUserInfo = null; // TODO: Initialize to an appropriate value bool expected = true; // TODO: Initialize to an appropriate value bool actual; UserAdminOwnerInfo objUserInfo = new UserAdminOwnerInfo(); int UserId = InsertDummyUser("tj_op"); objUserInfo.UserId = UserId; //Find Tributes for User ID int tributeId = 0; GetMyTributes _objtribute = new GetMyTributes(); _objtribute.UserId = UserId; object[] _param = { _objtribute, 0, 1, 1 }; if (_objtribute.CustomError == null) { List<GetMyTributes> Mytributes = new List<GetMyTributes>(); Mytributes = target.GetMyTributes(_param); Assert.AreEqual(true, Mytributes.Count > 0); tributeId = Mytributes[0].TributeId; } objUserInfo.TributeId = tributeId; //FINd Photo Album ID for Tribute id object[] objParam = { tributeId }; DataSet dsPhotoAlbumList = GetDataSet("usp_GetPhotoAlbumListInTribute", objParam); List<PhotoAlbum> objListOfPhotoAlbum = new List<PhotoAlbum>(); //to fill records in the Photo Gallery list if (dsPhotoAlbumList.Tables[0].Rows.Count > 0) { foreach (DataRow dr in dsPhotoAlbumList.Tables[0].Rows) { PhotoAlbum objAlbum = new PhotoAlbum(); objAlbum.PhotoAlbumId = int.Parse(dr["PhotoAlbumId"].ToString()); objListOfPhotoAlbum.Add(objAlbum); objAlbum = null; } } int PhotoAlbumId = 0; if (objListOfPhotoAlbum.Count > 0) { PhotoAlbumId = objListOfPhotoAlbum[0].PhotoAlbumId; } //Get Photo id in PhotoAlbumId///////////// List<Photos> objListPhotos = new List<Photos>(); try { object[] objParam1 = {PhotoAlbumId, 1, 1, "ASC" }; DataSet dsPhotos = GetDataSet("usp_GetPhotos", objParam1); int totalRecords = 0; //objGetPhotos.SortOrder if (dsPhotos.Tables[0].Rows.Count > 0) { DataRow dr = dsPhotos.Tables[0].Rows[0]; totalRecords = int.Parse(dr["TotalRecords"].ToString()); } //to fill records in the Photo list if (dsPhotos.Tables[1].Rows.Count > 0) { foreach (DataRow dr in dsPhotos.Tables[1].Rows) { Photos objPhoto = new Photos(); objPhoto.PhotoId = int.Parse(dr["UserPhotoId"].ToString()); objPhoto.PhotoAlbumId = int.Parse(dr["PhotoAlbumId"].ToString()); objPhoto.PhotoImage = dr["PhotoImage"].ToString(); objPhoto.CommentCount = int.Parse(dr["CommentCount"].ToString()); objPhoto.CreatedDate = DateTime.Parse(dr["CreatedDate"].ToString()); objPhoto.TotalRecords = totalRecords; objListPhotos.Add(objPhoto); objPhoto = null; } } } catch (Exception ex) { throw ex; } ////////////////////////////////////////// objUserInfo.TypeId = objListPhotos[0].PhotoId; objUserInfo.TypeName = "ManagePhoto"; actual = target.IsUserOwner(objUserInfo); Assert.AreEqual(expected, actual); //Assert.Inconclusive("Verify the correctness of this test method."); }
/// <summary> /// Method to get photo details. /// </summary> /// <param name="objPhotoAlbum">Photo entity containing PhotoId</param> /// <returns>Filled Photo entity</returns> public Photos GetPhotoDetail(Photos objPhoto) { PhotoResource objPhotoResource = new PhotoResource(); object[] param = { objPhoto }; return objPhotoResource.GetPhotoDetail(param); }
/// <summary> /// Method to get the list of photo images to display. /// </summary> /// <param name="objPhotoGallery">Object containing PhotoAlbum entity for PhotoAlbumId</param> /// <returns>List of photos.</returns> public List<Photos> GetPhotoImagesList(object[] objPhotos) { try { Photos objGetPhotos = (Photos)objPhotos[0]; List<Photos> objListPhotoImagess = new List<Photos>(); if (!Equals(objGetPhotos, null)) { object[] objParam = { objGetPhotos.PhotoAlbumId }; DataSet dsPhotoImages = GetDataSet("usp_GetPhotoImagesList", objParam); //to fill records in the Photo list if (dsPhotoImages.Tables[0].Rows.Count > 0) { foreach (DataRow dr in dsPhotoImages.Tables[0].Rows) { Photos objPhoto = new Photos(); objPhoto.PhotoImage = dr["PhotoImage"].ToString(); objListPhotoImagess.Add(objPhoto); objPhoto = null; } } } return objListPhotoImagess; } catch (Exception ex) { throw ex; } }
/// <summary> /// Method to get the list of photos for the selected album. /// </summary> /// <param name="objPhotoGallery">Object containing PhotoAlbum entity for PhotoAlbumId</param> /// <returns>List of photos.</returns> public List<Photos> GetPhotosDateWise(object[] objPhotos) { try { Photos objGetPhotos = (Photos)objPhotos[0]; List<Photos> objListPhotos = new List<Photos>(); if (!Equals(objGetPhotos, null)) { object[] objParam = {objGetPhotos.ToDate,objGetPhotos.FromDate, objGetPhotos.PageSize, objGetPhotos.PageNumber }; DataSet dsPhotos = GetDataSet("usp_GetPhotosDatewise", objParam); //to fill records in the Photo list if (dsPhotos.Tables[0].Rows.Count > 0) { foreach (DataRow dr in dsPhotos.Tables[0].Rows) { Photos objPhoto = new Photos(); objPhoto.PhotoId = int.Parse(dr["UserPhotoId"].ToString()); objPhoto.PhotoAlbumId = int.Parse(dr["PhotoAlbumId"].ToString()); objPhoto.PhotoImage = dr["PhotoImage"].ToString(); objPhoto.CommentCount = int.Parse(dr["CommentCount"].ToString()); objPhoto.TotalRecords = int.Parse(dr["TotalRecords"].ToString()); objListPhotos.Add(objPhoto); objPhoto = null; } } } return objListPhotos; } catch (Exception ex) { throw ex; } }
/// <summary> /// Method to get the list of photos. /// </summary> /// <param name="objPhotoAlbum">Photo entity containing PhotoAlbumId, page number and page size.</param> /// <returns>List of photos.</returns> public List<Photos> GetPhotosDateWise(Photos objPhoto) { return FacadeManager.PhotoManager.GetPhotos(objPhoto); }
public bool IsAllowedPhotoCheckonPhotoId(int PhotoId) { bool isAllowedPhotoCheck = false; Photos objP = new Photos(); if (PhotoId > 0) { objP.PhotoId = PhotoId; try { object[] objparam = { objP.PhotoId }; DataSet dsIsAllowed = GetDataSet("usp_IsAllowedPhotoCheckonPhotoId", objparam); if (dsIsAllowed.Tables[0].Rows.Count > 0) { foreach (DataRow dr in dsIsAllowed.Tables[0].Rows) { bool.TryParse(dr["IsAllowed"].ToString(), out isAllowedPhotoCheck); } } } catch (System.Data.SqlClient.SqlException sqlEx) { if (sqlEx.Number >= 50000) { Errors objError = new Errors(); objError.ErrorMessage = sqlEx.Message; return isAllowedPhotoCheck; } } } return isAllowedPhotoCheck; }
/// <summary> /// Method to delete photo. /// </summary> /// <param name="objPhoto">Filled photos entity.</param> public void DeletePhoto(Photos objPhoto) { FacadeManager.PhotoManager.DeletePhoto(objPhoto); }
/// <summary> /// Method to get photo detail. /// </summary> /// <param name="objPhotoAlbum">Photo entity containing PhotoId.</param> /// <returns>Photo detail.</returns> public Photos GetPhotoDetail(Photos objPhoto) { return FacadeManager.PhotoManager.GetPhotoDetail(objPhoto); }
/// <summary> /// Method to get the list of photoImagess /// </summary> /// <param name="objPhotoAlbum">Photo entity containing PhotoAlbumId</param> /// <returns>List of filled Photo entity</returns> public List<Photos> GetPhotoImagesList(Photos objPhoto) { PhotoResource objPhotoResource = new PhotoResource(); object[] param = { objPhoto }; return objPhotoResource.GetPhotoImagesList(param); }
public List<Photos> GetPhotoImagesList(Photos objPhoto) { return FacadeManager.PhotoManager.GetPhotoImagesList(objPhoto); }
public int SavePhotos(Photos objPhoto) { return FacadeManager.PhotoManager.AddPhotos(objPhoto); }