Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
 public List <Photo> SelectAllByContextSubTypeId(Guid contextId, Guid ContextSubId, Enums.ContextSubType ContextSubTypeId, Enums.PhotoCategory PhotoCategoryId)
 {
     return(PhotoDAO.GetAllByFieldValue("ContextId", contextId, "ContextSubId", ContextSubId, ContextSubTypeId, PhotoCategoryId));
 }
Пример #5
0
 public List <Photo> SelectAllByPhotoCategoryId(Guid contextId, Enums.PhotoCategory PhotoCategoryId)
 {
     return(PhotoDAO.GetAllByFieldValue("ContextId", contextId, PhotoCategoryId));
 }
Пример #6
0
 public Photo(Enums.PhotoCategory photoCategory)
 {
     PhotoCategoryId = (int)photoCategory;
 }
Пример #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);
        }