Esempio n. 1
0
File: Photo.cs Progetto: tjsas1/RHP
        public List <String> LoadImageList(Guid contextId, Enums.PhotoCategory PhotoCategoryId)
        {
            List <String> images = null;

            try
            {
                List <Photo> PhotoList = SelectAllByPhotoCategoryId(contextId, PhotoCategoryId);

                if (PhotoList.Count > 0)
                {
                    images = new List <string>(PhotoList.Count);

                    foreach (Photo _List in PhotoList)
                    {
                        if (File.Exists(System.Web.HttpContext.Current.Server.MapPath(_List.FilePath)))
                        {
                            images.Add(_List.FilePath);
                        }
                    }
                }
            }
            catch (Exception ec)
            { }

            return(images);
        }
Esempio n. 2
0
File: Photo.cs Progetto: tjsas1/RHP
        public string LoadImage(Guid contextId, Enums.PhotoCategory PhotoCategoryId)
        {
            List <String> images = null;

            string imagePath = "~/Images/Sample/Noimage.jpg";

            if (PhotoCategoryId == Enums.PhotoCategory.Cover_Picture)
            {
                imagePath = "~/Images/Sample/Bannerimage.jpg";
            }

            if (PhotoCategoryId == Enums.PhotoCategory.Profile_Picture)
            {
                imagePath = "~/Images/Sample/Noimage.jpg";
            }

            if (PhotoCategoryId == Enums.PhotoCategory.House_Picture)
            {
                imagePath = "~/Images/Sample/House.jpg";
            }

            try
            {
                List <Photo> PhotoList = SelectAllByPhotoCategoryId(contextId, PhotoCategoryId);

                if (PhotoList.Count > 0)
                {
                    images = new List <string>(PhotoList.Count);

                    foreach (Photo _List in PhotoList)
                    {
                        if (File.Exists(System.Web.HttpContext.Current.Server.MapPath(_List.FilePath)))
                        {
                            imagePath = _List.FilePath;
                        }
                    }
                }
            }
            catch (Exception ec)
            { }

            return(imagePath);
        }
Esempio n. 3
0
File: Photo.cs Progetto: tjsas1/RHP
        public string LoadHouseImage(Guid contextId, Guid ContextSubId, Enums.ContextSubType ContextSubTypeId, Enums.PhotoCategory PhotoCategoryId)
        {
            List <String> images = null;

            string imagePath = "~/Images/Sample/House.jpg";

            try
            {
                List <Photo> PhotoList = SelectAllByContextSubTypeId(contextId, ContextSubId, ContextSubTypeId, PhotoCategoryId);

                if (PhotoList.Count > 0)
                {
                    images = new List <string>(PhotoList.Count);

                    foreach (Photo _List in PhotoList)
                    {
                        if (File.Exists(System.Web.HttpContext.Current.Server.MapPath(_List.FilePath)))
                        {
                            imagePath = _List.FilePath;
                        }
                    }
                }
            }
            catch (Exception ec)
            { }

            return(imagePath);
        }
Esempio n. 4
0
File: Photo.cs Progetto: tjsas1/RHP
 public List <Photo> SelectAllByContextSubTypeId(Guid contextId, Guid ContextSubId, Enums.ContextSubType ContextSubTypeId, Enums.PhotoCategory PhotoCategoryId)
 {
     return(PhotoDAO.GetAllByFieldValue("ContextId", contextId, "ContextSubId", ContextSubId, ContextSubTypeId, PhotoCategoryId));
 }
Esempio n. 5
0
File: Photo.cs Progetto: tjsas1/RHP
 public List <Photo> SelectAllByPhotoCategoryId(Guid contextId, Enums.PhotoCategory PhotoCategoryId)
 {
     return(PhotoDAO.GetAllByFieldValue("ContextId", contextId, PhotoCategoryId));
 }
Esempio n. 6
0
File: Photo.cs Progetto: tjsas1/RHP
 public Photo(Enums.PhotoCategory photoCategory)
 {
     PhotoCategoryId = (int)photoCategory;
 }
Esempio n. 7
0
        public static List <Photo> GetAllByFieldValue(string fieldName, Guid fieldValue, string fieldName2, Guid fieldValue2, Enums.ContextSubType ContextSubTypeId, Enums.PhotoCategory PhotoCategoryId)
        {
            List <Photo> returnEntityCollection = new List <Photo>();

            Database  db        = DatabaseFactory.CreateDatabase(Constants.CONNECTIONSTRING);
            DbCommand dbCommand = db.GetStoredProcCommand("usp_PhotoSelectAllBy" + fieldName2);

            db.AddInParameter(dbCommand, fieldName, DbType.Guid, fieldValue);
            db.AddInParameter(dbCommand, fieldName2, DbType.Guid, fieldValue2);
            db.AddInParameter(dbCommand, "ContextSubTypeId", DbType.Int32, (int)ContextSubTypeId);
            db.AddInParameter(dbCommand, "PhotoCategoryId", DbType.Int32, (int)PhotoCategoryId);

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                while (dataReader.Read())
                {
                    Photo entity = new Photo();

                    Utility.Generic.AssignDataReaderToEntity(dataReader, entity);
                    returnEntityCollection.Add(entity);
                }
            }

            return(returnEntityCollection);
        }