init
This commit is contained in:
		
							
								
								
									
										46
									
								
								Kreta.BusinessLogic/Caching/ElearningCache.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								Kreta.BusinessLogic/Caching/ElearningCache.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,46 @@
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using Kreta.BusinessLogic.HelperClasses;
 | 
			
		||||
using Kreta.Core.Elearning.Nexius;
 | 
			
		||||
using Kreta.Framework.Caching;
 | 
			
		||||
using Nexius.IdentityProvider.Model.External.V1;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.KretaServer.Caching
 | 
			
		||||
{
 | 
			
		||||
    public class ElearningCache : GenericCache<IDictionary<string, KretaCourseCo>>
 | 
			
		||||
    {
 | 
			
		||||
        private static readonly string ElearningCacheKey = $"{nameof(Kreta)}_{nameof(ElearningCache)}";
 | 
			
		||||
 | 
			
		||||
        public ElearningCache(Framework.Caching.CacheManager cacheManager) : base(cacheManager, nameof(ElearningCache))
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public IDictionary<string, Course> GetCourses(IEnumerable<string> idList, INexiusCourseService nexiusCourseService)
 | 
			
		||||
        {
 | 
			
		||||
            var allCourses = GetAllCourses(nexiusCourseService);
 | 
			
		||||
            var result = new Dictionary<string, Course>();
 | 
			
		||||
            foreach (var id in idList)
 | 
			
		||||
            {
 | 
			
		||||
                if (allCourses.TryGetValue(id.ToLower(), out KretaCourseCo co))
 | 
			
		||||
                {
 | 
			
		||||
                    result.Add(id.ToLower(), co.ToCourse());
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private IDictionary<string, KretaCourseCo> GetAllCourses(INexiusCourseService nexiusCourseService)
 | 
			
		||||
        {
 | 
			
		||||
            return Get(ElearningCacheKey) ?? LoadAllCourses(nexiusCourseService);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private IDictionary<string, KretaCourseCo> LoadAllCourses(INexiusCourseService nexiusCourseService)
 | 
			
		||||
        {
 | 
			
		||||
            var courseDictionary = nexiusCourseService.GetAllCourses().ToDictionary(c => c.Id.ToString().ToLower(), c => new KretaCourseCo(c));
 | 
			
		||||
            AddOrUpdate(ElearningCacheKey, courseDictionary, x => courseDictionary);
 | 
			
		||||
 | 
			
		||||
            return courseDictionary;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										64
									
								
								Kreta.BusinessLogic/Caching/FileServiceCache.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								Kreta.BusinessLogic/Caching/FileServiceCache.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,64 @@
 | 
			
		||||
using System;
 | 
			
		||||
using CacheManager.Core;
 | 
			
		||||
using Kreta.BusinessLogic.Interfaces;
 | 
			
		||||
using Kreta.Core;
 | 
			
		||||
using Kreta.Framework.Caching;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Caching
 | 
			
		||||
{
 | 
			
		||||
    public class FileServiceCache : GenericCache<string>
 | 
			
		||||
    {
 | 
			
		||||
        private static readonly string PublicTokenCache = $"{Constants.Cache.CacheKeyPrefix}{nameof(PublicTokenCache)}";
 | 
			
		||||
 | 
			
		||||
        private static readonly string PrivateTokenCache = $"{Constants.Cache.CacheKeyPrefix}{nameof(PrivateTokenCache)}";
 | 
			
		||||
 | 
			
		||||
        public FileServiceCache(Framework.Caching.CacheManager cacheManager) : base(cacheManager, nameof(FileServiceCache)) { }
 | 
			
		||||
 | 
			
		||||
        public string GetPublicToken(ITokenServiceHelper tokenServiceHelper, bool forceUpdate = false)
 | 
			
		||||
            => !forceUpdate
 | 
			
		||||
                ? Get(PublicTokenCache) ?? SetPublicTokenFromService(tokenServiceHelper)
 | 
			
		||||
                : SetPublicTokenFromService(tokenServiceHelper);
 | 
			
		||||
 | 
			
		||||
        public string GetPrivateToken(ITokenServiceHelper tokenServiceHelper, bool forceUpdate = false)
 | 
			
		||||
            => !forceUpdate
 | 
			
		||||
                ? Get(PrivateTokenCache) ?? SetPrivateTokenFromService(tokenServiceHelper)
 | 
			
		||||
                : SetPrivateTokenFromService(tokenServiceHelper);
 | 
			
		||||
 | 
			
		||||
        private string SetPrivateTokenFromService(ITokenServiceHelper tokenServiceHelper)
 | 
			
		||||
        {
 | 
			
		||||
            var (token, expiresIn) = tokenServiceHelper.GetPrivateTokenWithExpiresIn();
 | 
			
		||||
 | 
			
		||||
            AddTokentToCache(PrivateTokenCache, token, expiresIn);
 | 
			
		||||
 | 
			
		||||
            return token;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private string SetPublicTokenFromService(ITokenServiceHelper tokenServiceHelper)
 | 
			
		||||
        {
 | 
			
		||||
            var (token, expiresIn) = tokenServiceHelper.GetPublicTokenWithExpiresIn();
 | 
			
		||||
 | 
			
		||||
            AddTokentToCache(PublicTokenCache, token, expiresIn);
 | 
			
		||||
 | 
			
		||||
            return token;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void AddTokentToCache(string key, string token, int expiresIn)
 | 
			
		||||
        {
 | 
			
		||||
            AddOrUpdate(key, token, oldValue => token);
 | 
			
		||||
            Expire(key, ExpirationMode.Absolute, GetExpirationTime(expiresIn));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private TimeSpan GetExpirationTime(int expiresIn)
 | 
			
		||||
        {
 | 
			
		||||
            var timeout = new TimeSpan(0, 0, expiresIn);
 | 
			
		||||
            var offsetTime = new TimeSpan(0, 1, 0);
 | 
			
		||||
 | 
			
		||||
            if (timeout > offsetTime)
 | 
			
		||||
            {
 | 
			
		||||
                timeout -= offsetTime;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return timeout;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										67
									
								
								Kreta.BusinessLogic/Caching/TantargyiAtlagCache.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								Kreta.BusinessLogic/Caching/TantargyiAtlagCache.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,67 @@
 | 
			
		||||
using System;
 | 
			
		||||
using Kreta.Core;
 | 
			
		||||
using Kreta.Ellenorzo.Domain.VN.Ertekeles.Atlag.TantargyiAtlag;
 | 
			
		||||
using Kreta.Framework.Caching;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Caching
 | 
			
		||||
{
 | 
			
		||||
    public class TantargyiAtlagCache : GenericCache<object>
 | 
			
		||||
    {
 | 
			
		||||
        private static readonly string TantargyiAtlagCacheKeyPrefix = $"{Constants.Cache.CacheKeyPrefix}TantargyiAtlagCache_";
 | 
			
		||||
        private static readonly string TantargyiAtlagRegionPrefix = $"{Constants.Cache.CacheKeyPrefix}TantargyiAtlagCacheRegion_";
 | 
			
		||||
        private static readonly string TantargyiAtlagTriggerPrefix = $"{Constants.Cache.CacheKeyPrefix}TantargyiAtlagTrigger_";
 | 
			
		||||
 | 
			
		||||
        public TantargyiAtlagCache(Framework.Caching.CacheManager cacheManager) : base(cacheManager, nameof(TantargyiAtlagCache))
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private string GetCacheKey(string keyPrefix, int userId, string instituteCode, string tantargyUid, int? oktatasiNevelesiFeladatId)
 | 
			
		||||
        {
 | 
			
		||||
            return $"{keyPrefix}{instituteCode}.{userId}.{tantargyUid}.{oktatasiNevelesiFeladatId}";
 | 
			
		||||
        }
 | 
			
		||||
        private static string GetTantargyiAtlagRegionKey(string instituteCode) => $"{TantargyiAtlagRegionPrefix}{instituteCode}";
 | 
			
		||||
 | 
			
		||||
        public TantargyiAtlagListResponse GetTantargyiAtlag(int userId, string instituteCode, string tantargyUid, int? oktatasiNevelesiFeladatId)
 | 
			
		||||
        {
 | 
			
		||||
            string key = GetCacheKey(TantargyiAtlagCacheKeyPrefix, userId, instituteCode, tantargyUid, oktatasiNevelesiFeladatId);
 | 
			
		||||
            string region = GetTantargyiAtlagRegionKey(instituteCode);
 | 
			
		||||
 | 
			
		||||
            return (TantargyiAtlagListResponse)GetByKeyAndRegion(key, region);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void AddOrUpdateTantargyiAtlag(int userId, string instituteCode, string tantargyUid, int? oktatasiNevelesiFeladatId, TantargyiAtlagListResponse value)
 | 
			
		||||
        {
 | 
			
		||||
            AddOrUpdateWithRegion(GetCacheKey(TantargyiAtlagCacheKeyPrefix, userId, instituteCode, tantargyUid, oktatasiNevelesiFeladatId), GetTantargyiAtlagRegionKey(instituteCode), value, k => value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void RemoveTantargyiAtlag(int userId, string instituteCode, string tantargyUid, int? oktatasiNevelesiFeladatId)
 | 
			
		||||
        {
 | 
			
		||||
            string key = GetCacheKey(TantargyiAtlagCacheKeyPrefix, userId, instituteCode, tantargyUid, oktatasiNevelesiFeladatId);
 | 
			
		||||
 | 
			
		||||
            RemoveFromRegion(key, GetTantargyiAtlagRegionKey(instituteCode));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Értékelés adásánál szükséges készítenünk egy fake kulcsot ami majd adott késleltetés lejáratakor ki fogja ütni az adott tantárgyi atlag cache hogy frissülni tudjon.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="userId">user id-ja</param>
 | 
			
		||||
        /// <param name="instituteCode">intézmény</param>
 | 
			
		||||
        /// <param name="tantargyUid">tantargy uid</param>
 | 
			
		||||
        /// <param name="oktatasiNevelesiFeladatId">oktatasnevelesfeladat id</param>
 | 
			
		||||
        /// <param name="timeSpan">késleltetés időtartama</param>
 | 
			
		||||
        public void SetTantargyiAtlagExpiration(int userId, string instituteCode, string tantargyUid, int? oktatasiNevelesiFeladatId, TimeSpan timeSpan)
 | 
			
		||||
        {
 | 
			
		||||
            string cacheKey = GetCacheKey(TantargyiAtlagCacheKeyPrefix, userId, instituteCode, tantargyUid, oktatasiNevelesiFeladatId);
 | 
			
		||||
            var triggerKey = $"{TantargyiAtlagTriggerPrefix}{DateTime.Now.Add(timeSpan):yyyyMMddHHmmss}:{GetTantargyiAtlagRegionKey(instituteCode)}:{cacheKey}";
 | 
			
		||||
            AddWithAbsoluteExpiration(triggerKey, timeSpan, string.Empty);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///Adott intézményben az összes tantárgyi átlaghoz tartozó cache-t törlése
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public void ClearTantargyiAtlagRegion(string instituteCode)
 | 
			
		||||
        {
 | 
			
		||||
            ClearRegion(GetTantargyiAtlagRegionKey(instituteCode));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										45
									
								
								Kreta.BusinessLogic/Caching/TanuloAdatlapCache.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								Kreta.BusinessLogic/Caching/TanuloAdatlapCache.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
using System;
 | 
			
		||||
using Kreta.Core;
 | 
			
		||||
using Kreta.Ellenorzo.Domain.VN.Felhasznalo.Tanulo;
 | 
			
		||||
using Kreta.Framework.Caching;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Caching
 | 
			
		||||
{
 | 
			
		||||
    public class TanuloAdatlapCache : GenericCache<object>
 | 
			
		||||
    {
 | 
			
		||||
        private static readonly string TanuloAdatlapCacheKeyPrefix = $"{Constants.Cache.CacheKeyPrefix}TanuloAdatlapCache_";
 | 
			
		||||
 | 
			
		||||
        public TanuloAdatlapCache(Framework.Caching.CacheManager cacheManager) : base(cacheManager, nameof(TanuloAdatlapCache))
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public TanuloAdatResponse GetOrAddTanuloAdatlap(int userId, string instituteCode, Func<TanuloAdatResponse> value)
 | 
			
		||||
        {
 | 
			
		||||
            return GetOrAddValue(TanuloAdatlapCacheKeyPrefix, userId, instituteCode, value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void RemoveTanuloAdatlap(int userId, string instituteCode)
 | 
			
		||||
        {
 | 
			
		||||
            RemoveValue(TanuloAdatlapCacheKeyPrefix, userId, instituteCode);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected string GetCacheKey(string keyPrefix, int userId, string instituteCode)
 | 
			
		||||
        {
 | 
			
		||||
            return $"{keyPrefix}{instituteCode}.{userId}";
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected T GetOrAddValue<T>(string cacheKeyPrefix, int userId, string instituteCode, Func<T> valueFactory) where T : class
 | 
			
		||||
        {
 | 
			
		||||
            string key = GetCacheKey(cacheKeyPrefix, userId, instituteCode);
 | 
			
		||||
            object value = GetOrAdd(key, _ => valueFactory());
 | 
			
		||||
 | 
			
		||||
            return (T)value;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected void RemoveValue(string cacheKeyPrefix, int userId, string instituteCode)
 | 
			
		||||
        {
 | 
			
		||||
            string key = GetCacheKey(cacheKeyPrefix, userId, instituteCode);
 | 
			
		||||
            Remove(key);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										257
									
								
								Kreta.BusinessLogic/Classes/ApplicationData.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										257
									
								
								Kreta.BusinessLogic/Classes/ApplicationData.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,257 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Configuration;
 | 
			
		||||
using System.Web;
 | 
			
		||||
using Kreta.Framework;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes
 | 
			
		||||
{
 | 
			
		||||
    public class ApplicationData
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        #region Web.Config Pareméterek
 | 
			
		||||
 | 
			
		||||
        public static string ReCaptchaPrivateKey
 | 
			
		||||
        {
 | 
			
		||||
            get { return ConfigurationManager.AppSettings["ReCaptchaPrivateKey"] ?? ""; }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string ReCaptchaPublicKey
 | 
			
		||||
        {
 | 
			
		||||
            get { return ConfigurationManager.AppSettings["ReCaptchaPublicKey"] ?? ""; }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string ReCaptchaValidateUrl
 | 
			
		||||
        {
 | 
			
		||||
            get { return ConfigurationManager.AppSettings["ReCaptchaValidateUrl"] ?? ""; }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static int? ReCaptchaIsEnabledCounter
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                var ReCaptchaIsEnabledCounterValue = ConfigurationManager.AppSettings["ReCaptchaIsEnabledCounter"];
 | 
			
		||||
                int.TryParse(ReCaptchaIsEnabledCounterValue, out int result);
 | 
			
		||||
                return result == 0 ? (int?)null : result;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string AdminDefaultPage
 | 
			
		||||
        {
 | 
			
		||||
            get { return ConfigurationManager.AppSettings["Adminisztrator_DefaultPage"] ?? ""; }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string IgazgatoDefaultPage
 | 
			
		||||
        {
 | 
			
		||||
            get { return ConfigurationManager.AppSettings["Igazgato_DefaultPage"] ?? ""; }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string OsztalyfonokDefaultPage
 | 
			
		||||
        {
 | 
			
		||||
            get { return ConfigurationManager.AppSettings["Osztalyfonok_DefaultPage"] ?? ""; }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string TanarDefaultPage
 | 
			
		||||
        {
 | 
			
		||||
            get { return ConfigurationManager.AppSettings["Tanar_DefaultPage"] ?? ""; }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string NaploDefaultPage
 | 
			
		||||
        {
 | 
			
		||||
            get { return ConfigurationManager.AppSettings["Naplo_DefaultPage"] ?? ""; }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string SzuloDefaultPage
 | 
			
		||||
        {
 | 
			
		||||
            get { return ConfigurationManager.AppSettings["Szulo_DefaultPage"] ?? ""; }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string CsokkentettSzuloDefaultPage
 | 
			
		||||
        {
 | 
			
		||||
            get { return ConfigurationManager.AppSettings["CsokkentettSzulo_DefaultPage"] ?? ""; }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string TanuloDefaultPage
 | 
			
		||||
        {
 | 
			
		||||
            get { return ConfigurationManager.AppSettings["Tanulo_DefaultPage"] ?? ""; }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string TavolletDefaultPage
 | 
			
		||||
        {
 | 
			
		||||
            get { return ConfigurationManager.AppSettings["Tavollet_DefaultPage"] ?? ""; }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string ArchivDefaultPage
 | 
			
		||||
        {
 | 
			
		||||
            get { return ConfigurationManager.AppSettings["Archiv_DefaultPage"] ?? ""; }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string DualisAdminDefaultPage
 | 
			
		||||
        {
 | 
			
		||||
            get { return ConfigurationManager.AppSettings["DualisAdmin_DefaultPage"] ?? ""; }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static bool KretaDebug
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                var currContext = HttpContext.Current;
 | 
			
		||||
 | 
			
		||||
                //GUID = 465B55A0B15D4B08AC446620577A615C
 | 
			
		||||
                if (currContext != null && currContext.Handler != null && HttpContext.Current.Request.Params["KretaDebug"] == "465B55A0B15D4B08AC446620577A615C")
 | 
			
		||||
                {
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                return SDAConvert.ToBoolean(ConfigurationManager.AppSettings["KretaDebug"], false);
 | 
			
		||||
            }
 | 
			
		||||
            set { ConfigurationManager.AppSettings["KretaDebug"] = value.ToString(); }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static bool IsUsageTraced
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                return ConfigurationManager.AppSettings["UsageTracking"] != null
 | 
			
		||||
&& SDAConvert.ToBoolean(ConfigurationManager.AppSettings["UsageTracking"], false);
 | 
			
		||||
            }
 | 
			
		||||
            set { ConfigurationManager.AppSettings["UsageTracking"] = value.ToString(); }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string NyomtatasiSablonokKonyvtar
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                if (HttpContext.Current.Application["NyomtatasiSablonokKonyvtar"] == null)
 | 
			
		||||
                {
 | 
			
		||||
                    NyomtatasiSablonokKonyvtar = ConfigurationManager.AppSettings["NyomtatasiSablonokKonyvtar"];
 | 
			
		||||
                }
 | 
			
		||||
                return HttpContext.Current.Application["NyomtatasiSablonokKonyvtar"] as string;
 | 
			
		||||
            }
 | 
			
		||||
            set { HttpContext.Current.Application["NyomtatasiSablonokKonyvtar"] = value; }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string KirLoginUrl
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                if (HttpContext.Current.Application["KirLoginUrl"] == null)
 | 
			
		||||
                {
 | 
			
		||||
                    HttpContext.Current.Application["KirLoginUrl"] = ConfigurationManager.AppSettings["KirLoginUrl"];
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                return HttpContext.Current.Application["KirLoginUrl"].ToString();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string MdszUrl
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                if (HttpContext.Current.Application["MdszUrl"] == null)
 | 
			
		||||
                {
 | 
			
		||||
                    HttpContext.Current.Application["MdszUrl"] = ConfigurationManager.AppSettings["MdszUrl"];
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                return HttpContext.Current.Application["MdszUrl"].ToString();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string MdszUserName
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                if (HttpContext.Current.Application["MdszUserName"] == null)
 | 
			
		||||
                {
 | 
			
		||||
                    HttpContext.Current.Application["MdszUserName"] = ConfigurationManager.AppSettings["MdszUserName"];
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                return HttpContext.Current.Application["MdszUserName"].ToString();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string MdszPassword
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                if (HttpContext.Current.Application["MdszPassword"] == null)
 | 
			
		||||
                {
 | 
			
		||||
                    HttpContext.Current.Application["MdszPassword"] = ConfigurationManager.AppSettings["MdszPassword"];
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                return HttpContext.Current.Application["MdszPassword"].ToString();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static bool OnTTFPrompt
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                if (HttpContext.Current.Application["OnTTFPrompt"] == null)
 | 
			
		||||
                {
 | 
			
		||||
                    HttpContext.Current.Application["OnTTFPrompt"] = ConfigurationManager.AppSettings["OnTTFPrompt"];
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                return string.Equals(HttpContext.Current.Application["OnTTFPrompt"].ToString(), bool.TrueString, StringComparison.OrdinalIgnoreCase);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string PoszeidonUrl
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                if (HttpContext.Current.Application["PoszeidonUrl"] == null)
 | 
			
		||||
                {
 | 
			
		||||
                    HttpContext.Current.Application["PoszeidonUrl"] = ConfigurationManager.AppSettings["PoszeidonUrl"];
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                return HttpContext.Current.Application["PoszeidonUrl"].ToString();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string TempDataKonyvtar
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                if (HttpContext.Current.Application["TempDataKonyvtar"] == null)
 | 
			
		||||
                {
 | 
			
		||||
                    HttpContext.Current.Application["TempDataKonyvtar"] = ConfigurationManager.AppSettings["TempDataKonyvtar"];
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                return HttpContext.Current.Application["TempDataKonyvtar"].ToString();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static int TemporaryFileDeletionThresholdInSeconds
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                if (HttpContext.Current.Application[nameof(TemporaryFileDeletionThresholdInSeconds)] == null)
 | 
			
		||||
                {
 | 
			
		||||
                    HttpContext.Current.Application[nameof(TemporaryFileDeletionThresholdInSeconds)] =
 | 
			
		||||
                        int.Parse(ConfigurationManager.AppSettings[nameof(TemporaryFileDeletionThresholdInSeconds)]);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                return int.Parse(HttpContext.Current.Application[nameof(TemporaryFileDeletionThresholdInSeconds)].ToString());
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        public static SystemType SystemType
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                if (HttpContext.Current.Application["SystemType"] != null)
 | 
			
		||||
                {
 | 
			
		||||
                    return (SystemType)HttpContext.Current.Application["SystemType"];
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                return SystemType.Ismeretlen;
 | 
			
		||||
            }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                HttpContext.Current.Application["SystemType"] = value;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,42 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using Kreta.Enums.ManualEnums;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.AsposeHelpers
 | 
			
		||||
{
 | 
			
		||||
    public class AsposeDocumentParameters
 | 
			
		||||
    {
 | 
			
		||||
        public DateTime Kelt { get; set; }
 | 
			
		||||
        public KotesmargoTipusEnum KotesmargoTipus { get; set; } = KotesmargoTipusEnum.Nincs;
 | 
			
		||||
        public bool SNIMegjelenites { get; set; }
 | 
			
		||||
        public bool FejlecMegjelenitese { get; set; }
 | 
			
		||||
        public bool AdatokMegjelenitese { get; set; }
 | 
			
		||||
        public bool EvesOraszamMegjelenites { get; set; }
 | 
			
		||||
        public bool AltantargyBeszamitasa { get; set; }
 | 
			
		||||
        public bool TorvenyesKepviseloMegjelenites { get; set; }
 | 
			
		||||
        public bool OKJMegjelenitese { get; set; }
 | 
			
		||||
        public bool FelmentesekMegjelenitese { get; set; }
 | 
			
		||||
        public bool FeljegyzesekMegjelenitese { get; set; }
 | 
			
		||||
        public bool KozossegiSzolgalatMegjelenitese { get; set; }
 | 
			
		||||
        public BetuMeretEnum BetuMeret { get; set; }
 | 
			
		||||
        public Dictionary<string, string> AlairoSzemely { get; set; }
 | 
			
		||||
        public bool IsAtlagMegjelenites { get; set; }
 | 
			
		||||
        public bool IsEvesOraszamMegjelenites { get; set; }
 | 
			
		||||
        public int ErtekelesMegjelenitesFormatum { get; set; }
 | 
			
		||||
        public bool IsMulasztasokUjLapra { get; set; }
 | 
			
		||||
        public KeltFormatumTipusEnum KeltFormatum { get; set; }
 | 
			
		||||
        public NyomtatvanyFormatumEnum NyomtatvanyFormatum { get; set; }
 | 
			
		||||
        public int BetuMeretFejlec { get; set; }
 | 
			
		||||
        public int BetuMeretAdatok { get; set; }
 | 
			
		||||
        public int BetuMeretSNI { get; set; }
 | 
			
		||||
        public int MuveszetiAgId { get; set; }
 | 
			
		||||
        public bool MegjegyzesekMegjelenitese { get; set; }
 | 
			
		||||
        public bool IsTagintezmenyAdatokMegjelenjen { get; set; }
 | 
			
		||||
        public string TagintezmenyNeve { get; set; }
 | 
			
		||||
        public string TagintezmenyCime { get; set; }
 | 
			
		||||
        public string TagintezmenyVaros { get; set; }
 | 
			
		||||
        public string TagintezmenyAzonosito { get; set; }
 | 
			
		||||
        public string OsztalyNev { get; set; }
 | 
			
		||||
        public object Entity { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										104
									
								
								Kreta.BusinessLogic/Classes/AsposeHelpers/AsposeHelperOptions.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										104
									
								
								Kreta.BusinessLogic/Classes/AsposeHelpers/AsposeHelperOptions.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,104 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Globalization;
 | 
			
		||||
using Aspose.Pdf;
 | 
			
		||||
using Kreta.Enums;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.AsposeHelpers
 | 
			
		||||
{
 | 
			
		||||
    public class AsposeHelperOptions : IDisposable
 | 
			
		||||
    {
 | 
			
		||||
        private AnyanyelvEnum _nyelv;
 | 
			
		||||
 | 
			
		||||
        public PageNumberingEnum PageNumbering { get; set; }
 | 
			
		||||
        public PageSize PageSize { get; set; }
 | 
			
		||||
 | 
			
		||||
        public MarginInfo Margins { get; set; }
 | 
			
		||||
 | 
			
		||||
        public AnyanyelvEnum Nyelv
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                return _nyelv;
 | 
			
		||||
            }
 | 
			
		||||
            set
 | 
			
		||||
            {
 | 
			
		||||
                _nyelv = value;
 | 
			
		||||
                Culture = CultureInfo.GetCultureInfo(GetCultureCodeFromAnyanyelv(_nyelv));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public CultureInfo Culture { get; private set; }
 | 
			
		||||
 | 
			
		||||
        public int TanevId { get; private set; }
 | 
			
		||||
 | 
			
		||||
        public AsposeDocumentParameters DocumentParameters { get; set; }
 | 
			
		||||
 | 
			
		||||
        public BizonyitvanypotlapEvfolyamDivIdEnum BizonyitvanypotlapEvfolyamDivId { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int? MulasztasErtesitoNktGondviseloTableIndex { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int? MulasztasErtesitoNktMulasztasTableIndex { get; set; }
 | 
			
		||||
 | 
			
		||||
        public System.Drawing.Image EgyediFejlec { get; set; }
 | 
			
		||||
 | 
			
		||||
        private AsposeHelperOptions() { }
 | 
			
		||||
 | 
			
		||||
        public AsposeHelperOptions(int tanevId)
 | 
			
		||||
        {
 | 
			
		||||
            TanevId = tanevId;
 | 
			
		||||
            PageNumbering = PageNumberingEnum.None;
 | 
			
		||||
            PageSize = PageSize.A4;
 | 
			
		||||
            Margins = new MarginInfo(18, 18, 18, 18);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static string GetCultureCodeFromAnyanyelv(AnyanyelvEnum? asposeNyelv)
 | 
			
		||||
        {
 | 
			
		||||
            string cultureCode;
 | 
			
		||||
            switch (asposeNyelv)
 | 
			
		||||
            {
 | 
			
		||||
                case AnyanyelvEnum.angol:
 | 
			
		||||
                    cultureCode = "en-US";
 | 
			
		||||
                    break;
 | 
			
		||||
                case AnyanyelvEnum.roman:
 | 
			
		||||
                    cultureCode = "ro-RO";
 | 
			
		||||
                    break;
 | 
			
		||||
                case AnyanyelvEnum.horvat:
 | 
			
		||||
                    cultureCode = "hr-HR";
 | 
			
		||||
                    break;
 | 
			
		||||
                case AnyanyelvEnum.nemet:
 | 
			
		||||
                    cultureCode = "de-DE";
 | 
			
		||||
                    break;
 | 
			
		||||
                case AnyanyelvEnum.szerb:
 | 
			
		||||
                    cultureCode = "sr-Cyrl";
 | 
			
		||||
                    break;
 | 
			
		||||
                default:
 | 
			
		||||
                    cultureCode = "hu-HU";
 | 
			
		||||
                    break;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return cultureCode;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void Dispose()
 | 
			
		||||
        {
 | 
			
		||||
            if (EgyediFejlec != null)
 | 
			
		||||
            {
 | 
			
		||||
                EgyediFejlec.Dispose();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public enum PageNumberingEnum
 | 
			
		||||
    {
 | 
			
		||||
        None,
 | 
			
		||||
        AllPage,
 | 
			
		||||
        AllExceptFirst
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public enum BizonyitvanypotlapEvfolyamDivIdEnum
 | 
			
		||||
    {
 | 
			
		||||
        elsoosztaly,
 | 
			
		||||
        masodiknegyedikosztaly,
 | 
			
		||||
        felsoosztalyok
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										122
									
								
								Kreta.BusinessLogic/Classes/ComboBox/ComboBoxHelper.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										122
									
								
								Kreta.BusinessLogic/Classes/ComboBox/ComboBoxHelper.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,122 @@
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.ComboBox
 | 
			
		||||
{
 | 
			
		||||
    public static class ComboBoxHelper
 | 
			
		||||
    {
 | 
			
		||||
        public static List<GroupComboBoxListItem> ConvertDataToGroup(List<ComboBoxListItem> resourceList, string[] dedicatedOrder = null, bool customThenByOrder = false)
 | 
			
		||||
        {
 | 
			
		||||
            if (dedicatedOrder == null)
 | 
			
		||||
            {
 | 
			
		||||
                dedicatedOrder = new string[0];
 | 
			
		||||
            }
 | 
			
		||||
            var result = new List<GroupComboBoxListItem>();
 | 
			
		||||
 | 
			
		||||
            var groups = resourceList.OrderBy(a => a.GroupName).Select(a => a.GroupName).Distinct().ToList();
 | 
			
		||||
 | 
			
		||||
            foreach (var item in dedicatedOrder)
 | 
			
		||||
            {
 | 
			
		||||
                groups.Remove(item);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var myOrder = dedicatedOrder.ToList();
 | 
			
		||||
            myOrder.AddRange(groups);
 | 
			
		||||
 | 
			
		||||
            foreach (var item in resourceList)
 | 
			
		||||
            {
 | 
			
		||||
                int index = myOrder.IndexOf(item.GroupName) + 1;
 | 
			
		||||
                result.Add(new GroupComboBoxListItem { GroupName = item.GroupName, Order = index, Text = item.Text, Value = item.Value });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (customThenByOrder)
 | 
			
		||||
            {
 | 
			
		||||
                result = result.OrderBy(c => c.Order).ToList();
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                result = result.OrderBy(c => c.Order).ThenBy(c => c.Text).ToList();
 | 
			
		||||
            }
 | 
			
		||||
            foreach (var item in result.GroupBy(x => new { x.Order }).Select(x => x.First()).ToList())
 | 
			
		||||
            {
 | 
			
		||||
                item.First = true;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
        public static List<MultipleOrderGroupComboBoxListItem> ConvertDataToGroupWMultipleOrderColumns(List<MultipleOrderComboBoxListItem> resourceList, string[] dedicatedOrder = null, bool customThenByOrder = false)
 | 
			
		||||
        {
 | 
			
		||||
            if (dedicatedOrder == null)
 | 
			
		||||
            {
 | 
			
		||||
                dedicatedOrder = new string[0];
 | 
			
		||||
            }
 | 
			
		||||
            var result = new List<MultipleOrderGroupComboBoxListItem>();
 | 
			
		||||
            var multipleOrderColNumber = 0;
 | 
			
		||||
 | 
			
		||||
            var groups = resourceList.OrderBy(a => a.GroupName).Select(a => a.GroupName).Distinct().ToList();
 | 
			
		||||
            foreach (var item in dedicatedOrder)
 | 
			
		||||
            {
 | 
			
		||||
                groups.Remove(item);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var myOrder = dedicatedOrder.ToList();
 | 
			
		||||
            myOrder.AddRange(groups);
 | 
			
		||||
 | 
			
		||||
            foreach (var item in resourceList)
 | 
			
		||||
            {
 | 
			
		||||
                int index = myOrder.IndexOf(item.GroupName) + 1;
 | 
			
		||||
                if (item.MultipleOrderParameterArray != null)
 | 
			
		||||
                    multipleOrderColNumber = item.MultipleOrderParameterArray.Length;
 | 
			
		||||
                result.Add(new MultipleOrderGroupComboBoxListItem { GroupName = item.GroupName, Order = index, MultipleOrderParameterArray = item.MultipleOrderParameterArray, Text = item.Text, Value = item.Value });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (multipleOrderColNumber > 0)
 | 
			
		||||
            {
 | 
			
		||||
                if (!customThenByOrder)
 | 
			
		||||
                    result = result.OrderBy(c => c.Text).ToList();
 | 
			
		||||
                for (int i = multipleOrderColNumber - 1; i >= 0; i--)
 | 
			
		||||
                {
 | 
			
		||||
                    result = result.OrderBy(c => c.MultipleOrderParameterArray[i]).ToList();
 | 
			
		||||
                }
 | 
			
		||||
                result = result.OrderBy(c => c.Order).ToList();
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                result = result.OrderBy(c => c.Order).ThenBy(c => c.Text).ToList();
 | 
			
		||||
            }
 | 
			
		||||
            foreach (var item in result.GroupBy(x => new { x.Order }).Select(x => x.First()).ToList())
 | 
			
		||||
            {
 | 
			
		||||
                item.First = true;
 | 
			
		||||
            }
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class MultipleOrderComboBoxListItem : ComboBoxListItem
 | 
			
		||||
    {
 | 
			
		||||
        public string[] MultipleOrderParameterArray { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
    public class MultipleOrderGroupComboBoxListItem : GroupComboBoxListItem
 | 
			
		||||
    {
 | 
			
		||||
        public string[] MultipleOrderParameterArray { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
    public class GroupComboBoxListItem : ComboBoxListItem
 | 
			
		||||
    {
 | 
			
		||||
        public int Order { get; set; }
 | 
			
		||||
        public bool First { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class ComboBoxListItem
 | 
			
		||||
    {
 | 
			
		||||
        public string Value { get; set; }
 | 
			
		||||
        public string Text { get; set; }
 | 
			
		||||
        public string GroupName { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class ComboListGroup
 | 
			
		||||
    {
 | 
			
		||||
        public bool Disabled { get; set; }
 | 
			
		||||
        public string Name { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,10 @@
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.ComboBox
 | 
			
		||||
{
 | 
			
		||||
    public class ExtraDataComboBoxListItem : ComboBoxListItem
 | 
			
		||||
    {
 | 
			
		||||
        public IDictionary<string, string> Data { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										20
									
								
								Kreta.BusinessLogic/Classes/ConfigsectionHandler.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								Kreta.BusinessLogic/Classes/ConfigsectionHandler.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Configuration;
 | 
			
		||||
using System.Xml;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// Summary description for configsection
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public class ConfigsectionHandler : IConfigurationSectionHandler
 | 
			
		||||
    {
 | 
			
		||||
        public object Create(object parent, object configContext, XmlNode section)
 | 
			
		||||
        {
 | 
			
		||||
            if (section == null)
 | 
			
		||||
                throw new Exception("Hibás web.config ServerConfig beállítás!");
 | 
			
		||||
            return section;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										42
									
								
								Kreta.BusinessLogic/Classes/DateHelper.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								Kreta.BusinessLogic/Classes/DateHelper.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Globalization;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes
 | 
			
		||||
{
 | 
			
		||||
    public static class DateHelper
 | 
			
		||||
    {
 | 
			
		||||
        // This presumes that weeks start with Monday.
 | 
			
		||||
        // Week 1 is the 1st week of the year with a Thursday in it.
 | 
			
		||||
        public static int GetISO8601WeekOfYear(this DateTime date)
 | 
			
		||||
        {
 | 
			
		||||
            var calendar = CultureInfo.InvariantCulture.Calendar;
 | 
			
		||||
 | 
			
		||||
            // Seriously cheat.  If its Monday, Tuesday or Wednesday, then it’ll 
 | 
			
		||||
            // be the same week# as whatever Thursday, Friday or Saturday are,
 | 
			
		||||
            // and we always get those right
 | 
			
		||||
            DayOfWeek day = calendar.GetDayOfWeek(date);
 | 
			
		||||
            if (DayOfWeek.Monday <= day && day <= DayOfWeek.Wednesday)
 | 
			
		||||
            {
 | 
			
		||||
                date = date.AddDays(3);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Return the week of our adjusted day
 | 
			
		||||
            return calendar.GetWeekOfYear(date, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static int GetISO8601WeekOfYear(this DateTime? date)
 | 
			
		||||
        {
 | 
			
		||||
            if (date.HasValue)
 | 
			
		||||
            {
 | 
			
		||||
                return date.Value.GetISO8601WeekOfYear();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return GetWeeksInYear();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static int GetWeeksInYear()
 | 
			
		||||
        {
 | 
			
		||||
            return GetISO8601WeekOfYear(new DateTime(DateTime.Now.Year, 12, 31));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										292
									
								
								Kreta.BusinessLogic/Classes/EnumExtensions.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										292
									
								
								Kreta.BusinessLogic/Classes/EnumExtensions.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,292 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using Kreta.Enums;
 | 
			
		||||
using Kreta.Enums.ManualEnums;
 | 
			
		||||
using Kreta.Framework.Caching;
 | 
			
		||||
using Kreta.Framework.Caching.DictionaryItemTables;
 | 
			
		||||
using Kreta.Framework.Util;
 | 
			
		||||
using Kreta.Resources;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes
 | 
			
		||||
{
 | 
			
		||||
    public static class EnumExtensions
 | 
			
		||||
    {
 | 
			
		||||
        public static int ToInt32(this Enum enumValue)
 | 
			
		||||
        {
 | 
			
		||||
            var result = Convert.ToInt32(enumValue);
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string GetDisplayName(this bool value, BooleanDisplayFormatEnum booleanDisplayFormatEnum = BooleanDisplayFormatEnum.Teljes)
 | 
			
		||||
        {
 | 
			
		||||
            string result;
 | 
			
		||||
            switch (booleanDisplayFormatEnum)
 | 
			
		||||
            {
 | 
			
		||||
                case BooleanDisplayFormatEnum.Teljes:
 | 
			
		||||
                    result = value ? CommonResource.Igen : CommonResource.Nem;
 | 
			
		||||
                    break;
 | 
			
		||||
                case BooleanDisplayFormatEnum.IN:
 | 
			
		||||
                    result = value ? "I" : "N";
 | 
			
		||||
                    break;
 | 
			
		||||
                case BooleanDisplayFormatEnum.TF:
 | 
			
		||||
                    result = value ? "T" : "F";
 | 
			
		||||
                    break;
 | 
			
		||||
                default:
 | 
			
		||||
                    throw new ArgumentException();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string GetDisplayName(this bool? value, string defaultValue = "", BooleanDisplayFormatEnum booleanFormat = BooleanDisplayFormatEnum.Teljes)
 | 
			
		||||
        {
 | 
			
		||||
            var result = defaultValue;
 | 
			
		||||
            if (value.HasValue)
 | 
			
		||||
            {
 | 
			
		||||
                result = GetDisplayName(value.Value, booleanFormat);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string GetDisplayName<T>(this int? enumIntValue, int tanevId, string defaultValue = "") where T : Enum
 | 
			
		||||
        {
 | 
			
		||||
            var result = defaultValue;
 | 
			
		||||
            if (enumIntValue.HasValue)
 | 
			
		||||
            {
 | 
			
		||||
                result = enumIntValue.Value.GetDisplayName<T>(tanevId);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string GetDisplayName<T>(this int enumIntValue, int tanevId) where T : Enum
 | 
			
		||||
        {
 | 
			
		||||
            string result;
 | 
			
		||||
            var enumType = typeof(T);
 | 
			
		||||
            //NOTE: Ha ManualEnums-ról van szó!
 | 
			
		||||
            if (enumType.AssemblyQualifiedName.Contains("Kreta.Enums.ManualEnums"))
 | 
			
		||||
            {
 | 
			
		||||
                var enumValue = ((T[])Enum.GetValues(enumType)).Single(x => x.ToInt32() == enumIntValue);
 | 
			
		||||
                result = enumValue.GetDisplayName(tanevId);
 | 
			
		||||
                return result;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            //NOTE: Ha nem ManualEnums-ról van szó, akkor GeneratedEnums(csak és kizárólag ManualEnums-ra vagy GeneratedEnums-ra lehet meghívni a GetDisplayName-et!).
 | 
			
		||||
            //      Ebben az esetben a szöveget kivétel nélkül a DictionaryTableCache-ből szedjük, így az Environment SQL-ek miatt is jó szöveg jön le a db-ből!
 | 
			
		||||
            result = enumIntValue.GetItemNameFromCache(tanevId);
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string GetDisplayName<T>(this T enumValue, int tanevId) where T : Enum
 | 
			
		||||
        {
 | 
			
		||||
            var enumType = typeof(T);
 | 
			
		||||
            //NOTE: Ha ManualEnums-ról van szó!
 | 
			
		||||
            if (enumType.AssemblyQualifiedName.Contains("Kreta.Enums.ManualEnums"))
 | 
			
		||||
            {
 | 
			
		||||
                return FrameworkEnumExtensions.GetManualEnumNameFromCache<T>(enumValue.ToInt32());
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            //NOTE: Ha nem ManualEnums-ról van szó, akkor GeneratedEnums(csak és kizárólag ManualEnums-ra vagy GeneratedEnums-ra lehet meghívni a GetDisplayName-et!).
 | 
			
		||||
            //      Ebben az esetben a szöveget kivétel nélkül a DictionaryTableCache-ből szedjük, így az Environment SQL-ek miatt is jó szöveg jön le a db-ből!
 | 
			
		||||
            var enumIntValue = enumValue.ToInt32();
 | 
			
		||||
            var result = enumIntValue.GetItemNameFromCache(tanevId);
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static int? GetIdByDisplayName(string adatszotarNeve, GeneratedAdatszotarTipusEnum adatszotarTipus, int tanevId)
 | 
			
		||||
        {
 | 
			
		||||
            if (string.IsNullOrWhiteSpace(adatszotarNeve))
 | 
			
		||||
            {
 | 
			
		||||
                return null;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            int? result = ((int)adatszotarTipus).GetItemsByType(tanevId).Single(x => x.Name == adatszotarNeve).Id;
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static Dictionary<string, string> EnumToDictionary<T>(int tanevId, bool emptyItem = false, bool isValueInt = true, List<string> removeValueList = null) where T : Enum
 | 
			
		||||
        {
 | 
			
		||||
            var enumType = typeof(T);
 | 
			
		||||
            if (enumType.BaseType != typeof(Enum))
 | 
			
		||||
            {
 | 
			
		||||
                throw new ArgumentException("T must be of type System.Enum");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            IEnumerable<T> values = (T[])Enum.GetValues(typeof(T));
 | 
			
		||||
            var itemList = values.ToDictionary(
 | 
			
		||||
                x => isValueInt ? x.ToInt32().ToString() : Enum.GetName(typeof(T), x),
 | 
			
		||||
                x => x.GetDisplayName(tanevId));
 | 
			
		||||
 | 
			
		||||
            var result = removeValueList != null ? itemList.Where(x => !removeValueList.Contains(x.Key)).ToDictionary(x => x.Key, x => x.Value) : itemList;
 | 
			
		||||
 | 
			
		||||
            if (emptyItem)
 | 
			
		||||
            {
 | 
			
		||||
                var list = new Dictionary<string, string>
 | 
			
		||||
                {
 | 
			
		||||
                    { "", CommonResource.KeremValasszon }
 | 
			
		||||
                };
 | 
			
		||||
                result = list.Union(result).ToDictionary(k => k.Key, v => v.Value);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static IList<string> GetEnumDisplayNameList<T>(int tanevId, List<string> removeValueList = null) where T : Enum
 | 
			
		||||
        {
 | 
			
		||||
            var result = EnumToDictionary<T>(tanevId, removeValueList: removeValueList).Values.OrderBy(o => o).ToList();
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static IDictionary<int, string> GetAdatszotarDictElemekForTipus(int tanevId, GeneratedAdatszotarTipusEnum adatszotarTipus, List<int> removeIdList = null, bool visibleOnly = false)
 | 
			
		||||
        {
 | 
			
		||||
            if (removeIdList == null)
 | 
			
		||||
            {
 | 
			
		||||
                removeIdList = new List<int>();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return ((int)adatszotarTipus).GetItemsByType(tanevId, visibleOnly).Where(x => !removeIdList.Contains(x.Id)).ToDictionary(x => x.Id, x => x.Name);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static IList<string> GetAdatszotarElemekForTipus(int tanevId, GeneratedAdatszotarTipusEnum adatszotarTipus, List<int> removeIdList = null)
 | 
			
		||||
        {
 | 
			
		||||
            if (removeIdList == null)
 | 
			
		||||
            {
 | 
			
		||||
                removeIdList = new List<int>();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return GetAdatszotarDictElemekForTipus(tanevId, adatszotarTipus, removeIdList).Select(x => x.Value).ToList();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static List<AllampolgarsagDictionaryItem> GetAllampolgarsagDictionaryItems(int tanevId)
 | 
			
		||||
        {
 | 
			
		||||
            var result = GetExtendedDictionaryItems<AllampolgarsagDictionaryItem>(tanevId, (int)GeneratedAdatszotarTipusEnum.Allampolgarsag);
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static List<MunkakorTipusDictionaryItem> GetMunkakorTipusDictionaryItems(int tanevId)
 | 
			
		||||
        {
 | 
			
		||||
            var result = GetExtendedDictionaryItems<MunkakorTipusDictionaryItem>(tanevId, (int)GeneratedAdatszotarTipusEnum.MunkakorTipus);
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static List<OrszagTipusDictionaryItem> GetOrszagTipusDictionaryItems(int tanevId)
 | 
			
		||||
        {
 | 
			
		||||
            var result = GetExtendedDictionaryItems<OrszagTipusDictionaryItem>(tanevId, (int)GeneratedAdatszotarTipusEnum.OrszagTipus);
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static List<CsoportTipusDictionaryItem> GetCsoportTipusDictionaryItems(int tanevId)
 | 
			
		||||
        {
 | 
			
		||||
            var result = GetExtendedDictionaryItems<CsoportTipusDictionaryItem>(tanevId, (int)GeneratedAdatszotarTipusEnum.CsoportTipus);
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static List<OktatasiNevelesiFeladatDictionaryItem> GetOktatasiNevelesiFeladatDictionaryItems(int tanevId)
 | 
			
		||||
        {
 | 
			
		||||
            var result = GetExtendedDictionaryItems<OktatasiNevelesiFeladatDictionaryItem>(tanevId, (int)GeneratedAdatszotarTipusEnum.OktatasiNevelesiFeladat);
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static List<EvfolyamTipusDictionaryItem> GetEvfolyamTipusDictionaryItems(int tanevId, bool? isOsszevont = null)
 | 
			
		||||
        {
 | 
			
		||||
            var result = GetExtendedDictionaryItems<EvfolyamTipusDictionaryItem>(tanevId, (int)GeneratedAdatszotarTipusEnum.EvfolyamTipus);
 | 
			
		||||
            return isOsszevont == null ?
 | 
			
		||||
                result :
 | 
			
		||||
                result.Where(x => x.IsOsszevont == isOsszevont).ToList();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static List<NapTipusDictionaryItem> GetNapTipusDictionaryItems(int tanevId)
 | 
			
		||||
        {
 | 
			
		||||
            var result = GetExtendedDictionaryItems<NapTipusDictionaryItem>(tanevId, (int)GeneratedAdatszotarTipusEnum.NapTipus);
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static List<SorolasOkaTipusDictionaryItem> GetSorolasOkaTipusDictionaryItems(int tanevId)
 | 
			
		||||
        {
 | 
			
		||||
            var result = GetExtendedDictionaryItems<SorolasOkaTipusDictionaryItem>(tanevId, (int)GeneratedAdatszotarTipusEnum.SorolasOkaTipus);
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static List<ErtekelesModDictionaryItem> GetErtekelesModDictionaryItems(int tanevId)
 | 
			
		||||
        {
 | 
			
		||||
            var result = GetExtendedDictionaryItems<ErtekelesModDictionaryItem>(tanevId, (int)GeneratedAdatszotarTipusEnum.ErtekelesMod);
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static List<ErtekelesTipusDictionaryItem> GetErtekelesTipusDictionaryItems(int tanevId, bool? isEgyszerAdhato = null)
 | 
			
		||||
        {
 | 
			
		||||
            var result = GetExtendedDictionaryItems<ErtekelesTipusDictionaryItem>(tanevId, (int)GeneratedAdatszotarTipusEnum.ErtekelesTipus);
 | 
			
		||||
            return isEgyszerAdhato == null ?
 | 
			
		||||
                result :
 | 
			
		||||
                result.Where(x => x.IsEgyszerAdhato == isEgyszerAdhato).ToList();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static List<EsemenyTipusDictionaryItem> GetEsemenyTipusDictionaryItems(int tanevId)
 | 
			
		||||
        {
 | 
			
		||||
            var result = GetExtendedDictionaryItems<EsemenyTipusDictionaryItem>(tanevId, (int)GeneratedAdatszotarTipusEnum.EsemenyTipus);
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static List<SzakkepesitesTipusDictionaryItem> GetSzakkepesitesTipusDictionaryItems(int tanevId)
 | 
			
		||||
        {
 | 
			
		||||
            var result = GetExtendedDictionaryItems<SzakkepesitesTipusDictionaryItem>(tanevId, (int)GeneratedAdatszotarTipusEnum.SzakkepesitesTipus);
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static List<OraTulajdonsagTipusDictionaryItem> GetOraTulajdonsagTipusDictionaryItems(int tanevId)
 | 
			
		||||
        {
 | 
			
		||||
            var result = GetExtendedDictionaryItems<OraTulajdonsagTipusDictionaryItem>(tanevId, (int)GeneratedAdatszotarTipusEnum.OraTulajdonsagTipus);
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static List<DokumentumKulcsszoTipusDictionaryItem> GetDokumentumKulcsszoTipusDictionaryItems(int tanevId)
 | 
			
		||||
        {
 | 
			
		||||
            var result = GetExtendedDictionaryItems<DokumentumKulcsszoTipusDictionaryItem>(tanevId, (int)GeneratedAdatszotarTipusEnum.DokumentumKulcsszoTipus);
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static List<OktNevelesiKategoriaDictionaryItem> GetOktNevelesiKategoriaDictionaryItems(int tanevId)
 | 
			
		||||
        {
 | 
			
		||||
            var result = GetExtendedDictionaryItems<OktNevelesiKategoriaDictionaryItem>(tanevId, (int)GeneratedAdatszotarTipusEnum.OktNevelesiKategoria);
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static List<TavolletTipusDictionaryItem> GetTavolletTipusDictionaryItems(int tanevId)
 | 
			
		||||
        {
 | 
			
		||||
            var result = GetExtendedDictionaryItems<TavolletTipusDictionaryItem>(tanevId, (int)GeneratedAdatszotarTipusEnum.TavolletTipus);
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static List<AgazatUjSzktTipusDictionaryItem> GetAgazatUjSzktTipusDictionaryItems(int tanevId)
 | 
			
		||||
        {
 | 
			
		||||
            var result = GetExtendedDictionaryItems<AgazatUjSzktTipusDictionaryItem>(tanevId, (int)GeneratedAdatszotarTipusEnum.AgazatUjSzktTipus);
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static List<SzakmaTipusDictionaryItem> GetSzakmaTipusDictionaryItems(int tanevId)
 | 
			
		||||
        {
 | 
			
		||||
            var result = GetExtendedDictionaryItems<SzakmaTipusDictionaryItem>(tanevId, (int)GeneratedAdatszotarTipusEnum.SzakmaTipus);
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static List<AgazatReszSzakmaTipusDictionaryItem> GetAgazatReszSzakmaTipusDictionaryItems(int tanevId)
 | 
			
		||||
        {
 | 
			
		||||
            var result = GetExtendedDictionaryItems<AgazatReszSzakmaTipusDictionaryItem>(tanevId, (int)GeneratedAdatszotarTipusEnum.AgazatReszSzakmaTipus);
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static List<T> GetExtendedDictionaryItems<T>(int tanevId, int generatedAdatszotarTipusEnumIntValue) where T : DictionaryItem
 | 
			
		||||
        {
 | 
			
		||||
            var dictionaryItems = generatedAdatszotarTipusEnumIntValue.GetItemsByType(tanevId);
 | 
			
		||||
            var tDictionaryItems = new List<T>();
 | 
			
		||||
            foreach (var dictionaryItem in dictionaryItems)
 | 
			
		||||
            {
 | 
			
		||||
                tDictionaryItems.Add((T)Activator.CreateInstance(typeof(T), dictionaryItem));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return tDictionaryItems;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,90 @@
 | 
			
		||||
using System.Data;
 | 
			
		||||
using System.IO;
 | 
			
		||||
using Kreta.Core.ConnectionType;
 | 
			
		||||
using Kreta.DataAccessManual;
 | 
			
		||||
using Kreta.Resources;
 | 
			
		||||
using OfficeOpenXml;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.ExcelHelpers
 | 
			
		||||
{
 | 
			
		||||
    public class EslRiportExportHelper : LogicBase
 | 
			
		||||
    {
 | 
			
		||||
        public EslRiportExportHelper(IConnectionType connectionType) : base(connectionType) { }
 | 
			
		||||
 | 
			
		||||
        public MemoryStream GetLemorzsolodasEslRiportExport(int? feladatEllatasiHelyId, bool isFelevi)
 | 
			
		||||
        {
 | 
			
		||||
            DataSet dataSet = Dal.CustomConnection.Run(ConnectionType, h =>
 | 
			
		||||
            {
 | 
			
		||||
                DataSet result = h.AdatszolgaltatasokDAL().GetLemorzsolodasEslRiportExport(IntezmenyId, TanevId, feladatEllatasiHelyId, isFelevi);
 | 
			
		||||
                return result;
 | 
			
		||||
            });
 | 
			
		||||
            var stream = new MemoryStream();
 | 
			
		||||
            if (dataSet.Tables.Count > 0)
 | 
			
		||||
            {
 | 
			
		||||
                DataTable dataTable = dataSet.Tables[0];
 | 
			
		||||
                DataRowCollection dataRowCollection = dataTable.Rows;
 | 
			
		||||
                for (int columnIndex = 0; columnIndex < dataTable.Columns.Count; columnIndex++)
 | 
			
		||||
                {
 | 
			
		||||
                    string columnName = dataTable.Columns[columnIndex].ColumnName;
 | 
			
		||||
 | 
			
		||||
                    if (columnName != "Leírás" && columnName != "Összesen" && columnName != "Lány")
 | 
			
		||||
                    {
 | 
			
		||||
                        for (int rowIndex = 0; rowIndex < dataTable.Rows.Count; rowIndex++)
 | 
			
		||||
                        {
 | 
			
		||||
                            dataRowCollection[rowIndex][columnIndex] = dataRowCollection[rowIndex][columnIndex].ToString().Replace("¤", System.Environment.NewLine);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                using (var excel = new ExcelPackage(stream))
 | 
			
		||||
                {
 | 
			
		||||
                    var workSheet = excel.Workbook.Worksheets.Add(AdatszolgaltatasokResource.ReszletesAdatok);
 | 
			
		||||
                    workSheet.Cells[1, 1].LoadFromDataTable(dataTable, true);
 | 
			
		||||
                    int sectionStartIndex = 2;
 | 
			
		||||
                    string sectioName = dataTable.Rows[0].Field<string>("Leírás");
 | 
			
		||||
                    int lastColumn = dataTable.Columns.Count;
 | 
			
		||||
                    for (int i = 1; i < dataTable.Rows.Count; i++)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (dataTable.Rows[i].Field<string>("Leírás") != sectioName || i == dataTable.Rows.Count - 1)
 | 
			
		||||
                        {
 | 
			
		||||
                            workSheet.Cells[sectionStartIndex, 1, i + 1, 1].Merge = true; //Leírás
 | 
			
		||||
                            workSheet.Cells[i + 1, 1, i + 1, lastColumn].Style.Border.Bottom.Style = OfficeOpenXml.Style.ExcelBorderStyle.Thin;
 | 
			
		||||
                            workSheet.Cells[sectionStartIndex, lastColumn - 1, i + 1, lastColumn - 1].Merge = true; // Összesen db
 | 
			
		||||
                            workSheet.Cells[sectionStartIndex, lastColumn, i + 1, lastColumn].Merge = true; // Lány db
 | 
			
		||||
                            sectionStartIndex = i + 2;
 | 
			
		||||
                            sectioName = dataTable.Rows[i].Field<string>("Leírás");
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    workSheet.View.FreezePanes(2, 2);
 | 
			
		||||
 | 
			
		||||
                    for (int columnIndex = workSheet.Dimension.Start.Column; columnIndex <= workSheet.Dimension.End.Column; columnIndex++)
 | 
			
		||||
                    {
 | 
			
		||||
                        workSheet.Column(columnIndex).Width = 45;
 | 
			
		||||
                        workSheet.Cells[1, columnIndex].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
 | 
			
		||||
 | 
			
		||||
                        for (int rowIndex = workSheet.Dimension.Start.Row; rowIndex <= workSheet.Dimension.End.Row; rowIndex++)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (columnIndex < lastColumn - 1)
 | 
			
		||||
                            {
 | 
			
		||||
                                workSheet.Cells[rowIndex, columnIndex].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
 | 
			
		||||
                                workSheet.Cells[rowIndex, columnIndex].Style.WrapText = true;
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    excel.Save();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                using (var excel = new ExcelPackage(stream))
 | 
			
		||||
                {
 | 
			
		||||
                    var workSheet = excel.Workbook.Worksheets.Add(AdatszolgaltatasokResource.ReszletesAdatok);
 | 
			
		||||
                    excel.Save();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            stream.Position = 0;
 | 
			
		||||
            return stream;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										52
									
								
								Kreta.BusinessLogic/Classes/ExcelHelpers/ExcelDataSource.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								Kreta.BusinessLogic/Classes/ExcelHelpers/ExcelDataSource.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,52 @@
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.ExcelHelpers
 | 
			
		||||
{
 | 
			
		||||
    public class ExcelDataSource
 | 
			
		||||
    {
 | 
			
		||||
        #region Entities
 | 
			
		||||
 | 
			
		||||
        public int? LevelIndex { get; set; }
 | 
			
		||||
        public Dictionary<int, List<Column>> AllMultiLevelColumns { get; set; }
 | 
			
		||||
        public List<Column> Columns;
 | 
			
		||||
        public List<Row> Rows;
 | 
			
		||||
        public ExcelDataSource(int? levelIndex = null)
 | 
			
		||||
        {
 | 
			
		||||
            LevelIndex = levelIndex;
 | 
			
		||||
            Rows = new List<Row>();
 | 
			
		||||
            Columns = new List<Column>();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public class Row
 | 
			
		||||
        {
 | 
			
		||||
            public Row()
 | 
			
		||||
            {
 | 
			
		||||
                Cells = new List<Column>();
 | 
			
		||||
                LevelIDs = new List<int>();
 | 
			
		||||
            }
 | 
			
		||||
            public int ID;
 | 
			
		||||
            public List<Column> Cells;
 | 
			
		||||
            public List<int> LevelIDs { get; set; }
 | 
			
		||||
            public ExcelDataSource ChildDataSource;
 | 
			
		||||
            public List<Column> RowSubItems { get; set; }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public class Column
 | 
			
		||||
        {
 | 
			
		||||
            public int LevelIndex { get; set; }
 | 
			
		||||
            public string Name;
 | 
			
		||||
            public string Value;
 | 
			
		||||
            public ColumnType Type;
 | 
			
		||||
            public ExcelDataSource ComboDataSource;
 | 
			
		||||
        }
 | 
			
		||||
        public enum ColumnType
 | 
			
		||||
        {
 | 
			
		||||
            String,
 | 
			
		||||
            Combo,
 | 
			
		||||
            Checkbox,
 | 
			
		||||
            Formula
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1092
									
								
								Kreta.BusinessLogic/Classes/ExcelHelpers/ExcelExportManager.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1092
									
								
								Kreta.BusinessLogic/Classes/ExcelHelpers/ExcelExportManager.cs
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										2293
									
								
								Kreta.BusinessLogic/Classes/ExcelHelpers/ExcelManager.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2293
									
								
								Kreta.BusinessLogic/Classes/ExcelHelpers/ExcelManager.cs
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										308
									
								
								Kreta.BusinessLogic/Classes/ExcelHelpers/OpenXmlExcelUtils.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										308
									
								
								Kreta.BusinessLogic/Classes/ExcelHelpers/OpenXmlExcelUtils.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,308 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text.RegularExpressions;
 | 
			
		||||
using DocumentFormat.OpenXml;
 | 
			
		||||
using DocumentFormat.OpenXml.Packaging;
 | 
			
		||||
using DocumentFormat.OpenXml.Spreadsheet;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.ExcelHelpers
 | 
			
		||||
{
 | 
			
		||||
    public static class OpenXmlExcelUtils
 | 
			
		||||
    {
 | 
			
		||||
        #region Tulajdonságok
 | 
			
		||||
        public const string ExcelVersion = "0.1";
 | 
			
		||||
        const string VersionNumberReference = "ZZ1";
 | 
			
		||||
 | 
			
		||||
        public static string GetExcelColumnName(int columnNumber)
 | 
			
		||||
        {
 | 
			
		||||
            int dividend = columnNumber + 1;
 | 
			
		||||
            string columnName = string.Empty;
 | 
			
		||||
            int modulo;
 | 
			
		||||
 | 
			
		||||
            while (dividend > 0)
 | 
			
		||||
            {
 | 
			
		||||
                modulo = (dividend - 1) % 26;
 | 
			
		||||
                columnName = Convert.ToChar(65 + modulo).ToString() + columnName;
 | 
			
		||||
                dividend = (int)((dividend - modulo) / 26);
 | 
			
		||||
            }
 | 
			
		||||
            return columnName;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region GetColumnNameIndex
 | 
			
		||||
        public static int GetColumnNameIndex(string column)
 | 
			
		||||
        {
 | 
			
		||||
            int retVal = 0;
 | 
			
		||||
            string col = column.ToUpper();
 | 
			
		||||
            for (int iChar = col.Length - 1; iChar >= 0; iChar--)
 | 
			
		||||
            {
 | 
			
		||||
                char colPiece = col[iChar];
 | 
			
		||||
                int colNum = colPiece - 64;
 | 
			
		||||
                retVal += colNum * (int)Math.Pow(26, col.Length - (iChar + 1));
 | 
			
		||||
            }
 | 
			
		||||
            return retVal;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region GetColumnIndex
 | 
			
		||||
        public static int GetColumnIndex(string reference)
 | 
			
		||||
        {
 | 
			
		||||
            int ci = 0;
 | 
			
		||||
            reference = reference.ToUpper();
 | 
			
		||||
            for (int ix = 0; ix < reference.Length && reference[ix] >= 'A'; ix++)
 | 
			
		||||
            {
 | 
			
		||||
                ci = (ci * 26) + ((int)reference[ix] - 64);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return ci;
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region create cell in worksheet
 | 
			
		||||
        // Given a column name, a row index, and a WorksheetPart, inserts a cell into the worksheet.
 | 
			
		||||
        // If the cell already exists, returns it.
 | 
			
		||||
        // Given a Worksheet and a cell name, verifies that the specified cell exists.
 | 
			
		||||
        // If it does not exist, creates a new cell.
 | 
			
		||||
        public static Cell CreateSpreadsheetCellIfNotExist(Worksheet worksheet, string cellName)
 | 
			
		||||
        {
 | 
			
		||||
            string columnName = GetColumnName(cellName);
 | 
			
		||||
            uint rowIndex = GetRowIndex(cellName);
 | 
			
		||||
 | 
			
		||||
            Cell cell = new Cell();
 | 
			
		||||
            IEnumerable<Row> rows = worksheet.Descendants<Row>().Where(r => r.RowIndex.Value == rowIndex);
 | 
			
		||||
 | 
			
		||||
            // If the Worksheet does not contain the specified row, create the specified row.
 | 
			
		||||
            // Create the specified cell in that row, and insert the row into the Worksheet.
 | 
			
		||||
            if (!rows.Any())
 | 
			
		||||
            {
 | 
			
		||||
                Row row = new Row() { RowIndex = new UInt32Value(rowIndex) };
 | 
			
		||||
                cell = new Cell() { CellReference = new StringValue(cellName) };
 | 
			
		||||
                row.Append(cell);
 | 
			
		||||
                worksheet.Descendants<SheetData>().First().Append(row);
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                Row row = rows.First();
 | 
			
		||||
 | 
			
		||||
                IEnumerable<Cell> cells = row.Elements<Cell>().Where(c => c.CellReference.Value == cellName);
 | 
			
		||||
 | 
			
		||||
                // If the row does not contain the specified cell, create the specified cell.
 | 
			
		||||
                if (!cells.Any())
 | 
			
		||||
                {
 | 
			
		||||
                    cell = new Cell() { CellReference = new StringValue(cellName) };
 | 
			
		||||
                    row.Append(cell);
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return cell;
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region InsertSharedStringItem
 | 
			
		||||
        // Given text and a SharedStringTablePart, creates a SharedStringItem with the specified text
 | 
			
		||||
        // and inserts it into the SharedStringTablePart. If the item already exists, returns its index.
 | 
			
		||||
        public static int InsertSharedStringItem(string text, SharedStringTablePart shareStringPart)
 | 
			
		||||
        {
 | 
			
		||||
            // If the part does not contain a SharedStringTable, create one.
 | 
			
		||||
            if (shareStringPart.SharedStringTable == null)
 | 
			
		||||
            {
 | 
			
		||||
                shareStringPart.SharedStringTable = new SharedStringTable();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            int i = 0;
 | 
			
		||||
 | 
			
		||||
            // Iterate through all the items in the SharedStringTable. If the text already exists, return its index.
 | 
			
		||||
            foreach (SharedStringItem item in shareStringPart.SharedStringTable.Elements<SharedStringItem>())
 | 
			
		||||
            {
 | 
			
		||||
                if (item.InnerText == text)
 | 
			
		||||
                {
 | 
			
		||||
                    return i;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                i++;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // The text does not exist in the part. Create the SharedStringItem and return its index.
 | 
			
		||||
            shareStringPart.SharedStringTable.AppendChild(new SharedStringItem(new DocumentFormat.OpenXml.Spreadsheet.Text(text)));
 | 
			
		||||
            shareStringPart.SharedStringTable.Save();
 | 
			
		||||
 | 
			
		||||
            return i;
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region GetColumnName
 | 
			
		||||
        // Given a cell name, parses the specified cell to get the column name.
 | 
			
		||||
        public static string GetColumnName(string cellName)
 | 
			
		||||
        {
 | 
			
		||||
            // Create a regular expression to match the column name portion of the cell name.
 | 
			
		||||
            Regex regex = new Regex("[A-Za-z]+");
 | 
			
		||||
            Match match = regex.Match(cellName);
 | 
			
		||||
 | 
			
		||||
            return match.Value;
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region GetRowIndex
 | 
			
		||||
        // Given a cell name, parses the specified cell to get the row index.
 | 
			
		||||
        public static uint GetRowIndex(string cellName)
 | 
			
		||||
        {
 | 
			
		||||
            // Create a regular expression to match the row index portion the cell name.
 | 
			
		||||
            Regex regex = new Regex(@"\d+");
 | 
			
		||||
            Match match = regex.Match(cellName);
 | 
			
		||||
 | 
			
		||||
            return uint.Parse(match.Value);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region GetCell
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Visszaadja oszlop nev es sor index alapjan az adott cellat.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="worksheet"></param>
 | 
			
		||||
        /// <param name="columnName"></param>
 | 
			
		||||
        /// <param name="rowIndex"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public static Cell GetCell(Worksheet worksheet,
 | 
			
		||||
                  string columnName, uint rowIndex)
 | 
			
		||||
        {
 | 
			
		||||
            Row row = GetRow(worksheet, rowIndex);
 | 
			
		||||
 | 
			
		||||
            if (row == null)
 | 
			
		||||
            {
 | 
			
		||||
                return null;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            IEnumerable<Cell> cells = row.Elements<Cell>().Where(c => string.Compare
 | 
			
		||||
(c.CellReference.Value, columnName +
 | 
			
		||||
                   rowIndex, StringComparison.OrdinalIgnoreCase) == 0);
 | 
			
		||||
            return !cells.Any() ? null : cells.First();
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region GetCellValue
 | 
			
		||||
        public static string GetCellValue(Worksheet worksheet, SharedStringTable table, string reference)
 | 
			
		||||
        {
 | 
			
		||||
            var cell = worksheet.Descendants<Cell>().Where(c => string.Compare(c.CellReference.Value, reference, StringComparison.OrdinalIgnoreCase) == 0).FirstOrDefault();
 | 
			
		||||
            if (cell == null)
 | 
			
		||||
            {
 | 
			
		||||
                return null;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return cell.DataType == CellValues.SharedString ? table.ElementAt(int.Parse(cell.InnerText)).InnerText : cell.InnerText;
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region GetRow
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Visszaadja a sor indexe alapjan az adott sor referenciajat.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="worksheet"></param>
 | 
			
		||||
        /// <param name="rowIndex"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public static Row GetRow(Worksheet worksheet, uint rowIndex)
 | 
			
		||||
        {
 | 
			
		||||
            IEnumerable<Row> myRows = worksheet.GetFirstChild<SheetData>().
 | 
			
		||||
              Elements<Row>().Where(r => r.RowIndex == rowIndex);
 | 
			
		||||
            return !myRows.Any() ? null : myRows.First();
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region GetCellValue2
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Visszaadja a cella alapjan a hozza tartozo erteket a sharedstring tablabol.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="table"></param>
 | 
			
		||||
        /// <param name="cell"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public static string GetCellValue(SharedStringTable table, Cell cell)
 | 
			
		||||
        {
 | 
			
		||||
            int index = -1;
 | 
			
		||||
            if (cell.CellValue == null)
 | 
			
		||||
            {
 | 
			
		||||
                return "";
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (cell.DataType != null && cell.DataType == CellValues.SharedString && int.TryParse(cell.CellValue.Text, out index))
 | 
			
		||||
            {
 | 
			
		||||
                return table.Elements<SharedStringItem>().ElementAt(index).InnerText;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return cell.CellValue.InnerText;
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region SetColumns
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// beallitja az oszlopokat, elso korben a bestfitet.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public static void SetColumns(Worksheet sheet, int colindex, double maxcolcharacter, bool hidden)
 | 
			
		||||
        {
 | 
			
		||||
            // ha nem letezik hozza oszlopok tulajdonsag
 | 
			
		||||
            Columns cols;
 | 
			
		||||
            if (!sheet.Descendants<Columns>().Any())
 | 
			
		||||
            {
 | 
			
		||||
                cols = new Columns();
 | 
			
		||||
                sheet.Append(cols);
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                cols = sheet.Descendants<Columns>().First();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // oszlop letrehozasa, ahol elrejtjuk a validacios listat
 | 
			
		||||
            double maxcolwidth = Math.Truncate(((maxcolcharacter * 7 + 5) / 7 * 256) / 256) + 2;
 | 
			
		||||
            var col = new Column
 | 
			
		||||
            {
 | 
			
		||||
                Min = new UInt32Value((uint)colindex),
 | 
			
		||||
                Max = new UInt32Value((uint)colindex),
 | 
			
		||||
                Width = new DoubleValue(maxcolwidth),
 | 
			
		||||
                Hidden = new BooleanValue(hidden),
 | 
			
		||||
                BestFit = new BooleanValue(true),
 | 
			
		||||
                CustomWidth = new BooleanValue(true)
 | 
			
		||||
            };
 | 
			
		||||
            cols.Append(col);
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region Excel columns count
 | 
			
		||||
        public static int GetColumnCount(Worksheet sheet)
 | 
			
		||||
        {
 | 
			
		||||
            var row = sheet.Descendants<Row>().FirstOrDefault();
 | 
			
		||||
            return row != null ? row.Descendants<Cell>().Count() : 0;
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region SetVersion
 | 
			
		||||
        public static void SetVersion(Worksheet sheet, string versionNumber)
 | 
			
		||||
        {
 | 
			
		||||
            // verzió
 | 
			
		||||
            // uj cella
 | 
			
		||||
            Cell newVersionCell = CreateSpreadsheetCellIfNotExist(sheet, VersionNumberReference);
 | 
			
		||||
            // majd index alapjan referenciat adok ra
 | 
			
		||||
            var version = !string.IsNullOrWhiteSpace(versionNumber) ? versionNumber : ExcelVersion;
 | 
			
		||||
            newVersionCell.CellValue = new CellValue(version);
 | 
			
		||||
            // ez bizony egy sharedstring tipus
 | 
			
		||||
            newVersionCell.DataType = new EnumValue<CellValues>(CellValues.String);
 | 
			
		||||
 | 
			
		||||
            SetColumns(sheet, GetColumnIndex(VersionNumberReference), 0, true);
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region Checkversion
 | 
			
		||||
        public static bool CheckVersion(Worksheet sheet, SharedStringTable table, string versionNumber)
 | 
			
		||||
        {
 | 
			
		||||
            var excelVersion = GetCellValue(sheet, table, VersionNumberReference);
 | 
			
		||||
 | 
			
		||||
            return versionNumber.Equals(excelVersion);
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										948
									
								
								Kreta.BusinessLogic/Classes/ExcelHelpers/TTFExportHelper.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										948
									
								
								Kreta.BusinessLogic/Classes/ExcelHelpers/TTFExportHelper.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,948 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Data;
 | 
			
		||||
using System.Drawing;
 | 
			
		||||
using System.Globalization;
 | 
			
		||||
using System.IO;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using Kreta.BusinessLogic.Helpers;
 | 
			
		||||
using Kreta.Core;
 | 
			
		||||
using Kreta.Core.ConnectionType;
 | 
			
		||||
using Kreta.Resources;
 | 
			
		||||
using OfficeOpenXml;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.ExcelHelpers
 | 
			
		||||
{
 | 
			
		||||
    public class TTFExportHelper : LogicBase
 | 
			
		||||
    {
 | 
			
		||||
        public TTFExportHelper(IConnectionType connectionType) : base(connectionType) { }
 | 
			
		||||
 | 
			
		||||
        public MemoryStream ExportEgyszeruTTF()
 | 
			
		||||
        {
 | 
			
		||||
            return ExportEgyszeruTTF(null, null, null, null, null, null, null, null, null, null, false, false, false);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public MemoryStream ExportEgyszeruTTF(int? tanarId, int? csoportId, int? tantargyId, int? targyKatId, int? foglalkozasTipusId,
 | 
			
		||||
            int? feladatKategoriaId, int? feladatellatasiHelyId, int? evfolyamId, double? oraszam, bool? isImportalt, bool osztalybontasokkal, bool kapcsolodoCsoportokkal, bool isFromSzervezet)
 | 
			
		||||
        {
 | 
			
		||||
            var manager = new ExcelExportManager();
 | 
			
		||||
            var exportFile = new ExcelExportItem();
 | 
			
		||||
 | 
			
		||||
            exportFile.AddColumn((int)EgyszeruTtfExportColumns.Osztaly, ImportExportTantargyfelosztasResource.ImportHeaderNameOsztaly);
 | 
			
		||||
            exportFile.AddColumn((int)EgyszeruTtfExportColumns.Csoport, ImportExportTantargyfelosztasResource.ImportHeaderNameCsoport);
 | 
			
		||||
            exportFile.AddColumn((int)EgyszeruTtfExportColumns.Tantargy, ImportExportTantargyfelosztasResource.ImportHeaderNameTantargy);
 | 
			
		||||
            exportFile.AddColumn((int)EgyszeruTtfExportColumns.Oraszam, ImportExportTantargyfelosztasResource.ImportHeaderNameOraszam);
 | 
			
		||||
            exportFile.AddColumn((int)EgyszeruTtfExportColumns.Tanar, ImportExportTantargyfelosztasResource.ImportHeaderNameTanar);
 | 
			
		||||
            exportFile.AddColumn((int)EgyszeruTtfExportColumns.Tuloraszam, ImportExportTantargyfelosztasResource.ImportHeaderNameTulora);
 | 
			
		||||
            exportFile.AddColumn((int)EgyszeruTtfExportColumns.IsOsszevontOra, ImportExportTantargyfelosztasResource.ImportHeaderNameTtfOraszamKorrekcio);
 | 
			
		||||
            exportFile.AddColumn((int)EgyszeruTtfExportColumns.IsNemzetisegiOra, ImportExportTantargyfelosztasResource.ImportHeaderNameNemzetisegiOra);
 | 
			
		||||
            exportFile.AddColumn((int)EgyszeruTtfExportColumns.MegbizasiOraszam, ImportExportTantargyfelosztasResource.ImportHeaderNameMegbizasiOraszam);
 | 
			
		||||
 | 
			
		||||
            var helper = new TantargyFelosztasHelper(ConnectionType);
 | 
			
		||||
            var tantargyIds = tantargyId.HasValue ? new List<int> { tantargyId.Value } : null;
 | 
			
		||||
            var ds = helper.GetTantargyFelosztasData(tanarId, csoportId, tantargyIds, targyKatId, foglalkozasTipusId, feladatKategoriaId, feladatellatasiHelyId, evfolyamId, oraszam, isImportalt, osztalybontasokkal, kapcsolodoCsoportokkal, isFromSzervezet);
 | 
			
		||||
            var rowIndex = 2;
 | 
			
		||||
 | 
			
		||||
            //NOTE: Erre azért van szükség, ha több egyforma nevű tanár szerepel az adatbázisban, akkor zárójelben mögé tesszük a születési dátumát az export-ban, hogy meg tudjuk őket különböztetni!
 | 
			
		||||
            var tanarDictionary = new Dictionary<string, List<DateTime>>();
 | 
			
		||||
            foreach (var item in ds.Tables[0].AsEnumerable())
 | 
			
		||||
            {
 | 
			
		||||
                var tanarNev = item.Field<string>("Tanar");
 | 
			
		||||
                var tanarSzuletesiIdo = item.Field<DateTime>("TanarSzuletesiIdo");
 | 
			
		||||
                if (tanarDictionary.ContainsKey(tanarNev))
 | 
			
		||||
                {
 | 
			
		||||
                    if (!tanarDictionary[tanarNev].Contains(tanarSzuletesiIdo))
 | 
			
		||||
                    {
 | 
			
		||||
                        tanarDictionary[tanarNev].Add(tanarSzuletesiIdo);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    tanarDictionary.Add(tanarNev, new List<DateTime> { tanarSzuletesiIdo });
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            foreach (var item in ds.Tables[0].AsEnumerable())
 | 
			
		||||
            {
 | 
			
		||||
                if (SDAConvert.ToBoolean(item.Field<string>("IsOsztaly"), false))
 | 
			
		||||
                {
 | 
			
		||||
                    exportFile.AddCell(rowIndex, (int)EgyszeruTtfExportColumns.Osztaly, item.Field<string>("OsztalyCsoport"));
 | 
			
		||||
                    exportFile.AddCell(rowIndex, (int)EgyszeruTtfExportColumns.Csoport, string.Empty);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    exportFile.AddCell(rowIndex, (int)EgyszeruTtfExportColumns.Csoport, item.Field<string>("OsztalyCsoport"));
 | 
			
		||||
                    exportFile.AddCell(rowIndex, (int)EgyszeruTtfExportColumns.Osztaly, SDAConvert.ToBoolean(item.Field<string>("IsOsztalyBontottCsoport"), false) ? item.Field<string>("OsztalyBontottCsoportNev") : string.Empty);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                exportFile.AddCell(rowIndex, (int)EgyszeruTtfExportColumns.Tantargy, item.Field<string>("Tantargy"));
 | 
			
		||||
                exportFile.AddCell(rowIndex, (int)EgyszeruTtfExportColumns.Oraszam, item.Field<decimal>("Oraszam").ToString(), formatID: 4U);
 | 
			
		||||
 | 
			
		||||
                //NOTE: Erre azért van szükség, ha több egyforma nevű tanár szerepel az adatbázisban, akkor zárójelben mögé tesszük a születési dátumát az export-ban, hogy meg tudjuk őket különböztetni!
 | 
			
		||||
                var tanarNev = item.Field<string>("Tanar");
 | 
			
		||||
                var tanarSzuletesiIdo = item.Field<DateTime>("TanarSzuletesiIdo");
 | 
			
		||||
                if (tanarDictionary[tanarNev].Count > 1)
 | 
			
		||||
                {
 | 
			
		||||
                    var tanarSzuletesiIdoString = tanarSzuletesiIdo.ToString(Constants.ToStringPattern.HungarianDate);
 | 
			
		||||
                    tanarNev += $" ({tanarSzuletesiIdoString})";
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                exportFile.AddCell(rowIndex, (int)EgyszeruTtfExportColumns.Tanar, tanarNev);
 | 
			
		||||
                exportFile.AddCell(rowIndex, (int)EgyszeruTtfExportColumns.Tuloraszam, item.Field<decimal>("TuloraSzam").ToString());
 | 
			
		||||
                exportFile.AddCell(rowIndex, (int)EgyszeruTtfExportColumns.IsOsszevontOra, item.Field<string>("OsszevontOra").ToBool().GetDisplayName());
 | 
			
		||||
                exportFile.AddCell(rowIndex, (int)EgyszeruTtfExportColumns.IsNemzetisegiOra, item.Field<string>("NemzetisegiOra").ToBool().GetDisplayName());
 | 
			
		||||
                exportFile.AddCell(rowIndex, (int)EgyszeruTtfExportColumns.MegbizasiOraszam, item.Field<decimal>("MegbizasiOraszam").ToString());
 | 
			
		||||
 | 
			
		||||
                rowIndex++;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return manager.CreateExcelExport(new List<ExcelExportItem> { exportFile });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public MemoryStream ExportLepedoTTF()
 | 
			
		||||
        {
 | 
			
		||||
            return ExportLepedoTTF(null, null, null, null, null, null, null, null, null, null, false, false, false);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public MemoryStream ExportLepedoOsztalyTTF()
 | 
			
		||||
        {
 | 
			
		||||
            return ExportLepedoOsztalyTTF(null, null, null, null, null, null, null, null, null, null, false, false, false);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public MemoryStream ExportLepedoTTF(int? tanarId, int? csoportId, int? tantargyId, int? targyKatId, int? foglalkozasTipusId,
 | 
			
		||||
            int? feladatKategoriaId, int? feladatellatasiHelyId, int? evfolyamId, double? oraszam, bool? isImportalt, bool osztalybontasokkal, bool kapcsolodoCsoportokkal, bool isFromSzervezet)
 | 
			
		||||
        {
 | 
			
		||||
            var manager = new ExcelExportManager();
 | 
			
		||||
            var exportFile = new ExcelExportItem();
 | 
			
		||||
 | 
			
		||||
            var helper = new TantargyFelosztasHelper(ConnectionType);
 | 
			
		||||
            var thelper = new TanarHelper(ConnectionType);
 | 
			
		||||
 | 
			
		||||
            var ds = helper.GetTTFToExport(tanarId, csoportId, tantargyId, targyKatId, foglalkozasTipusId, feladatKategoriaId, feladatellatasiHelyId, evfolyamId, oraszam, isImportalt, osztalybontasokkal, kapcsolodoCsoportokkal, isFromSzervezet);
 | 
			
		||||
            var grouped = ds.Tables[0].AsEnumerable().GroupBy(t => new
 | 
			
		||||
            {
 | 
			
		||||
                Osztaly = t.Field<string>("Osztaly"),
 | 
			
		||||
                Csoport = t.Field<string>("CsoportNev"),
 | 
			
		||||
                Tantargy = t.Field<string>("Tantargy"),
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            //NOTE: Erre azért van szükség, ha több egyforma nevű tanár szerepel az adatbázisban, akkor zárójelben mögé tesszük a születési dátumát az export-ban, hogy meg tudjuk őket különböztetni!
 | 
			
		||||
            var tanarDictionary = new Dictionary<string, List<DateTime>>();
 | 
			
		||||
            foreach (var item in ds.Tables[0].AsEnumerable())
 | 
			
		||||
            {
 | 
			
		||||
                var tanarNev = item.Field<string>("Tanar");
 | 
			
		||||
                var tanarSzuletesiIdo = item.Field<DateTime>("TanarSzuletesiIdo");
 | 
			
		||||
                if (tanarDictionary.ContainsKey(tanarNev))
 | 
			
		||||
                {
 | 
			
		||||
                    if (!tanarDictionary[tanarNev].Contains(tanarSzuletesiIdo))
 | 
			
		||||
                    {
 | 
			
		||||
                        tanarDictionary[tanarNev].Add(tanarSzuletesiIdo);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    tanarDictionary.Add(tanarNev, new List<DateTime> { tanarSzuletesiIdo });
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var tanarExcelColumnsDictionary = new Dictionary<string, int>();
 | 
			
		||||
            var column = 4; // Alap default oszlopok száma, ez után jönnek a tanárok
 | 
			
		||||
            foreach (var item in ds.Tables[0].AsEnumerable())
 | 
			
		||||
            {
 | 
			
		||||
                //NOTE: Erre azért van szükség, ha több egyforma nevű tanár szerepel az adatbázisban, akkor zárójelben mögé tesszük a születési dátumát az export-ban, hogy meg tudjuk őket különböztetni!
 | 
			
		||||
                var tanarNev = item.Field<string>("Tanar");
 | 
			
		||||
                var tanarSzuletesiIdo = item.Field<DateTime>("TanarSzuletesiIdo");
 | 
			
		||||
                if (tanarDictionary[tanarNev].Count > 1)
 | 
			
		||||
                {
 | 
			
		||||
                    var tanarSzuletesiIdoString = tanarSzuletesiIdo.ToString(Constants.ToStringPattern.HungarianDate);
 | 
			
		||||
                    tanarNev += $" ({tanarSzuletesiIdoString})";
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (!tanarExcelColumnsDictionary.ContainsKey(tanarNev))
 | 
			
		||||
                {
 | 
			
		||||
                    tanarExcelColumnsDictionary.Add(tanarNev, column);
 | 
			
		||||
                    column++;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            //Kérésre a ttf-ben nem szereplő tanárokat is hozzá adjuk a listához
 | 
			
		||||
            var osszestanar = thelper.GetAlkalmazottNevek(false, isFromSzervezet);
 | 
			
		||||
            osszestanar.Remove(string.Empty);
 | 
			
		||||
            foreach (var tanar in osszestanar)
 | 
			
		||||
            {
 | 
			
		||||
                if (!tanarExcelColumnsDictionary.Keys.Contains(tanar.Value))
 | 
			
		||||
                {
 | 
			
		||||
                    tanarExcelColumnsDictionary.Add(tanar.Value, column);
 | 
			
		||||
                    column++;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            PrePareTtfExportDocument(exportFile, tanarExcelColumnsDictionary, grouped.Count());
 | 
			
		||||
            var sor = 3;
 | 
			
		||||
            foreach (var item in grouped)
 | 
			
		||||
            {
 | 
			
		||||
                exportFile.AddCell(sor, (int)TtfExportColumns.Osztaly, item.Key.Osztaly);
 | 
			
		||||
                exportFile.AddCell(sor, (int)TtfExportColumns.Csoport, item.Key.Csoport);
 | 
			
		||||
                exportFile.AddCell(sor, (int)TtfExportColumns.Tantargy, item.Key.Tantargy);
 | 
			
		||||
                exportFile.AddCell(sor, (int)TtfExportColumns.Osszes, string.Empty, string.Format("SUM({0}{1}:{2}{1})", GetExcelColumnName((int)TtfExportColumns.Osszes + 2), sor, GetExcelColumnName((int)TtfExportColumns.Osszes + 1 + tanarExcelColumnsDictionary.Count)), formatID: 3U);
 | 
			
		||||
                foreach (var rowdata in item.ToList())
 | 
			
		||||
                {
 | 
			
		||||
                    //NOTE: Erre azért van szükség, ha több egyforma nevű tanár szerepel az adatbázisban, akkor zárójelben mögé tesszük a születési dátumát az export-ban, hogy meg tudjuk őket különböztetni!
 | 
			
		||||
                    var tanarNev = rowdata.Field<string>("Tanar");
 | 
			
		||||
                    var tanarSzuletesiIdo = rowdata.Field<DateTime>("TanarSzuletesiIdo");
 | 
			
		||||
                    if (tanarDictionary[tanarNev].Count > 1)
 | 
			
		||||
                    {
 | 
			
		||||
                        var tanarSzuletesiIdoString = tanarSzuletesiIdo.ToString(Constants.ToStringPattern.HungarianDate);
 | 
			
		||||
                        tanarNev += $" ({tanarSzuletesiIdoString})";
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    exportFile.AddCell(sor, tanarExcelColumnsDictionary[tanarNev], Convert.ToDecimal(rowdata["Oraszam"], CultureInfo.InvariantCulture), valuetype: DocumentFormat.OpenXml.Spreadsheet.CellValues.Number, formatID: 4U);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                sor++;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return manager.CreateExcelExport(new List<ExcelExportItem> { exportFile });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public MemoryStream ExportLepedoOsztalyTTF(int? tanarId, int? csoportId, int? tantargyId, int? targyKatId, int? foglalkozasTipusId, int? feladatKategoriaId, int? feladatellatasiHelyId, int? evfolyamId, double? oraszam, bool? isImportalt, bool osztalybontasokkal, bool kapcsolodoCsoportokkal, bool isFromSzervezet)
 | 
			
		||||
        {
 | 
			
		||||
            var manager = new ExcelExportManager();
 | 
			
		||||
            var exportFile = new ExcelExportItem();
 | 
			
		||||
 | 
			
		||||
            var helper = new TantargyFelosztasHelper(ConnectionType);
 | 
			
		||||
            var thelper = new TanarHelper(ConnectionType);
 | 
			
		||||
 | 
			
		||||
            var ds = helper.GetTTFToExport(tanarId, csoportId, tantargyId, targyKatId, foglalkozasTipusId, feladatKategoriaId, feladatellatasiHelyId, evfolyamId, oraszam, isImportalt, osztalybontasokkal, kapcsolodoCsoportokkal, isFromSzervezet);
 | 
			
		||||
 | 
			
		||||
            var azonosNevuek = ds.Tables[0].AsEnumerable().Select(x => new
 | 
			
		||||
            {
 | 
			
		||||
                Tanar = x.Field<string>("Tanar"),
 | 
			
		||||
                SzuletesiIdo = x.Field<DateTime>("TanarSzuletesiIdo").ToString(Constants.ToStringPattern.HungarianDate),
 | 
			
		||||
            }).Distinct().GroupBy(t => t.Tanar).Select(group => new
 | 
			
		||||
            {
 | 
			
		||||
                Tanar = group.Key,
 | 
			
		||||
                Count = group.Count()
 | 
			
		||||
            }).Where(x => x.Count > 1).Select(x => x.Tanar).ToList();
 | 
			
		||||
 | 
			
		||||
            var grouped = ds.Tables[0].AsEnumerable().GroupBy(t => new
 | 
			
		||||
            {
 | 
			
		||||
                Tanar = t.Field<string>("Tanar"),
 | 
			
		||||
                SzuletesiIdo = t.Field<DateTime>("TanarSzuletesiIdo").ToString(Constants.ToStringPattern.HungarianDate),
 | 
			
		||||
                Tantargy = t.Field<string>("Tantargy"),
 | 
			
		||||
            }).ToList();
 | 
			
		||||
 | 
			
		||||
            var osszestanar = thelper.GetTanarNevSzuletesiDatumok(isFromSzervezet);
 | 
			
		||||
            foreach (var tanar in osszestanar)
 | 
			
		||||
            {
 | 
			
		||||
                if (!grouped.Any(a => a.Key.Tanar == tanar.Value.Tanar && a.Key.SzuletesiIdo == tanar.Value.SzuletesiDatum.ToString(Constants.ToStringPattern.HungarianDate)))
 | 
			
		||||
                {
 | 
			
		||||
                    var tanarNincsTTFben = new[] { ds.Tables[0].NewRow() }.GroupBy(val => new { Tanar = tanar.Value.Tanar, SzuletesiIdo = tanar.Value.SzuletesiDatum.ToString(Constants.ToStringPattern.HungarianDate), Tantargy = "" }).First();
 | 
			
		||||
                    grouped.Add(tanarNincsTTFben);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var osztalyCsoportExcelColumnsDictionary = new List<(string osztaly, string csoport, int columnIndex)>();
 | 
			
		||||
            var column = 3; // Alap default oszlopok száma, ez után jönnek az osztálycsoportok
 | 
			
		||||
            foreach (var item in ds.Tables[0].AsEnumerable())
 | 
			
		||||
            {
 | 
			
		||||
                var osztalyNev = item.Field<string>("Osztaly") ?? "";
 | 
			
		||||
                var csoportNev = item.Field<string>("CsoportNev") ?? "";
 | 
			
		||||
                if (string.IsNullOrWhiteSpace(osztalyNev) && string.IsNullOrWhiteSpace(csoportNev))
 | 
			
		||||
                {
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
                if (osztalyCsoportExcelColumnsDictionary.SingleOrDefault(x => x.osztaly == osztalyNev && x.csoport == csoportNev) == default)
 | 
			
		||||
                {
 | 
			
		||||
                    osztalyCsoportExcelColumnsDictionary.Add((osztalyNev, csoportNev, column));
 | 
			
		||||
                    column++;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            PrepareOsztalyTtfExportDocument(exportFile, osztalyCsoportExcelColumnsDictionary, grouped.Count);
 | 
			
		||||
            var sor = 4;
 | 
			
		||||
            var sumLastColumn = osztalyCsoportExcelColumnsDictionary.Count != 0 ? (int)TtfExportOsztalyokColumns.Osszes + 1 + osztalyCsoportExcelColumnsDictionary.Count : (int)TtfExportOsztalyokColumns.Osszes + 2;
 | 
			
		||||
            foreach (var item in grouped)
 | 
			
		||||
            {
 | 
			
		||||
                var szulDatum = azonosNevuek.Contains(item.Key.Tanar) ? $" ({item.Key.SzuletesiIdo})" : "";
 | 
			
		||||
                exportFile.AddCell(sor, (int)TtfExportOsztalyokColumns.Tanar, item.Key.Tanar + szulDatum);
 | 
			
		||||
                exportFile.AddCell(sor, (int)TtfExportOsztalyokColumns.Tantargy, item.Key.Tantargy);
 | 
			
		||||
                exportFile.AddCell(sor, (int)TtfExportOsztalyokColumns.Osszes, string.Empty, string.Format("SUM({0}{1}:{2}{1})", GetExcelColumnName((int)TtfExportOsztalyokColumns.Osszes + 2), sor, GetExcelColumnName(sumLastColumn)), formatID: 3U);
 | 
			
		||||
                foreach (var rowdata in item.ToList())
 | 
			
		||||
                {
 | 
			
		||||
                    var osztalyNev = rowdata.Field<string>("Osztaly") ?? "";
 | 
			
		||||
                    var csoportNev = rowdata.Field<string>("CsoportNev") ?? "";
 | 
			
		||||
                    var key = (!string.IsNullOrWhiteSpace(osztalyNev) ? osztalyNev : "") + (!string.IsNullOrWhiteSpace(osztalyNev) && !string.IsNullOrWhiteSpace(csoportNev) ? " - " : "") + (!string.IsNullOrWhiteSpace(csoportNev) ? csoportNev : "");
 | 
			
		||||
                    if (string.IsNullOrWhiteSpace(key))
 | 
			
		||||
                    {
 | 
			
		||||
                        continue;
 | 
			
		||||
                    }
 | 
			
		||||
                    exportFile.AddCell(sor, osztalyCsoportExcelColumnsDictionary.Single(x => x.osztaly == osztalyNev && x.csoport == csoportNev).columnIndex, SDAConvert.ToDecimal(rowdata["Oraszam"]), valuetype: DocumentFormat.OpenXml.Spreadsheet.CellValues.Number, formatID: 4U);
 | 
			
		||||
                }
 | 
			
		||||
                sor++;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return manager.CreateExcelExport(new List<ExcelExportItem> { exportFile });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #region Formázott TTF export
 | 
			
		||||
 | 
			
		||||
        public MemoryStream ExportFormazottTtf(int formatMode)
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                var helper = new TantargyFelosztasHelper(ConnectionType);
 | 
			
		||||
                using (var result = new MemoryStream())
 | 
			
		||||
                {
 | 
			
		||||
                    var ds = helper.GetFormazottTTFExport(formatMode);
 | 
			
		||||
 | 
			
		||||
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0 &&
 | 
			
		||||
                        ds.Tables[1] != null && ds.Tables[1].Rows.Count > 0 &&
 | 
			
		||||
                        (ds.Tables[2] != null && ds.Tables[2].Rows.Count > 0 || ds.Tables[3] != null && ds.Tables[3].Rows.Count > 0))
 | 
			
		||||
                    {
 | 
			
		||||
                        var excelPackage = new ExcelPackage(result);
 | 
			
		||||
                        ExcelWorksheet ws0 = excelPackage.Workbook.Worksheets.Add("TTF");
 | 
			
		||||
                        ws0.Cells["A1"].LoadFromDataTable(ds.Tables[0], true);
 | 
			
		||||
 | 
			
		||||
                        ExcelWorksheet ws1 = excelPackage.Workbook.Worksheets.Add("TTFX");
 | 
			
		||||
                        ws1.Cells["A1"].LoadFromDataTable(ds.Tables[1], true);
 | 
			
		||||
 | 
			
		||||
                        ExcelWorksheet ws2 = excelPackage.Workbook.Worksheets.Add("O");
 | 
			
		||||
                        ws2.Cells["A1"].LoadFromDataTable(ds.Tables[2], true);
 | 
			
		||||
 | 
			
		||||
                        ExcelWorksheet ws3 = excelPackage.Workbook.Worksheets.Add("CS");
 | 
			
		||||
                        ws3.Cells["A1"].LoadFromDataTable(ds.Tables[3], true);
 | 
			
		||||
 | 
			
		||||
                        return ConvertExcel(new MemoryStream(excelPackage.GetAsByteArray()));
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    return null;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                throw new Exception(ex.Message);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [Obsolete("Ezt ne használjátok, át kell írni!")]
 | 
			
		||||
        public static MemoryStream ConvertExcel(MemoryStream OriginalStream)
 | 
			
		||||
        {
 | 
			
		||||
            var excelPackage = new ExcelPackage(OriginalStream);
 | 
			
		||||
 | 
			
		||||
            #region ColorSetup
 | 
			
		||||
 | 
			
		||||
            Color colorKretaBlue = Color.FromArgb(33, 167, 202);
 | 
			
		||||
 | 
			
		||||
            Color colorLightKretaBlue = Color.FromArgb(67, 215, 254);
 | 
			
		||||
 | 
			
		||||
            Color colorDarkKretaBlue = Color.FromArgb(10, 102, 105);
 | 
			
		||||
 | 
			
		||||
            Color colorKretaOrange = Color.FromArgb(224, 82, 48);
 | 
			
		||||
 | 
			
		||||
            Color colorKretaOrange2 = Color.FromArgb(236, 134, 39);
 | 
			
		||||
 | 
			
		||||
            Color colorKretaOrange3 = Color.FromArgb(247, 185, 28);
 | 
			
		||||
 | 
			
		||||
            #endregion
 | 
			
		||||
 | 
			
		||||
            #region Initialization
 | 
			
		||||
 | 
			
		||||
            ExcelWorksheet Result = excelPackage.Workbook.Worksheets[1];
 | 
			
		||||
            ExcelWorksheet TTF = excelPackage.Workbook.Worksheets[2];
 | 
			
		||||
            ExcelWorksheet Osztalyok = excelPackage.Workbook.Worksheets[3];
 | 
			
		||||
            ExcelWorksheet Csoportok = excelPackage.Workbook.Worksheets[4];
 | 
			
		||||
 | 
			
		||||
            Dictionary<string, int> OsztalyokList = new Dictionary<string, int>();
 | 
			
		||||
            Dictionary<string, int> CsoportokList = new Dictionary<string, int>();
 | 
			
		||||
            Dictionary<int, string> TTFList = new Dictionary<int, string>();
 | 
			
		||||
 | 
			
		||||
            #endregion
 | 
			
		||||
 | 
			
		||||
            #region Osztály és csoportoszlopok elkészítése
 | 
			
		||||
 | 
			
		||||
            bool IsOsztaly = true;
 | 
			
		||||
            bool IsCsoport = true;
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                for (int i = 2; i <= Osztalyok.Dimension.End.Row; i++)
 | 
			
		||||
                {
 | 
			
		||||
                    Result.Cells[1, 6 + i].Value = Osztalyok.Cells[i, 1].Value;
 | 
			
		||||
                    OsztalyokList.Add(Osztalyok.Cells[i, 1].Value.ToString(), 6 + i);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                Result.Cells[1, Result.Dimension.End.Column + 1].Value = "Összesen (osztályok)";
 | 
			
		||||
            }
 | 
			
		||||
            catch
 | 
			
		||||
            {
 | 
			
		||||
                IsOsztaly = false;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            int startcolumn = Result.Dimension.End.Column;
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                for (int i = 2, j = 1; i <= Csoportok.Dimension.End.Row; i++)
 | 
			
		||||
                {
 | 
			
		||||
                    if (Csoportok.Cells[i, 2].Value == null)
 | 
			
		||||
                    {
 | 
			
		||||
                        Result.Cells[1, startcolumn + j].Value = Csoportok.Cells[i, 1].Value;
 | 
			
		||||
                        CsoportokList.Add(Csoportok.Cells[i, 1].Value.ToString(), startcolumn + j);
 | 
			
		||||
                        j++;
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        CsoportokList.Add(Csoportok.Cells[i, 1].Value.ToString(), OsztalyokList.Where(x => x.Key.ToString() == Csoportok.Cells[i, 2].Value.ToString()).Single().Value);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                Result.Cells[1, Result.Dimension.End.Column + 1].Value = "Összesen (csoportok)";
 | 
			
		||||
            }
 | 
			
		||||
            catch
 | 
			
		||||
            {
 | 
			
		||||
                IsCsoport = false;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            #endregion
 | 
			
		||||
 | 
			
		||||
            #region Óraszámok betétele
 | 
			
		||||
 | 
			
		||||
            for (int i = 2; i <= Result.Dimension.End.Row; i++)
 | 
			
		||||
            {
 | 
			
		||||
                TTFList.Add(i, Result.Cells[i, 1].Value.ToString() + " - " + Result.Cells[i, 5].Value.ToString());
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            for (int i = 2; i <= TTF.Dimension.End.Row; i++)
 | 
			
		||||
            {
 | 
			
		||||
                string ttfname = TTF.Cells[i, 1].Value.ToString() + " - " + TTF.Cells[i, 3].Value.ToString();
 | 
			
		||||
                string ocsname = TTF.Cells[i, 5].Value.ToString();
 | 
			
		||||
                int column = 0;
 | 
			
		||||
                int row = 0;
 | 
			
		||||
 | 
			
		||||
                row = TTFList.First(x => x.Value.ToString() == ttfname).Key;
 | 
			
		||||
                column = (OsztalyokList.ContainsKey(ocsname)) ? OsztalyokList.Where(x => x.Key.ToString() == ocsname).Single().Value : CsoportokList.Where(x => x.Key.ToString() == ocsname).Single().Value;
 | 
			
		||||
 | 
			
		||||
                if (Result.Cells[row, column].Value == null)
 | 
			
		||||
                {
 | 
			
		||||
                    Result.Cells[row, column].Value = Convert.ToDouble(TTF.Cells[i, 4].Value);
 | 
			
		||||
                    Result.Cells[row, column].Style.Numberformat.Format = "0.00";
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    Result.Cells[row, column].Value = (Convert.ToDouble(Result.Cells[row, column].Value) + Convert.ToDouble(TTF.Cells[i, 4].Value));
 | 
			
		||||
                    Result.Cells[row, column].Style.Numberformat.Format = "0.00";
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            #endregion
 | 
			
		||||
 | 
			
		||||
            #region Segédtáblák törlése
 | 
			
		||||
 | 
			
		||||
            excelPackage.Workbook.Worksheets.Delete(4);
 | 
			
		||||
            excelPackage.Workbook.Worksheets.Delete(3);
 | 
			
		||||
            excelPackage.Workbook.Worksheets.Delete(2);
 | 
			
		||||
 | 
			
		||||
            #endregion
 | 
			
		||||
 | 
			
		||||
            #region Initialize
 | 
			
		||||
 | 
			
		||||
            int firstcolnumber = 0;
 | 
			
		||||
            int firstrownumber = 0;
 | 
			
		||||
            int lastcolnumber = 0;
 | 
			
		||||
            int lastrownumber = 0;
 | 
			
		||||
            int OsszesenI = 0;
 | 
			
		||||
            int OsszesenII = 0;
 | 
			
		||||
 | 
			
		||||
            #endregion
 | 
			
		||||
 | 
			
		||||
            #region Oszlopmanipuláció
 | 
			
		||||
 | 
			
		||||
            Result.DeleteColumn(7);
 | 
			
		||||
 | 
			
		||||
            for (int colnumber = Result.Dimension.Start.Column;
 | 
			
		||||
                colnumber <= Result.Dimension.End.Column;
 | 
			
		||||
                colnumber++)
 | 
			
		||||
            {
 | 
			
		||||
                #region Oszlopnevek
 | 
			
		||||
 | 
			
		||||
                if (Result.Cells[1, colnumber].Value.ToString() == "TanarNeve")
 | 
			
		||||
                    Result.Cells[1, colnumber].Value = TantargyfelosztasResource.XlsExportPedagogusNeve;
 | 
			
		||||
                if (Result.Cells[1, colnumber].Value.ToString() == "Munkakor")
 | 
			
		||||
                    Result.Cells[1, colnumber].Value = TantargyfelosztasResource.XlsExportMunkakore;
 | 
			
		||||
                if (Result.Cells[1, colnumber].Value.ToString() == "PedagogusAdatok")
 | 
			
		||||
                {
 | 
			
		||||
                    Result.Cells[1, colnumber].Value = TantargyfelosztasResource.XlsExportOrakedvezmenyreJogosito;
 | 
			
		||||
                    Result.Cells[1, colnumber].Style.WrapText = true;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (Result.Cells[1, colnumber].Value.ToString() == "PedagogusMunkaideje")
 | 
			
		||||
                {
 | 
			
		||||
                    Result.Cells[1, colnumber].Value = TantargyfelosztasResource.XlsExportPedagogusMunkaideje;
 | 
			
		||||
                    Result.Cells[1, colnumber].Style.WrapText = true;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (Result.Cells[1, colnumber].Value.ToString() == "PedagogusOrakedvezmenye")
 | 
			
		||||
                {
 | 
			
		||||
                    Result.Cells[1, colnumber].Value = TantargyfelosztasResource.XlsExportPedagogusOrakedvezmenye;
 | 
			
		||||
                    Result.Cells[1, colnumber].Style.WrapText = true;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (Result.Cells[1, colnumber].Value.ToString() == "TantargyNev")
 | 
			
		||||
                    Result.Cells[1, colnumber].Value = TantargyfelosztasResource.XlsExportTantargyEgyeb;
 | 
			
		||||
 | 
			
		||||
                if (Result.Cells[1, colnumber].Value.ToString() == "Összesen (osztályok)")
 | 
			
		||||
                    OsszesenI = colnumber;
 | 
			
		||||
                if (Result.Cells[1, colnumber].Value.ToString() == "Összesen (csoportok)")
 | 
			
		||||
                    OsszesenII = colnumber;
 | 
			
		||||
 | 
			
		||||
                #endregion
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            #endregion
 | 
			
		||||
 | 
			
		||||
            #region Some Variables
 | 
			
		||||
 | 
			
		||||
            firstcolnumber = Result.Dimension.Start.Column;
 | 
			
		||||
            firstrownumber = Result.Dimension.Start.Row;
 | 
			
		||||
 | 
			
		||||
            lastcolnumber = Result.Dimension.End.Column;
 | 
			
		||||
            lastrownumber = Result.Dimension.End.Row;
 | 
			
		||||
 | 
			
		||||
            #endregion
 | 
			
		||||
 | 
			
		||||
            #region Main Formatting
 | 
			
		||||
 | 
			
		||||
            for (int colnumber = Result.Dimension.Start.Column;
 | 
			
		||||
                colnumber <= Result.Dimension.End.Column;
 | 
			
		||||
                colnumber++)
 | 
			
		||||
            {
 | 
			
		||||
                for (int rownumber = Result.Dimension.Start.Row;
 | 
			
		||||
                    rownumber <= Result.Dimension.End.Row;
 | 
			
		||||
                    rownumber++)
 | 
			
		||||
                {
 | 
			
		||||
                    Result.Cells[rownumber, colnumber].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
 | 
			
		||||
                    Result.Cells[rownumber, colnumber].Style.Fill.BackgroundColor.SetColor(Color.White);
 | 
			
		||||
                    Result.Cells[rownumber, colnumber].Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thin);
 | 
			
		||||
                    Result.Cells[rownumber, colnumber].Style.Border.Top.Color.SetColor(Color.Black);
 | 
			
		||||
                    Result.Cells[rownumber, colnumber].Style.Border.Left.Color.SetColor(Color.Black);
 | 
			
		||||
                    Result.Cells[rownumber, colnumber].Style.Border.Right.Color.SetColor(Color.Black);
 | 
			
		||||
                    Result.Cells[rownumber, colnumber].Style.Border.Bottom.Color.SetColor(Color.Black);
 | 
			
		||||
                    if (rownumber == 1)
 | 
			
		||||
                    {
 | 
			
		||||
                        Result.Cells[rownumber, colnumber].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, colnumber].Style.Fill.BackgroundColor.SetColor(colorKretaBlue);
 | 
			
		||||
                        Result.Cells[rownumber, colnumber].Style.Font.Bold = true;
 | 
			
		||||
                        Result.Cells[rownumber, colnumber].Style.Font.Color.SetColor(Color.White);
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        if (colnumber > 6)
 | 
			
		||||
                            Result.Cells[rownumber, colnumber].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
 | 
			
		||||
 | 
			
		||||
                        if ((IsOsztaly && colnumber == OsszesenI) || (IsCsoport && colnumber == OsszesenII))
 | 
			
		||||
                        {
 | 
			
		||||
                            Result.Cells[rownumber, colnumber].Style.Fill.BackgroundColor.SetColor(colorLightKretaBlue);
 | 
			
		||||
                            Result.Cells[rownumber, colnumber].Style.Font.Bold = true;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            #endregion
 | 
			
		||||
 | 
			
		||||
            #region Összegzések
 | 
			
		||||
 | 
			
		||||
            double allOsszesen1 = 0;
 | 
			
		||||
            double allOsszesen2 = 0;
 | 
			
		||||
 | 
			
		||||
            OsszesenI += 2;
 | 
			
		||||
            OsszesenII += 2;
 | 
			
		||||
 | 
			
		||||
            Result.InsertColumn(6, 1);
 | 
			
		||||
            Result.InsertColumn(8, 1);
 | 
			
		||||
 | 
			
		||||
            for (int i = 2; i <= Result.Dimension.End.Row; i++)
 | 
			
		||||
            {
 | 
			
		||||
                double osszeg1 = 0;
 | 
			
		||||
                double osszeg2 = 0;
 | 
			
		||||
 | 
			
		||||
                if (IsOsztaly)
 | 
			
		||||
                {
 | 
			
		||||
                    for (int j = 9; j < OsszesenI; j++)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (Result.Cells[i, j].Value != null)
 | 
			
		||||
                        {
 | 
			
		||||
                            osszeg1 += Convert.ToDouble(Result.Cells[i, j].Value);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    Result.Cells[i, OsszesenI].Value = osszeg1;
 | 
			
		||||
                    allOsszesen1 += osszeg1;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (IsCsoport)
 | 
			
		||||
                {
 | 
			
		||||
                    for (int j = (IsOsztaly) ? OsszesenI + 1 : 9; j < OsszesenII; j++)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (Result.Cells[i, j].Value != null)
 | 
			
		||||
                        {
 | 
			
		||||
                            osszeg2 += Convert.ToDouble(Result.Cells[i, j].Value);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    Result.Cells[i, OsszesenII].Value = osszeg2;
 | 
			
		||||
                    allOsszesen2 += osszeg2;
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                Result.Cells[i, 6].Value = (osszeg1 + osszeg2);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            Result.InsertRow(2, 1);
 | 
			
		||||
            Result.Cells[2, 1, 2, 5].Merge = true;
 | 
			
		||||
            Result.Cells[2, 1].Value = TantargyfelosztasResource.XlsExportOsszesPedagogus;
 | 
			
		||||
 | 
			
		||||
            for (int i = 1; i <= Result.Dimension.End.Column; i++)
 | 
			
		||||
            {
 | 
			
		||||
                if (i > 7)
 | 
			
		||||
                {
 | 
			
		||||
                    double osszeg = 0;
 | 
			
		||||
                    for (int j = 3; j <= Result.Dimension.End.Row; j++)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (Result.Cells[j, i].Value != null)
 | 
			
		||||
                        {
 | 
			
		||||
                            osszeg += Convert.ToDouble(Result.Cells[j, i].Value);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    Result.Cells[2, i].Value = osszeg;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                Result.Cells[2, i].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
 | 
			
		||||
                Result.Cells[2, i].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
 | 
			
		||||
                Result.Cells[2, i].Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thin);
 | 
			
		||||
                Result.Cells[2, i].Style.Border.Top.Color.SetColor(Color.Black);
 | 
			
		||||
                Result.Cells[2, i].Style.Border.Left.Color.SetColor(Color.Black);
 | 
			
		||||
                Result.Cells[2, i].Style.Border.Right.Color.SetColor(Color.Black);
 | 
			
		||||
                Result.Cells[2, i].Style.Border.Bottom.Color.SetColor(Color.Black);
 | 
			
		||||
                Result.Cells[2, i].Style.Fill.BackgroundColor.SetColor(colorLightKretaBlue);
 | 
			
		||||
                Result.Cells[2, i].Style.Font.Bold = true;
 | 
			
		||||
                Result.Cells[2, i].Style.Font.Color.SetColor(Color.Black);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            #region Összegzőoszlop
 | 
			
		||||
 | 
			
		||||
            Result.Cells[1, 6].Value = TantargyfelosztasResource.XlsExportOraterviOrakEsEgyeb;
 | 
			
		||||
            Result.Cells[1, 6].Style.WrapText = true;
 | 
			
		||||
            Result.Cells[1, 6].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
 | 
			
		||||
            Result.Cells[1, 6].Style.Fill.BackgroundColor.SetColor(Color.White);
 | 
			
		||||
            Result.Cells[1, 6].Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thin);
 | 
			
		||||
            Result.Cells[1, 6].Style.Border.Top.Color.SetColor(Color.Black);
 | 
			
		||||
            Result.Cells[1, 6].Style.Border.Left.Color.SetColor(Color.Black);
 | 
			
		||||
            Result.Cells[1, 6].Style.Border.Right.Color.SetColor(Color.Black);
 | 
			
		||||
            Result.Cells[1, 6].Style.Border.Bottom.Color.SetColor(Color.Black);
 | 
			
		||||
            Result.Cells[1, 6].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
 | 
			
		||||
            Result.Cells[1, 6].Style.Fill.BackgroundColor.SetColor(colorKretaBlue);
 | 
			
		||||
            Result.Cells[1, 6].Style.Font.Bold = true;
 | 
			
		||||
            Result.Cells[1, 6].Style.Font.Color.SetColor(Color.White);
 | 
			
		||||
 | 
			
		||||
            Result.Cells[1, 8].Value = TantargyfelosztasResource.XlsExportOsszesOraszam;
 | 
			
		||||
            Result.Cells[1, 8].Style.WrapText = true;
 | 
			
		||||
            Result.Cells[1, 8].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
 | 
			
		||||
            Result.Cells[1, 8].Style.Fill.BackgroundColor.SetColor(Color.White);
 | 
			
		||||
            Result.Cells[1, 8].Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thin);
 | 
			
		||||
            Result.Cells[1, 8].Style.Border.Top.Color.SetColor(Color.Black);
 | 
			
		||||
            Result.Cells[1, 8].Style.Border.Left.Color.SetColor(Color.Black);
 | 
			
		||||
            Result.Cells[1, 8].Style.Border.Right.Color.SetColor(Color.Black);
 | 
			
		||||
            Result.Cells[1, 8].Style.Border.Bottom.Color.SetColor(Color.Black);
 | 
			
		||||
            Result.Cells[1, 8].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
 | 
			
		||||
            Result.Cells[1, 8].Style.Fill.BackgroundColor.SetColor(colorKretaBlue);
 | 
			
		||||
            Result.Cells[1, 8].Style.Font.Bold = true;
 | 
			
		||||
            Result.Cells[1, 8].Style.Font.Color.SetColor(Color.White);
 | 
			
		||||
 | 
			
		||||
            for (int rownumber = 2;
 | 
			
		||||
                rownumber <= Result.Dimension.End.Row;
 | 
			
		||||
                rownumber++)
 | 
			
		||||
            {
 | 
			
		||||
                Result.Cells[rownumber, 6].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
 | 
			
		||||
                Result.Cells[rownumber, 6].Style.Fill.BackgroundColor.SetColor(Color.White);
 | 
			
		||||
                Result.Cells[rownumber, 6].Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thin);
 | 
			
		||||
                Result.Cells[rownumber, 6].Style.Border.Top.Color.SetColor(Color.Black);
 | 
			
		||||
                Result.Cells[rownumber, 6].Style.Border.Left.Color.SetColor(Color.Black);
 | 
			
		||||
                Result.Cells[rownumber, 6].Style.Border.Right.Color.SetColor(Color.Black);
 | 
			
		||||
                Result.Cells[rownumber, 6].Style.Border.Bottom.Color.SetColor(Color.Black);
 | 
			
		||||
                Result.Cells[rownumber, 6].Style.Fill.BackgroundColor.SetColor(colorLightKretaBlue);
 | 
			
		||||
                Result.Cells[rownumber, 6].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
 | 
			
		||||
                Result.Cells[rownumber, 6].Style.Font.Bold = true;
 | 
			
		||||
                Result.Cells[rownumber, 8].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
 | 
			
		||||
                Result.Cells[rownumber, 8].Style.Fill.BackgroundColor.SetColor(Color.White);
 | 
			
		||||
                Result.Cells[rownumber, 8].Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thin);
 | 
			
		||||
                Result.Cells[rownumber, 8].Style.Border.Top.Color.SetColor(Color.Black);
 | 
			
		||||
                Result.Cells[rownumber, 8].Style.Border.Left.Color.SetColor(Color.Black);
 | 
			
		||||
                Result.Cells[rownumber, 8].Style.Border.Right.Color.SetColor(Color.Black);
 | 
			
		||||
                Result.Cells[rownumber, 8].Style.Border.Bottom.Color.SetColor(Color.Black);
 | 
			
		||||
                Result.Cells[rownumber, 8].Style.Fill.BackgroundColor.SetColor(colorLightKretaBlue);
 | 
			
		||||
                Result.Cells[rownumber, 8].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
 | 
			
		||||
                Result.Cells[rownumber, 8].Style.Font.Bold = true;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            #endregion
 | 
			
		||||
 | 
			
		||||
            #endregion
 | 
			
		||||
 | 
			
		||||
            #region Merge
 | 
			
		||||
 | 
			
		||||
            int TanarokSzama = 0;
 | 
			
		||||
            string CopyValue = string.Empty;
 | 
			
		||||
            int CopyRowNumber = 0;
 | 
			
		||||
            double actOraszam = 0;
 | 
			
		||||
            for (int rownumber = Result.Dimension.End.Row;
 | 
			
		||||
                rownumber > 2;
 | 
			
		||||
                rownumber--)
 | 
			
		||||
            {
 | 
			
		||||
                if (!string.IsNullOrWhiteSpace(SDAConvert.ToString(Result.Cells[rownumber, 1].Value)))
 | 
			
		||||
                {
 | 
			
		||||
                    if (Result.Cells[rownumber, 1].Value.ToString() == CopyValue)
 | 
			
		||||
                    {
 | 
			
		||||
                        actOraszam += Convert.ToDouble(Result.Cells[rownumber, 6].Value);
 | 
			
		||||
                        Result.Cells[rownumber, 1, CopyRowNumber, 1].Merge = true;
 | 
			
		||||
                        Result.Cells[rownumber, 1, CopyRowNumber, 1].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, 1, CopyRowNumber, 1].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Left;
 | 
			
		||||
                        Result.Cells[rownumber, 1, CopyRowNumber, 1].Style.Font.Bold = true;
 | 
			
		||||
                        Result.Cells[rownumber, 2, CopyRowNumber, 2].Merge = true;
 | 
			
		||||
                        Result.Cells[rownumber, 2, CopyRowNumber, 2].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, 2, CopyRowNumber, 2].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Left;
 | 
			
		||||
                        Result.Cells[rownumber, 3, CopyRowNumber, 3].Merge = true;
 | 
			
		||||
                        Result.Cells[rownumber, 3, CopyRowNumber, 3].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, 3, CopyRowNumber, 3].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Left;
 | 
			
		||||
                        Result.Cells[rownumber, 3, CopyRowNumber, 3].Style.WrapText = true;
 | 
			
		||||
                        Result.Cells[rownumber, 4, CopyRowNumber, 4].Merge = true;
 | 
			
		||||
                        Result.Cells[rownumber, 4, CopyRowNumber, 4].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, 4, CopyRowNumber, 4].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Left;
 | 
			
		||||
                        Result.Cells[rownumber, 5].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, 5].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Left;
 | 
			
		||||
                        Result.Cells[rownumber, 6, CopyRowNumber, 6].Merge = true;
 | 
			
		||||
                        Result.Cells[rownumber, 6, CopyRowNumber, 6].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, 6, CopyRowNumber, 6].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, 6].Value = actOraszam;
 | 
			
		||||
                        Result.Cells[rownumber, 7, CopyRowNumber, 7].Merge = true;
 | 
			
		||||
                        Result.Cells[rownumber, 7, CopyRowNumber, 7].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, 7, CopyRowNumber, 7].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, 8, CopyRowNumber, 8].Merge = true;
 | 
			
		||||
                        Result.Cells[rownumber, 8, CopyRowNumber, 8].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, 8, CopyRowNumber, 8].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, 8].Value = actOraszam + Convert.ToDouble(Result.Cells[rownumber, 7].Value);
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        TanarokSzama++;
 | 
			
		||||
                        CopyValue = Result.Cells[rownumber, 1].Value.ToString();
 | 
			
		||||
                        CopyRowNumber = rownumber;
 | 
			
		||||
                        actOraszam = Convert.ToDouble(Result.Cells[rownumber, 6].Value);
 | 
			
		||||
                        Result.Cells[rownumber, 1].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, 1].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Left;
 | 
			
		||||
                        Result.Cells[rownumber, 1].Style.Font.Bold = true;
 | 
			
		||||
                        Result.Cells[rownumber, 2].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, 2].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Left;
 | 
			
		||||
                        Result.Cells[rownumber, 3].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, 3].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Left;
 | 
			
		||||
                        Result.Cells[rownumber, 3].Style.WrapText = true;
 | 
			
		||||
                        Result.Cells[rownumber, 4].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, 4].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Left;
 | 
			
		||||
                        Result.Cells[rownumber, 5].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, 5].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Left;
 | 
			
		||||
                        Result.Cells[rownumber, 6].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, 6].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, 7].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, 7].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, 8].Style.VerticalAlignment = OfficeOpenXml.Style.ExcelVerticalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, 8].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
 | 
			
		||||
                        Result.Cells[rownumber, 8].Value = actOraszam + Convert.ToDouble(Result.Cells[rownumber, 7].Value);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            #endregion
 | 
			
		||||
 | 
			
		||||
            #region Fejlécnevek
 | 
			
		||||
 | 
			
		||||
            Result.InsertRow(1, 1);
 | 
			
		||||
            if (IsOsztaly)
 | 
			
		||||
            {
 | 
			
		||||
                Result.Cells[1, 9, 1, OsszesenI].Merge = true;
 | 
			
		||||
                Result.Cells[1, 9].Value = TantargyfelosztasResource.XlsExportOsztalyok;
 | 
			
		||||
                Result.Cells[1, 9].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
 | 
			
		||||
                Result.Cells[1, 9].Style.Fill.BackgroundColor.SetColor(Color.White);
 | 
			
		||||
                Result.Cells[1, 9].Style.Font.Bold = true;
 | 
			
		||||
                Result.Cells[1, 9].Style.Font.Size = 12;
 | 
			
		||||
                Result.Cells[1, 9].Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thin);
 | 
			
		||||
                Result.Cells[1, 9].Style.Border.Top.Color.SetColor(Color.Black);
 | 
			
		||||
                Result.Cells[1, 9].Style.Border.Left.Color.SetColor(Color.Black);
 | 
			
		||||
                Result.Cells[1, 9].Style.Border.Right.Color.SetColor(Color.Black);
 | 
			
		||||
                Result.Cells[1, 9].Style.Border.Bottom.Color.SetColor(Color.Black);
 | 
			
		||||
                Result.Cells[1, 9].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (IsCsoport)
 | 
			
		||||
            {
 | 
			
		||||
                Result.Cells[1, (IsOsztaly) ? OsszesenI + 1 : 9, 1, OsszesenII].Merge = true;
 | 
			
		||||
                Result.Cells[1, (IsOsztaly) ? OsszesenI + 1 : 9].Value = TantargyfelosztasResource.XlsExportCsoportok;
 | 
			
		||||
                Result.Cells[1, (IsOsztaly) ? OsszesenI + 1 : 9].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
 | 
			
		||||
                Result.Cells[1, (IsOsztaly) ? OsszesenI + 1 : 9].Style.Fill.BackgroundColor.SetColor(Color.White);
 | 
			
		||||
                Result.Cells[1, (IsOsztaly) ? OsszesenI + 1 : 9].Style.Font.Bold = true;
 | 
			
		||||
                Result.Cells[1, (IsOsztaly) ? OsszesenI + 1 : 9].Style.Font.Size = 12;
 | 
			
		||||
                Result.Cells[1, (IsOsztaly) ? OsszesenI + 1 : 9].Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thin);
 | 
			
		||||
                Result.Cells[1, (IsOsztaly) ? OsszesenI + 1 : 9].Style.Border.Top.Color.SetColor(Color.Black);
 | 
			
		||||
                Result.Cells[1, (IsOsztaly) ? OsszesenI + 1 : 9].Style.Border.Left.Color.SetColor(Color.Black);
 | 
			
		||||
                Result.Cells[1, (IsOsztaly) ? OsszesenI + 1 : 9].Style.Border.Right.Color.SetColor(Color.Black);
 | 
			
		||||
                Result.Cells[1, (IsOsztaly) ? OsszesenI + 1 : 9].Style.Border.Bottom.Color.SetColor(Color.Black);
 | 
			
		||||
                Result.Cells[1, (IsOsztaly) ? OsszesenI + 1 : 9].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            Result.Cells[1, 1, 1, 7].Merge = true;
 | 
			
		||||
            Result.Cells[1, 1].Value = TantargyfelosztasResource.XlsExportTantargyfelosztas;
 | 
			
		||||
            Result.Cells[1, 1].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid;
 | 
			
		||||
            Result.Cells[1, 1].Style.Fill.BackgroundColor.SetColor(Color.White);
 | 
			
		||||
            Result.Cells[1, 1].Style.Font.Bold = true;
 | 
			
		||||
            Result.Cells[1, 1].Style.Font.Size = 20;
 | 
			
		||||
            Result.Cells[1, 1].Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thin);
 | 
			
		||||
            Result.Cells[1, 1].Style.Border.Top.Color.SetColor(Color.Black);
 | 
			
		||||
            Result.Cells[1, 1].Style.Border.Left.Color.SetColor(Color.Black);
 | 
			
		||||
            Result.Cells[1, 1].Style.Border.Right.Color.SetColor(Color.Black);
 | 
			
		||||
            Result.Cells[1, 1].Style.Border.Bottom.Color.SetColor(Color.Black);
 | 
			
		||||
            Result.Cells[1, 1].Style.HorizontalAlignment = OfficeOpenXml.Style.ExcelHorizontalAlignment.Center;
 | 
			
		||||
 | 
			
		||||
            Result.Cells[3, 1].Value = "Összesen " + TanarokSzama.ToString() + " pedagógus";
 | 
			
		||||
 | 
			
		||||
            #endregion
 | 
			
		||||
 | 
			
		||||
            #region Width and Autofit
 | 
			
		||||
 | 
			
		||||
            for (int colnumber = Result.Dimension.Start.Column;
 | 
			
		||||
                colnumber <= Result.Dimension.End.Column;
 | 
			
		||||
                colnumber++)
 | 
			
		||||
            {
 | 
			
		||||
                if (colnumber > 8)
 | 
			
		||||
                {
 | 
			
		||||
                    Result.Cells[2, colnumber, 2, colnumber].Style.TextRotation = 90;
 | 
			
		||||
                    Result.Column(colnumber).Width = 7;
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    Result.Cells[2, colnumber, lastrownumber, colnumber].AutoFitColumns();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            Result.Cells[2, 1, 2, 1].AutoFitColumns(30);
 | 
			
		||||
            Result.Cells[2, 2, 2, 2].AutoFitColumns(25);
 | 
			
		||||
            if (IsOsztaly)
 | 
			
		||||
                Result.Column(OsszesenI).Width = 10;
 | 
			
		||||
 | 
			
		||||
            if (IsCsoport)
 | 
			
		||||
            {
 | 
			
		||||
                Result.Column(OsszesenII).Width = 10;
 | 
			
		||||
                Result.Column(OsszesenII + 1).Width = 10;
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                Result.Column(OsszesenI + 1).Width = 10;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            #endregion
 | 
			
		||||
 | 
			
		||||
            excelPackage.Save();
 | 
			
		||||
            excelPackage.Stream.Seek(0, SeekOrigin.Begin);
 | 
			
		||||
            return new MemoryStream(excelPackage.GetAsByteArray());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        private string GetExcelColumnName(int columnNumber)
 | 
			
		||||
        {
 | 
			
		||||
            int dividend = columnNumber;
 | 
			
		||||
            string columnName = string.Empty;
 | 
			
		||||
 | 
			
		||||
            while (dividend > 0)
 | 
			
		||||
            {
 | 
			
		||||
                var modulo = (dividend - 1) % 26;
 | 
			
		||||
                columnName = Convert.ToChar(65 + modulo) + columnName;
 | 
			
		||||
                dividend = (int)((dividend - modulo) / 26);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return columnName;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void PrePareTtfExportDocument(ExcelExportItem exportFile, Dictionary<string, int> tanarok, int groupsCount)
 | 
			
		||||
        {
 | 
			
		||||
            exportFile.AddColumn((int)TtfExportColumns.Osztaly, string.Empty, 0U);
 | 
			
		||||
            exportFile.AddColumn((int)TtfExportColumns.Csoport, string.Empty, 0U);
 | 
			
		||||
            exportFile.AddColumn((int)TtfExportColumns.Tantargy, string.Empty, 0U);
 | 
			
		||||
            exportFile.AddColumn((int)TtfExportColumns.Osszes, string.Empty, 0U);
 | 
			
		||||
 | 
			
		||||
            foreach (var item in tanarok.Keys)
 | 
			
		||||
            {
 | 
			
		||||
                exportFile.AddColumn(tanarok[item], item, 5U);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            exportFile.AddCell(2, (int)TtfExportColumns.Osztaly, ImportExportTantargyfelosztasResource.ImportHeaderNameOsztaly, formatID: 6U);
 | 
			
		||||
            exportFile.AddCell(2, (int)TtfExportColumns.Csoport, ImportExportTantargyfelosztasResource.ImportHeaderNameCsoport, formatID: 6U);
 | 
			
		||||
            exportFile.AddCell(2, (int)TtfExportColumns.Tantargy, ImportExportTantargyfelosztasResource.ImportHeaderNameTantargy, formatID: 6U);
 | 
			
		||||
            exportFile.AddCell(2, (int)TtfExportColumns.Osszes, ImportExportTantargyfelosztasResource.ImportHeaderNameOsszesen, formatID: 3U);
 | 
			
		||||
 | 
			
		||||
            var sumLastRow = groupsCount != 0 ? 2 + groupsCount : 3;
 | 
			
		||||
            for (int j = 1; j <= tanarok.Count; j++)
 | 
			
		||||
            {
 | 
			
		||||
                exportFile.AddCell(2, (int)TtfExportColumns.Osszes + j, string.Empty, string.Format("SUM({0}{1}:{0}{2})", GetExcelColumnName((int)TtfExportColumns.Osszes + j + 1), 3, sumLastRow), formatID: 3U);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void PrepareOsztalyTtfExportDocument(ExcelExportItem exportFile, List<(string osztaly, string csoport, int columnIndex)> keresztTablaOszlopok, int groupsCount)
 | 
			
		||||
        {
 | 
			
		||||
            exportFile.AddColumn((int)TtfExportOsztalyokColumns.Tanar, string.Empty, 0U);
 | 
			
		||||
            exportFile.AddColumn((int)TtfExportOsztalyokColumns.Tantargy, string.Empty, 0U);
 | 
			
		||||
            exportFile.AddColumn((int)TtfExportOsztalyokColumns.Osszes, ImportExportTantargyfelosztasResource.ImportHeaderNameOsztaly, formatId: 4U);
 | 
			
		||||
            exportFile.AddCell(2, (int)TtfExportOsztalyokColumns.Osszes, ImportExportTantargyfelosztasResource.ImportHeaderNameCsoport, formatID: 4U);
 | 
			
		||||
            exportFile.AddCell(3, (int)TtfExportOsztalyokColumns.Tanar, ImportExportTantargyfelosztasResource.ImportHeaderNameTanar, formatID: 6U);
 | 
			
		||||
            exportFile.AddCell(3, (int)TtfExportOsztalyokColumns.Tantargy, ImportExportTantargyfelosztasResource.ImportHeaderNameTantargy, formatID: 6U);
 | 
			
		||||
            exportFile.AddCell(3, (int)TtfExportOsztalyokColumns.Osszes, ImportExportTantargyfelosztasResource.ImportHeaderNameOsszesen, formatID: 3U);
 | 
			
		||||
 | 
			
		||||
            for (int j = 1; j <= keresztTablaOszlopok.Count; j++)
 | 
			
		||||
            {
 | 
			
		||||
                var (osztaly, csoport, columnIndex) = keresztTablaOszlopok[j - 1];
 | 
			
		||||
                exportFile.AddColumn(columnIndex, osztaly, formatId: 5U);
 | 
			
		||||
                exportFile.AddCell(2, columnIndex, csoport, formatID: 5U);
 | 
			
		||||
                exportFile.AddCell(3, columnIndex, string.Empty, string.Format("SUM({0}{1}:{0}{2})", GetExcelColumnName(columnIndex + 1), 4, 3 + groupsCount), formatID: 3U);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public enum EgyszeruTtfExportColumns
 | 
			
		||||
        {
 | 
			
		||||
            Osztaly = 0,
 | 
			
		||||
            Csoport = 1,
 | 
			
		||||
            Tantargy = 2,
 | 
			
		||||
            Oraszam = 3,
 | 
			
		||||
            Tanar = 4,
 | 
			
		||||
            Tuloraszam = 5,
 | 
			
		||||
            IsOsszevontOra = 6,
 | 
			
		||||
            IsNemzetisegiOra = 7,
 | 
			
		||||
            MegbizasiOraszam = 8
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public enum TtfExportColumns
 | 
			
		||||
        {
 | 
			
		||||
            Osztaly = 0,
 | 
			
		||||
            Csoport = 1,
 | 
			
		||||
            Tantargy = 2,
 | 
			
		||||
            Osszes = 3,
 | 
			
		||||
            Tanar = 4
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public enum TtfExportOsztalyokColumns
 | 
			
		||||
        {
 | 
			
		||||
            Tanar = 0,
 | 
			
		||||
            Tantargy = 1,
 | 
			
		||||
            Osszes = 2,
 | 
			
		||||
            OsztalyCsoport = 3,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										405
									
								
								Kreta.BusinessLogic/Classes/Extensions.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										405
									
								
								Kreta.BusinessLogic/Classes/Extensions.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,405 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Data;
 | 
			
		||||
using System.Globalization;
 | 
			
		||||
using System.IO;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Text.RegularExpressions;
 | 
			
		||||
using System.Xml;
 | 
			
		||||
using Aspose.Cells;
 | 
			
		||||
using Kreta.Core;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes
 | 
			
		||||
{
 | 
			
		||||
    public static class Extensions
 | 
			
		||||
    {
 | 
			
		||||
        private static readonly List<string> DateTimeStringFormatList = new List<string>
 | 
			
		||||
        {
 | 
			
		||||
            "yyyyMMdd",
 | 
			
		||||
            "yyyy.MM.dd",
 | 
			
		||||
            "yyyy.MM.dd.",
 | 
			
		||||
            "yyyy. MM. dd",
 | 
			
		||||
            "yyyy. MM. dd.",
 | 
			
		||||
            "yyyy-MM-dd",
 | 
			
		||||
            "yyyy/MM/dd",
 | 
			
		||||
 | 
			
		||||
            "yyyyMMdd H:mm:ss",
 | 
			
		||||
            "yyyy.MM.dd H:mm:ss",
 | 
			
		||||
            "yyyy.MM.dd. H:mm:ss",
 | 
			
		||||
            "yyyy. MM. dd H:mm:ss",
 | 
			
		||||
            "yyyy. MM. dd. H:mm:ss",
 | 
			
		||||
            "yyyy-MM-dd H:mm:ss",
 | 
			
		||||
            "yyyy/MM/dd H:mm:ss",
 | 
			
		||||
 | 
			
		||||
            "yyyyMMdd HH:mm:ss",
 | 
			
		||||
            "yyyy.MM.dd HH:mm:ss",
 | 
			
		||||
            "yyyy.MM.dd. HH:mm:ss",
 | 
			
		||||
            "yyyy. MM. dd HH:mm:ss",
 | 
			
		||||
            "yyyy. MM. dd. HH:mm:ss",
 | 
			
		||||
            "yyyy-MM-dd HH:mm:ss",
 | 
			
		||||
            "yyyy/MM/dd HH:mm:ss"
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        public static readonly List<string> TrueStringFormatList = new List<string>
 | 
			
		||||
        {
 | 
			
		||||
            "igen",
 | 
			
		||||
            "Igen"
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        public static readonly List<string> FalseStringFormatList = new List<string>
 | 
			
		||||
        {
 | 
			
		||||
            "nem",
 | 
			
		||||
            "Nem"
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        public static string Stringify(this XmlDocument doc)
 | 
			
		||||
        {
 | 
			
		||||
            var stringWriter = new StringWriter();
 | 
			
		||||
            var xmlTextWriter = new XmlTextWriter(stringWriter);
 | 
			
		||||
            doc.WriteTo(xmlTextWriter);
 | 
			
		||||
            return stringWriter.ToString();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string ToShortDateString(this DateTime? dateTime)
 | 
			
		||||
        {
 | 
			
		||||
            return dateTime?.ToShortDateString() ?? string.Empty;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string ToConvertableDateString(this DateTime? dateTime)
 | 
			
		||||
        {
 | 
			
		||||
            return dateTime != null ? dateTime.Value.ToConvertableDateString() : string.Empty;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string ToConvertableDateString(this DateTime dateTime)
 | 
			
		||||
        {
 | 
			
		||||
            return dateTime.ToString("yyyy-MM-dd");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static DateTime StartOfWeek(this DateTime dt, DayOfWeek startOfWeek)
 | 
			
		||||
        {
 | 
			
		||||
            int diff = (7 + (dt.DayOfWeek - startOfWeek)) % 7;
 | 
			
		||||
            return dt.AddDays(-1 * diff).Date;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static int Age(this DateTime birthDate, DateTime reference)
 | 
			
		||||
        {
 | 
			
		||||
            // Calculate the age.
 | 
			
		||||
            var age = reference.Year - birthDate.Year;
 | 
			
		||||
            // Go back to the year in which the person was born in case of a leap year
 | 
			
		||||
            if (reference < birthDate.AddYears(age))
 | 
			
		||||
            {
 | 
			
		||||
                age--;
 | 
			
		||||
            }
 | 
			
		||||
            return age;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string ToComparableString(this string text)
 | 
			
		||||
        {
 | 
			
		||||
            if (string.IsNullOrWhiteSpace(text))
 | 
			
		||||
            {
 | 
			
		||||
                return "invalid_text";
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            string result = text
 | 
			
		||||
                .ReplaceMultipleSpacesAndTrim()?
 | 
			
		||||
                .ToLowerInvariant()
 | 
			
		||||
                .Replace("á", "a")
 | 
			
		||||
                .Replace("é", "e")
 | 
			
		||||
                .Replace("í", "i")
 | 
			
		||||
                .Replace("ó", "o")
 | 
			
		||||
                .Replace("ő", "ö")
 | 
			
		||||
                .Replace("ô", "ö")
 | 
			
		||||
                .Replace("õ", "ö")
 | 
			
		||||
                .Replace("ú", "u")
 | 
			
		||||
                .Replace("ű", "ü")
 | 
			
		||||
                .Replace("û", "ü")
 | 
			
		||||
                .Replace("ũ", "ü");
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string ToLetterComparableString(this string text)
 | 
			
		||||
        {
 | 
			
		||||
            char[] arr = text.ToComparableString().ToCharArray();
 | 
			
		||||
 | 
			
		||||
            arr = Array.FindAll(arr, c => char.IsLetter(c));
 | 
			
		||||
 | 
			
		||||
            var result = new string(arr);
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static TEnum ToEnum<TEnum>(this string value, TEnum defaultValue)
 | 
			
		||||
        {
 | 
			
		||||
            if (!Enum.IsDefined(typeof(TEnum), value))
 | 
			
		||||
            {
 | 
			
		||||
                return defaultValue;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var result = (TEnum)Enum.Parse(typeof(TEnum), value);
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static bool HasValueAndPositive(this int? value) => 0 < value;
 | 
			
		||||
 | 
			
		||||
        public static char ToChar(this bool value)
 | 
			
		||||
        {
 | 
			
		||||
            return value ? 'T' : 'F';
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static TResult Using<TClass, TResult>(this TClass helper, Func<TClass, TResult> func) where TClass : IDisposable
 | 
			
		||||
        {
 | 
			
		||||
            using (helper)
 | 
			
		||||
            {
 | 
			
		||||
                return func(helper);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static void Using<TClass>(this TClass helper, Action<TClass> action) where TClass : IDisposable
 | 
			
		||||
        {
 | 
			
		||||
            using (helper)
 | 
			
		||||
            {
 | 
			
		||||
                action(helper);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static DataSet DataSetSort(this DataSet dataSet, string columnName, bool isAsc = true)
 | 
			
		||||
        {
 | 
			
		||||
            DataSet result = new DataSet();
 | 
			
		||||
            dataSet.Tables[0].DefaultView.Sort = $"{columnName} {(isAsc ? "ASC" : "DESC")}";
 | 
			
		||||
            result.Tables.Add(dataSet.Tables[0].DefaultView.ToTable());
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static bool IsEmpty(this DataSet dataSet)
 | 
			
		||||
        {
 | 
			
		||||
            if (dataSet != null
 | 
			
		||||
                && dataSet.Tables.Count > 0
 | 
			
		||||
                && dataSet.Tables[0].Rows.Count > 0)
 | 
			
		||||
            {
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Connect DictionaryItemIdColumns with NameColumns. Precondition: colName - colName_DNAME fields!
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="origin">The origin.</param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public static DataTable ConnectDictionaryColumns(this DataTable origin)
 | 
			
		||||
        {
 | 
			
		||||
            StringBuilder colNameString = new StringBuilder();
 | 
			
		||||
            foreach (DataColumn colItem in origin.Columns)
 | 
			
		||||
            {
 | 
			
		||||
                colNameString.Append(colItem.ColumnName + ";");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            foreach (Match match in new Regex("(([^;]*)_DNAME);").Matches(colNameString.ToString()))
 | 
			
		||||
            {
 | 
			
		||||
                string colNameWDNAME = match.Groups[1].Value;
 | 
			
		||||
                string colOriginalName = match.Groups[2].Value;
 | 
			
		||||
                int colOriginalIndex = origin.Columns[colOriginalName].Ordinal;
 | 
			
		||||
 | 
			
		||||
                origin.Columns.Remove(colOriginalName);
 | 
			
		||||
                origin.Columns[colNameWDNAME].SetOrdinal(colOriginalIndex);
 | 
			
		||||
                origin.Columns[colNameWDNAME].ColumnName = colOriginalName;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return origin;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static void RemoveEmptyRows(this DataTable dataTable)
 | 
			
		||||
        {
 | 
			
		||||
            for (int i = dataTable.Rows.Count - 1; i >= 0; i--)
 | 
			
		||||
            {
 | 
			
		||||
                if (dataTable.Rows[i][1] == DBNull.Value)
 | 
			
		||||
                {
 | 
			
		||||
                    dataTable.Rows[i].Delete();
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            dataTable.AcceptChanges();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static DateTime? GetDateTimeFromString(this string data)
 | 
			
		||||
        {
 | 
			
		||||
            if (DateTime.TryParseExact(data, DateTimeStringFormatList.ToArray(), CultureInfo.InvariantCulture, DateTimeStyles.None, out var result))
 | 
			
		||||
            {
 | 
			
		||||
                return result;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static double? GetDoubleFromString(this string data)
 | 
			
		||||
        {
 | 
			
		||||
            var formattedDoubleString = data.Replace(" ", string.Empty).Replace(",", ".");
 | 
			
		||||
            if (double.TryParse(formattedDoubleString, NumberStyles.Any, CultureInfo.InvariantCulture, out var result))
 | 
			
		||||
            {
 | 
			
		||||
                return result;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static bool? GetBooleanValueFromString(this string data)
 | 
			
		||||
        {
 | 
			
		||||
            if (TrueStringFormatList.Select(x => x.ToComparableString()).Contains(data.ToComparableString()))
 | 
			
		||||
            {
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (FalseStringFormatList.Select(x => x.ToComparableString()).Contains(data.ToComparableString()))
 | 
			
		||||
            {
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static double? WeightedAverage<T>(this IEnumerable<T> recordEnumeration, Func<T, double> value, Func<T, double> weight, int? round = null)
 | 
			
		||||
        {
 | 
			
		||||
            if (!recordEnumeration.Any())
 | 
			
		||||
            {
 | 
			
		||||
                return null;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var recordList = recordEnumeration.ToList();
 | 
			
		||||
            double weightedValueSum = recordList.Sum(x => value(x) * weight(x));
 | 
			
		||||
            double weightSum = recordList.Sum(weight);
 | 
			
		||||
 | 
			
		||||
            if (Math.Abs(weightSum) > 0)
 | 
			
		||||
            {
 | 
			
		||||
                double result;
 | 
			
		||||
                if (round.IsNotNullAndPositive())
 | 
			
		||||
                {
 | 
			
		||||
                    result = Math.Round(weightedValueSum / weightSum, round.Value);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    result = weightedValueSum / weightSum;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                return result;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            throw new DivideByZeroException();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static TKey GetKeyByUniqueValue<TKey, TValue>(this Dictionary<TKey, TValue> dictionary, TValue value)
 | 
			
		||||
        {
 | 
			
		||||
            var result = dictionary.Single(x => x.Value.Equals(value));
 | 
			
		||||
            return result.Key;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static void ChangeColumnDataType(this DataTable table, string columnname, Type newtype)
 | 
			
		||||
        {
 | 
			
		||||
            DataColumn column = table.Columns[columnname];
 | 
			
		||||
            if (column.DataType == newtype)
 | 
			
		||||
            {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                var newcolumn = new DataColumn("temporary", newtype);
 | 
			
		||||
                table.Columns.Add(newcolumn);
 | 
			
		||||
 | 
			
		||||
                foreach (DataRow row in table.Rows)
 | 
			
		||||
                {
 | 
			
		||||
                    try
 | 
			
		||||
                    {
 | 
			
		||||
                        row["temporary"] = Convert.ChangeType(row[columnname], newtype);
 | 
			
		||||
                    }
 | 
			
		||||
                    catch
 | 
			
		||||
                    {
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                newcolumn.SetOrdinal(column.Ordinal);
 | 
			
		||||
                table.Columns.Remove(columnname);
 | 
			
		||||
                newcolumn.ColumnName = columnname;
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception e)
 | 
			
		||||
            {
 | 
			
		||||
                throw new Exception(e.Message, e);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static void SetTextWrap(this Cell errorCell, bool isTextWrapped = true)
 | 
			
		||||
        {
 | 
			
		||||
            Style style = errorCell.GetStyle();
 | 
			
		||||
            style.IsTextWrapped = isTextWrapped;
 | 
			
		||||
            errorCell.SetStyle(style);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static Stream StripNonValidXmlCharacters(this Stream inputStream)
 | 
			
		||||
        {
 | 
			
		||||
            var inputStreamString = inputStream.StreamToString();
 | 
			
		||||
            StringBuilder outputStreamStringBuilder = new StringBuilder(); // Used to hold the output.
 | 
			
		||||
 | 
			
		||||
            if (string.IsNullOrWhiteSpace(inputStreamString))
 | 
			
		||||
            {
 | 
			
		||||
                return string.Empty.StringToStream(); // Vacancy test.
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            foreach (var current in inputStreamString)
 | 
			
		||||
            {
 | 
			
		||||
                if (current == 0x9 || // == '\t' == 9
 | 
			
		||||
                    current == 0xA || // == '\n' == 10
 | 
			
		||||
                    current == 0xD || // == '\r' == 13
 | 
			
		||||
                    current >= 0x20 && current <= 0xD7FF ||
 | 
			
		||||
                    current >= 0xE000 && current <= 0xFFFD ||
 | 
			
		||||
                    current >= 0x10000 && current <= 0x10FFFF)
 | 
			
		||||
                {
 | 
			
		||||
                    outputStreamStringBuilder.Append(current);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var result = outputStreamStringBuilder.ToString().StringToStream();
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static string StreamToString(this Stream stream)
 | 
			
		||||
        {
 | 
			
		||||
            stream.Position = 0;
 | 
			
		||||
            using (StreamReader reader = new StreamReader(stream, Encoding.GetEncoding("iso-8859-1")))
 | 
			
		||||
            {
 | 
			
		||||
                return reader.ReadToEnd();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static Stream StringToStream(this string streamString)
 | 
			
		||||
        {
 | 
			
		||||
            byte[] byteArray = Encoding.GetEncoding("iso-8859-1").GetBytes(streamString);
 | 
			
		||||
            return new MemoryStream(byteArray);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static DataTable RemoveDuplicateRows(this DataTable dataTable, string columnName)
 | 
			
		||||
        {
 | 
			
		||||
            Hashtable hashTable = new Hashtable();
 | 
			
		||||
            ArrayList duplicateArrayList = new ArrayList();
 | 
			
		||||
 | 
			
		||||
            foreach (DataRow dataRow in dataTable.Rows)
 | 
			
		||||
            {
 | 
			
		||||
                if (hashTable.Contains(dataRow[columnName]))
 | 
			
		||||
                {
 | 
			
		||||
                    duplicateArrayList.Add(dataRow);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    hashTable.Add(dataRow[columnName], string.Empty);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            foreach (DataRow dataRow in duplicateArrayList)
 | 
			
		||||
            {
 | 
			
		||||
                dataTable.Rows.Remove(dataRow);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return dataTable;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										37
									
								
								Kreta.BusinessLogic/Classes/Hacks.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								Kreta.BusinessLogic/Classes/Hacks.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes
 | 
			
		||||
{
 | 
			
		||||
    public static class Hacks
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Not a proper extension, just a hack.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="str">T or F from db</param>
 | 
			
		||||
        /// <returns>true if string is "T"</returns>
 | 
			
		||||
        public static bool AsBool(this string str)
 | 
			
		||||
        {
 | 
			
		||||
            return str == "T";
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Not a proper extension, just a hack.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="value"></param>
 | 
			
		||||
        /// <returns>Oracle compatiblr boolean.</returns>
 | 
			
		||||
        public static string AsString(this bool value)
 | 
			
		||||
        {
 | 
			
		||||
            return value ? "T" : "F";
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Next level hack.
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="value">Any enum you need to persist.</param>
 | 
			
		||||
        /// <returns>Value of the given enum.Integer</returns>
 | 
			
		||||
        public static int AsInt(this Enum value)
 | 
			
		||||
        {
 | 
			
		||||
            return Convert.ToInt32(value);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,74 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Data;
 | 
			
		||||
using System.Runtime.Caching;
 | 
			
		||||
using Kreta.DataAccessManual;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Common.Co
 | 
			
		||||
{
 | 
			
		||||
    public class DefaultConnectionParameters
 | 
			
		||||
    {
 | 
			
		||||
        private class IntezmenyAdatok
 | 
			
		||||
        {
 | 
			
		||||
            public int TanevId { get; set; }
 | 
			
		||||
 | 
			
		||||
            public int IntezmenyId { get; set; }
 | 
			
		||||
 | 
			
		||||
            public string IntezmenyNev { get; set; }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public string IntezmenyAzonosito { get; }
 | 
			
		||||
 | 
			
		||||
        public int TanevId { get; }
 | 
			
		||||
 | 
			
		||||
        public int IntezmenyId { get; }
 | 
			
		||||
 | 
			
		||||
        public string IntezmenyNev { get; }
 | 
			
		||||
 | 
			
		||||
        public int FelhasznaloId { get; }
 | 
			
		||||
 | 
			
		||||
        public DefaultConnectionParameters(MobileUser mobileUser)
 | 
			
		||||
        {
 | 
			
		||||
            this.FelhasznaloId = mobileUser.ActualUserId;
 | 
			
		||||
            this.IntezmenyAzonosito = mobileUser.InstituteCode;
 | 
			
		||||
            this.TanevId = mobileUser.SchoolYearId;
 | 
			
		||||
            var intezmenyAdatok = GetIntezmenyAdatokFromCache();
 | 
			
		||||
            this.IntezmenyId = intezmenyAdatok.IntezmenyId;
 | 
			
		||||
            this.IntezmenyNev = intezmenyAdatok.IntezmenyNev;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private IntezmenyAdatok GetIntezmenyAdatokFromCache()
 | 
			
		||||
        {
 | 
			
		||||
            var cache = MemoryCache.Default;
 | 
			
		||||
            string cacheKey = $"{IntezmenyAzonosito}_mobileIntezmenyAdatok";
 | 
			
		||||
            var intezmenyAdatok = cache[cacheKey] as IntezmenyAdatok;
 | 
			
		||||
            if (intezmenyAdatok == null)
 | 
			
		||||
            {
 | 
			
		||||
                intezmenyAdatok = GetIntezmenyAdatok();
 | 
			
		||||
 | 
			
		||||
                var policy = new CacheItemPolicy
 | 
			
		||||
                {
 | 
			
		||||
                    AbsoluteExpiration = new DateTimeOffset(DateTime.Now.AddMinutes(20))
 | 
			
		||||
                };
 | 
			
		||||
 | 
			
		||||
                cache.Set(cacheKey, intezmenyAdatok, policy);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return intezmenyAdatok;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private IntezmenyAdatok GetIntezmenyAdatok()
 | 
			
		||||
        {
 | 
			
		||||
            return Dal.MobileConnection.Run(IntezmenyAzonosito, TanevId, h =>
 | 
			
		||||
            {
 | 
			
		||||
                var intezmenyAdatok = h.IntezmenyDal().GetIntezmenyIdAndNevByAzonosito(IntezmenyAzonosito);
 | 
			
		||||
                var returnIntezmenyAdatokObject = new IntezmenyAdatok
 | 
			
		||||
                {
 | 
			
		||||
                    IntezmenyId = intezmenyAdatok.Tables[0].Rows[0].Field<int>("Id"),
 | 
			
		||||
                    IntezmenyNev = intezmenyAdatok.Tables[0].Rows[0].Field<string>("Nev")
 | 
			
		||||
                };
 | 
			
		||||
 | 
			
		||||
                return returnIntezmenyAdatokObject;
 | 
			
		||||
            }, FelhasznaloId);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,70 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using Kreta.BusinessLogic.Classes.MobileApi.Common.Enum;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Common.Co
 | 
			
		||||
{
 | 
			
		||||
    public class MobileUser
 | 
			
		||||
    {
 | 
			
		||||
        const int MinimumIdentifierValue = 1;
 | 
			
		||||
 | 
			
		||||
        public string InstituteCode { get; }
 | 
			
		||||
 | 
			
		||||
        public int UserId { get; }
 | 
			
		||||
 | 
			
		||||
        public int? TutelaryId { get; }
 | 
			
		||||
 | 
			
		||||
        public int ActualUserId => this.TutelaryId ?? this.UserId;
 | 
			
		||||
 | 
			
		||||
        public int SchoolYearId { get; }
 | 
			
		||||
 | 
			
		||||
        public IEnumerable<MobileUserRole> Roles { get; }
 | 
			
		||||
 | 
			
		||||
        public MobileUser(string instituteCode, int userId, int? tutelaryId, IEnumerable<MobileUserRole> roles, int schoolYearId)
 | 
			
		||||
        {
 | 
			
		||||
            if (string.IsNullOrWhiteSpace(instituteCode))
 | 
			
		||||
            {
 | 
			
		||||
                throw new ArgumentException($"{nameof(instituteCode)} cannot be null or whitespace");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            this.InstituteCode = instituteCode;
 | 
			
		||||
 | 
			
		||||
            if (userId < MinimumIdentifierValue)
 | 
			
		||||
            {
 | 
			
		||||
                throw new ArgumentException($"{nameof(userId)} must be greater or equal to {MinimumIdentifierValue}");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            this.UserId = userId;
 | 
			
		||||
 | 
			
		||||
            if (roles == null)
 | 
			
		||||
            {
 | 
			
		||||
                throw new ArgumentNullException(nameof(roles));
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (!roles.Any())
 | 
			
		||||
            {
 | 
			
		||||
                throw new ArgumentException($"User \"{instituteCode}/{userId}\" must have at least one role");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            this.Roles = roles;
 | 
			
		||||
 | 
			
		||||
            if (tutelaryId != null)
 | 
			
		||||
            {
 | 
			
		||||
                if (tutelaryId < MinimumIdentifierValue)
 | 
			
		||||
                {
 | 
			
		||||
                    throw new ArgumentException($"{nameof(tutelaryId)} must be greater or equal to {MinimumIdentifierValue}");
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (!roles.Contains(MobileUserRole.Tutelary))
 | 
			
		||||
                {
 | 
			
		||||
                    throw new ArgumentException($"{nameof(roles)} must contain {MobileUserRole.Tutelary} because {nameof(tutelaryId)} is not null");
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            this.TutelaryId = tutelaryId;
 | 
			
		||||
            this.SchoolYearId = schoolYearId;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -0,0 +1,9 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Common.Enum
 | 
			
		||||
{
 | 
			
		||||
    public enum MobileUserRole
 | 
			
		||||
    {
 | 
			
		||||
        Student,
 | 
			
		||||
        Tutelary,
 | 
			
		||||
        Teacher
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,9 @@
 | 
			
		||||
using Kreta.BusinessLogic.Classes.MobileApi.Common.Co;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo
 | 
			
		||||
{
 | 
			
		||||
    public class NaploFacade : NaploFacadeBase
 | 
			
		||||
    {
 | 
			
		||||
        public NaploFacade(MobileUser mobileUser) : base(mobileUser) { }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,17 @@
 | 
			
		||||
using Kreta.BusinessLogic.Classes.MobileApi.Common.Co;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo
 | 
			
		||||
{
 | 
			
		||||
    public class NaploFacadeBase
 | 
			
		||||
    {
 | 
			
		||||
        protected DefaultConnectionParameters DefaultConnectionParameters { get; }
 | 
			
		||||
        protected MobileUser MobileUser { get; }
 | 
			
		||||
 | 
			
		||||
        private NaploFacadeBase() { }
 | 
			
		||||
        public NaploFacadeBase(MobileUser mobileUser)
 | 
			
		||||
        {
 | 
			
		||||
            MobileUser = mobileUser;
 | 
			
		||||
            DefaultConnectionParameters = new DefaultConnectionParameters(mobileUser);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										156
									
								
								Kreta.BusinessLogic/Classes/MobileApi/Naplo/NaploFacadeV2.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										156
									
								
								Kreta.BusinessLogic/Classes/MobileApi/Naplo/NaploFacadeV2.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,156 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo
 | 
			
		||||
{
 | 
			
		||||
    using System;
 | 
			
		||||
    using System.Collections.Generic;
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Common.Co;
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co;
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Enum;
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Enum;
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.OpenBoard;
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.JavasoltJelenletTemplate;
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Orarend;
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanar;
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanmenet;
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanulo;
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Post.Ertekeles;
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Post.Naplozas;
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Post.OpenBoard;
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.SubqueriesRepo;
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.SubqueriesRepo.Get;
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.SubqueriesRepo.Post;
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.SubqueriesRepo.UtilityMethods;
 | 
			
		||||
    using Kreta.BusinessLogic.Interfaces;
 | 
			
		||||
    using Kreta.Client.CoreApi;
 | 
			
		||||
    using Kreta.DataAccessManual;
 | 
			
		||||
    using OrarendiOra = V2.Co.Get.Ora.OrarendiOra.JavasoltJelenlet;
 | 
			
		||||
    using TanitasiOra = V2.Co.Get.Ora.TanitasiOra.JavasoltJelenlet;
 | 
			
		||||
 | 
			
		||||
    public class NaploFacadeV2 : NaploFacade
 | 
			
		||||
    {
 | 
			
		||||
        private readonly IFileServiceHelper fileServiceHelper;
 | 
			
		||||
        private readonly ICoreApiClient coreApiClient;
 | 
			
		||||
 | 
			
		||||
        public NaploFacadeV2(MobileUser mobileUser, IFileServiceHelper fileServiceHelper, ICoreApiClient coreApiClient) : base(mobileUser)
 | 
			
		||||
        {
 | 
			
		||||
            this.fileServiceHelper = fileServiceHelper ?? throw new ArgumentNullException(nameof(fileServiceHelper));
 | 
			
		||||
            this.coreApiClient = coreApiClient ?? throw new ArgumentNullException(nameof(coreApiClient));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #region Tanar
 | 
			
		||||
 | 
			
		||||
        public ResponseWrapperCo<ProfilResponseCo> Profil(ProfilRequestCo request) => Dal.MobileConnection.Run(DefaultConnectionParameters.IntezmenyAzonosito, DefaultConnectionParameters.TanevId, h =>
 | 
			
		||||
        {
 | 
			
		||||
            var returnObject = new ResponseWrapperCo<ProfilResponseCo>(request.Hash);
 | 
			
		||||
            returnObject.FillData(TanarGetSubqueries.Profil(base.MobileUser.UserId, DefaultConnectionParameters));
 | 
			
		||||
            return returnObject;
 | 
			
		||||
        }, DefaultConnectionParameters.FelhasznaloId);
 | 
			
		||||
 | 
			
		||||
        public ResponseWrapperCo<List<IskolaorResponseCo>> Iskolaor(IskolaorRequestCo request) => Dal.MobileConnection.Run(DefaultConnectionParameters.IntezmenyAzonosito, DefaultConnectionParameters.TanevId, h =>
 | 
			
		||||
        {
 | 
			
		||||
            var returnObject = new ResponseWrapperCo<List<IskolaorResponseCo>>(request.Hash);
 | 
			
		||||
            returnObject.FillData(IskolaorGetSubqueries.Iskolaor(base.MobileUser.UserId, DefaultConnectionParameters));
 | 
			
		||||
            return returnObject;
 | 
			
		||||
        }, DefaultConnectionParameters.FelhasznaloId);
 | 
			
		||||
 | 
			
		||||
        #endregion Tanar
 | 
			
		||||
 | 
			
		||||
        #region Orarend
 | 
			
		||||
 | 
			
		||||
        public ResponseWrapperCo<List<OraGetResponseCo>> OraLista(OraGetRequestCo request) => Dal.MobileConnection.Run(DefaultConnectionParameters.IntezmenyAzonosito, DefaultConnectionParameters.TanevId, h =>
 | 
			
		||||
        {
 | 
			
		||||
            return OrarendGetSubqueries.OraLista(base.MobileUser.UserId, h, DefaultConnectionParameters.IntezmenyId, DefaultConnectionParameters.TanevId, request, DefaultConnectionParameters.IntezmenyAzonosito);
 | 
			
		||||
        }, DefaultConnectionParameters.FelhasznaloId);
 | 
			
		||||
 | 
			
		||||
        public List<OraNaplozasResponseCo> CreateOraNaplozas(List<OraNaplozasRequestCo> request) => Dal.MobileConnection.Run(DefaultConnectionParameters.IntezmenyAzonosito, DefaultConnectionParameters.TanevId, h =>
 | 
			
		||||
        {
 | 
			
		||||
            return OrarendPostSubqueries.CreateOraNaplozas(base.MobileUser.UserId, DefaultConnectionParameters.IntezmenyId, DefaultConnectionParameters.IntezmenyAzonosito, DefaultConnectionParameters.TanevId, request, fileServiceHelper, coreApiClient);
 | 
			
		||||
        }, DefaultConnectionParameters.FelhasznaloId);
 | 
			
		||||
 | 
			
		||||
        #endregion Orarend
 | 
			
		||||
 | 
			
		||||
        #region Ora
 | 
			
		||||
        #region OrarendiOra
 | 
			
		||||
 | 
			
		||||
        public List<OrarendiOra.JavasoltJelenletGetResponseCo> ListJavasoltJelenlet(OrarendiOra.JavasoltJelenletGetRequestCo request) => Dal.MobileConnection.Run(DefaultConnectionParameters.IntezmenyAzonosito, DefaultConnectionParameters.TanevId, h =>
 | 
			
		||||
        {
 | 
			
		||||
            return OrarendiOraSubqueries.ListJavasoltJelenlet(base.MobileUser.UserId, DefaultConnectionParameters.IntezmenyId, DefaultConnectionParameters.IntezmenyAzonosito, DefaultConnectionParameters.TanevId, h, request, null);
 | 
			
		||||
        }, DefaultConnectionParameters.FelhasznaloId);
 | 
			
		||||
 | 
			
		||||
        #endregion OrarendiOra
 | 
			
		||||
 | 
			
		||||
        #region TanitasiOra
 | 
			
		||||
 | 
			
		||||
        public List<TanitasiOra.JavasoltJelenletGetResponseCo> ListJavasoltJelenlet(TanitasiOra.JavasoltJelenletGetRequestCo request) => Dal.MobileConnection.Run(DefaultConnectionParameters.IntezmenyAzonosito, DefaultConnectionParameters.TanevId, h =>
 | 
			
		||||
        {
 | 
			
		||||
            return TanitasiOraSubqueries.ListJavasoltJelenlet(base.MobileUser.UserId, DefaultConnectionParameters.IntezmenyId, DefaultConnectionParameters.IntezmenyAzonosito, DefaultConnectionParameters.TanevId, h, request, Enums.OktNevelesiKategoriaEnum.NevelesOktatas);
 | 
			
		||||
        }, DefaultConnectionParameters.FelhasznaloId);
 | 
			
		||||
 | 
			
		||||
        #endregion TanitasiOra
 | 
			
		||||
 | 
			
		||||
        public ResponseWrapperCo<List<FeljegyzesResponseCo>> FeljegyzesLista(FeljegyzesRequestCo request) => Dal.MobileConnection.Run(DefaultConnectionParameters.IntezmenyAzonosito, DefaultConnectionParameters.TanevId, h =>
 | 
			
		||||
        {
 | 
			
		||||
            return OraSubqueries.FeljegyzesLista(base.MobileUser.UserId, request, DefaultConnectionParameters.IntezmenyId, DefaultConnectionParameters.IntezmenyAzonosito, DefaultConnectionParameters.TanevId);
 | 
			
		||||
        }, DefaultConnectionParameters.FelhasznaloId);
 | 
			
		||||
 | 
			
		||||
        public ResponseWrapperCo<List<MulasztasResponseCo>> MulasztasLista(MulasztasRequestCo request) => Dal.MobileConnection.Run(DefaultConnectionParameters.IntezmenyAzonosito, DefaultConnectionParameters.TanevId, h =>
 | 
			
		||||
        {
 | 
			
		||||
            var returnObject = new ResponseWrapperCo<List<MulasztasResponseCo>>(request.Hash);
 | 
			
		||||
            returnObject.FillData(OraSubqueries.MulasztasLista(base.MobileUser.UserId, request, DefaultConnectionParameters.IntezmenyId, DefaultConnectionParameters.IntezmenyAzonosito, DefaultConnectionParameters.TanevId));
 | 
			
		||||
            return returnObject;
 | 
			
		||||
        }, DefaultConnectionParameters.FelhasznaloId);
 | 
			
		||||
 | 
			
		||||
        public ResponseWrapperCo<OsztalyTanuloiResponseCo> GetOsztalyTanuloi(OsztalyTanuloiRequestCo request) => Dal.MobileConnection.Run(DefaultConnectionParameters.IntezmenyAzonosito, DefaultConnectionParameters.TanevId, h =>
 | 
			
		||||
        {
 | 
			
		||||
            var returnObject = new ResponseWrapperCo<OsztalyTanuloiResponseCo>(request.Hash);
 | 
			
		||||
            request.OraShortDatuma = DateTime.Now; ///TODO @DevKornel OraDatuma bekötése, hogy vizsgalja, ki van besorolva az adott napon
 | 
			
		||||
            returnObject.FillData(OraSubqueries.GetOsztalyTanuloi(base.MobileUser.UserId, request, DefaultConnectionParameters.IntezmenyAzonosito, DefaultConnectionParameters.IntezmenyId, DefaultConnectionParameters.TanevId));
 | 
			
		||||
            return returnObject;
 | 
			
		||||
        }, DefaultConnectionParameters.FelhasznaloId);
 | 
			
		||||
 | 
			
		||||
        public ResponseWrapperCo<List<JavasoltJelenletTemplateGetResponseCo>> ListJavasoltJelenletTemplate(JavasoltJelenletTemplateGetRequestCo request) => Dal.MobileConnection.Run(DefaultConnectionParameters.IntezmenyAzonosito, DefaultConnectionParameters.TanevId, h =>
 | 
			
		||||
        {
 | 
			
		||||
            var returnObject = new ResponseWrapperCo<List<JavasoltJelenletTemplateGetResponseCo>>(request.Hash);
 | 
			
		||||
            returnObject.FillData(OraSubqueries.ListJavasoltJelenletTemplate(base.MobileUser.UserId, request));
 | 
			
		||||
            return returnObject;
 | 
			
		||||
        }, DefaultConnectionParameters.FelhasznaloId);
 | 
			
		||||
        #endregion Ora
 | 
			
		||||
 | 
			
		||||
        #region Enum
 | 
			
		||||
 | 
			
		||||
        public ResponseWrapperCo<List<NaploEnumListItemCo>> GetNaploEnum(EnumRequestCo request) => Dal.MobileConnection.Run(DefaultConnectionParameters.IntezmenyAzonosito, DefaultConnectionParameters.TanevId, h =>
 | 
			
		||||
        {
 | 
			
		||||
            var returnObject = new ResponseWrapperCo<List<NaploEnumListItemCo>>(request.Hash);
 | 
			
		||||
            returnObject.FillData(EnumSubqueries.GetNaploEnum(h, DefaultConnectionParameters.TanevId, request));
 | 
			
		||||
            return returnObject;
 | 
			
		||||
        }, DefaultConnectionParameters.FelhasznaloId);
 | 
			
		||||
 | 
			
		||||
        #endregion Enum
 | 
			
		||||
 | 
			
		||||
        #region Tanmenet
 | 
			
		||||
 | 
			
		||||
        public List<TanmenetGetResponseCo> ListTanmenet(TanmenetGetRequestCo request) => Dal.MobileConnection.Run(DefaultConnectionParameters.IntezmenyAzonosito, DefaultConnectionParameters.TanevId, h =>
 | 
			
		||||
        {
 | 
			
		||||
            return TanmenetSubqueries.ListTanmenet(h, base.MobileUser.UserId, DefaultConnectionParameters.TanevId, DefaultConnectionParameters.IntezmenyId, DefaultConnectionParameters.IntezmenyAzonosito, request);
 | 
			
		||||
        }, DefaultConnectionParameters.FelhasznaloId);
 | 
			
		||||
        #endregion Tanmenet
 | 
			
		||||
 | 
			
		||||
        #region Ertekeles
 | 
			
		||||
 | 
			
		||||
        public List<ErtekelesResponseCo> CreateOsztalyCsoportErtekeles(List<OsztalyCsoportErtekelesRequestCo> request) => ErtekelesPostSubqueries.CreateOsztalyCsoportErtekeles(MobileUser.UserId, DefaultConnectionParameters, request);
 | 
			
		||||
 | 
			
		||||
        public List<ErtekelesGetResponseCo> GetTanuloErtekelesei(ErtekelesGetRequestCo request)
 | 
			
		||||
            => TanuloErtekeleseiGetSubqueries.GetTanuloErtekelesei(DefaultConnectionParameters, request);
 | 
			
		||||
 | 
			
		||||
        #endregion Ertekeles
 | 
			
		||||
 | 
			
		||||
        #region OpenBoard
 | 
			
		||||
        public FeltoltottFajlResponseCo CreateFajlFeltoltes(FeltoltottFajlRequestCo request) => Dal.MobileConnection.Run(DefaultConnectionParameters.IntezmenyAzonosito, DefaultConnectionParameters.TanevId, h =>
 | 
			
		||||
        {
 | 
			
		||||
            return FeltoltottFajlPostSubqueries.CreateFajlFeltoltes(h, fileServiceHelper, DefaultConnectionParameters, request);
 | 
			
		||||
        }, DefaultConnectionParameters.FelhasznaloId);
 | 
			
		||||
 | 
			
		||||
        public FeltolthetoFajlokSzamaResponseCo GetFeltolthetoFajlokSzama(FeltolthetoFajlokSzamaRequestCo request)
 | 
			
		||||
            => FeltolthetoFajlokSzamaGetSubqueries.GetFeltolthetoFajlokSzama(DefaultConnectionParameters, request);
 | 
			
		||||
        #endregion OpenBoard
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,19 @@
 | 
			
		||||
using System.ComponentModel.DataAnnotations;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Enum
 | 
			
		||||
{
 | 
			
		||||
    public enum ErtekelesErtekFajta
 | 
			
		||||
    {
 | 
			
		||||
        None,
 | 
			
		||||
        [Display(Name = "Elégtelen (1) és Jeles (5) között az öt alapértelmezett érték")]
 | 
			
		||||
        Osztalyzat = 1,
 | 
			
		||||
        [Display(Name = "Szöveges értékelés")]
 | 
			
		||||
        Szoveges = 2,
 | 
			
		||||
        [Display(Name = "Százalékos értékelés")]
 | 
			
		||||
        Szazalekos = 3,
 | 
			
		||||
        [Display(Name = "Rossz, Változó, Jó, Példás")]
 | 
			
		||||
        MagatartasErtek = 4,
 | 
			
		||||
        [Display(Name = "Hanyag, Változó, Jó, Példás")]
 | 
			
		||||
        SzorgalomErtek = 5
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,58 @@
 | 
			
		||||
using System;
 | 
			
		||||
using Kreta.Core.Validation.Exceptions;
 | 
			
		||||
using Kreta.Core.Validation.Exceptions.Enum;
 | 
			
		||||
using Kreta.Resources;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Enum
 | 
			
		||||
{
 | 
			
		||||
    public class NaploEnumCo<T> where T : struct, IConvertible
 | 
			
		||||
    {
 | 
			
		||||
        public static implicit operator NaploEnumCo<T>(int id) => new NaploEnumCo<T>(id);
 | 
			
		||||
        public static implicit operator NaploEnumCo<T>(T enumValue) => new NaploEnumCo<T>(Convert.ToInt32(enumValue));
 | 
			
		||||
        public static bool operator ==(NaploEnumCo<T> lhsWrapperCo, T rhsEnum) => lhsWrapperCo.GetEnum().Equals(rhsEnum);
 | 
			
		||||
        public static bool operator !=(NaploEnumCo<T> lhsWrapperCo, T rhsEnum) => !lhsWrapperCo.GetEnum().Equals(rhsEnum);
 | 
			
		||||
 | 
			
		||||
        public string EnumTypeNameWPostFix => typeof(T).Name;
 | 
			
		||||
        public string EnumTypeName => EnumTypeNameWPostFix.Replace("Enum", "").Replace("enum", "");
 | 
			
		||||
        public bool IsGeneratedEnum => !string.IsNullOrWhiteSpace(Nev);
 | 
			
		||||
 | 
			
		||||
        public T GetEnum()
 | 
			
		||||
        {
 | 
			
		||||
            T enumValue;
 | 
			
		||||
 | 
			
		||||
            if (!System.Enum.TryParse<T>(Nev, out enumValue))
 | 
			
		||||
            {
 | 
			
		||||
                throw new ValidationException(ValidationErrorType.ResourceNotFound, ErrorResource.NemEngedelyezettVagyNemLetezoEnum);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return enumValue;
 | 
			
		||||
        }
 | 
			
		||||
        public int Id { get; private set; }
 | 
			
		||||
        public string Nev { get; private set; }
 | 
			
		||||
 | 
			
		||||
        public NaploEnumCo(int id)
 | 
			
		||||
        {
 | 
			
		||||
            Fill(id);
 | 
			
		||||
            if (!typeof(T).IsEnum)
 | 
			
		||||
            {
 | 
			
		||||
                throw new ArgumentException("T must be an enum");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void Fill(int id)
 | 
			
		||||
        {
 | 
			
		||||
            Id = id;
 | 
			
		||||
            Nev = System.Enum.GetName(typeof(T), id);
 | 
			
		||||
            if (!typeof(T).IsEnum)
 | 
			
		||||
            {
 | 
			
		||||
                throw new ArgumentException("T must be an enum");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public NaploEnumCo(int id, string nev)
 | 
			
		||||
        {
 | 
			
		||||
            Id = id;
 | 
			
		||||
            Nev = nev;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,32 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Enum
 | 
			
		||||
{
 | 
			
		||||
    public class NaploEnumListCo<T> where T : struct, IConvertible
 | 
			
		||||
    {
 | 
			
		||||
        private T KretaEnum { get; }
 | 
			
		||||
        public List<NaploEnumListItemCo> ElemLista { get; } = new List<NaploEnumListItemCo>();
 | 
			
		||||
 | 
			
		||||
        public string EnumTypeNameWPostFix => typeof(T).Name;
 | 
			
		||||
        public string EnumTypeName => EnumTypeNameWPostFix.Replace("Enum", "").Replace("enum", "");
 | 
			
		||||
 | 
			
		||||
        public NaploEnumListCo()
 | 
			
		||||
        {
 | 
			
		||||
            if (!typeof(T).IsEnum)
 | 
			
		||||
                throw new ArgumentException("T must be an enum");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void Fill(List<KeyValuePair<int, string>> idAndDescriptionList)
 | 
			
		||||
        {
 | 
			
		||||
            foreach (var idAndDescription in idAndDescriptionList)
 | 
			
		||||
            {
 | 
			
		||||
                ElemLista.Add(new NaploEnumListItemCo(idAndDescription.Key, System.Enum.GetName(typeof(T), idAndDescription.Key), idAndDescription.Value));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        public void Fill(int id, string description)
 | 
			
		||||
        {
 | 
			
		||||
            ElemLista.Add(new NaploEnumListItemCo(id, System.Enum.GetName(typeof(T), id), description));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,16 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Enum
 | 
			
		||||
{
 | 
			
		||||
    public class NaploEnumListItemCo
 | 
			
		||||
    {
 | 
			
		||||
        public int Id { get; }
 | 
			
		||||
        public string Name { get; }
 | 
			
		||||
        public string Description { get; }
 | 
			
		||||
 | 
			
		||||
        public NaploEnumListItemCo(int Id, string name, string description)
 | 
			
		||||
        {
 | 
			
		||||
            this.Id = Id;
 | 
			
		||||
            this.Name = name;
 | 
			
		||||
            this.Description = description;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,12 @@
 | 
			
		||||
using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Enum;
 | 
			
		||||
using Kreta.Enums.ManualEnums.WebApi.Naplo;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Enum
 | 
			
		||||
{
 | 
			
		||||
    public class EnumRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public string Hash { get; set; }
 | 
			
		||||
        public NaploEnumCo<EngedelyezettEnumok> EngedelyezettEnum { get; set; }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,14 @@
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Felmentes
 | 
			
		||||
{
 | 
			
		||||
    public class FelmentesGetRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public IEnumerable<int> TanuloIds { get; set; }
 | 
			
		||||
        public int FelhasznaloId { get; set; }
 | 
			
		||||
        public int IntezmenyId { get; set; }
 | 
			
		||||
        public string IntezmenyAzonosito { get; set; }
 | 
			
		||||
        public int TanevId { get; set; }
 | 
			
		||||
        public int TantargyId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,25 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Felmentes
 | 
			
		||||
{
 | 
			
		||||
    using System;
 | 
			
		||||
 | 
			
		||||
    public class FelmentesGetResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int Id { get; set; }
 | 
			
		||||
 | 
			
		||||
        public bool IsErtekelesAlolFelmentett { get; set; }
 | 
			
		||||
 | 
			
		||||
        public bool IsOralatogatasAlolFelmentett { get; set; }
 | 
			
		||||
 | 
			
		||||
        public bool IsSzovegesenErtekelheto { get; set; }
 | 
			
		||||
 | 
			
		||||
        public string FelmentesOkSzovege { get; set; }
 | 
			
		||||
 | 
			
		||||
        public DateTime? KezdetDatuma { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int TantargyId { get; set; }
 | 
			
		||||
 | 
			
		||||
        public string TantargyNev { get; set; }
 | 
			
		||||
 | 
			
		||||
        public DateTime? VegDatuma { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,8 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.OpenBoard
 | 
			
		||||
{
 | 
			
		||||
    public class FeltolthetoFajlokSzamaRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public int? OrarendiOraId { get; set; }
 | 
			
		||||
        public int? TanitasiOraId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,10 @@
 | 
			
		||||
using Kreta.Core.Validation.Exceptions;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.OpenBoard
 | 
			
		||||
{
 | 
			
		||||
    public class FeltolthetoFajlokSzamaResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int FeltolthetoFajlokSzama { get; set; }
 | 
			
		||||
        public ValidationException Exception { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,11 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.Common
 | 
			
		||||
{
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Enum;
 | 
			
		||||
 | 
			
		||||
    public interface IJavasoltJelenletSzuroGetResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        string Megjegyzes { get; set; }
 | 
			
		||||
 | 
			
		||||
        JavasoltJelenletTemplateType Tipus { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,10 @@
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.Common
 | 
			
		||||
{
 | 
			
		||||
    public interface IJavasoltJelenletTanuloGetResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        int TanuloId { get; set; }
 | 
			
		||||
        List<IJavasoltJelenletSzuroGetResponseCo> JavasoltJelenletTemplateTipusSzuroLista { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.EgyediOra.JavasoltJelenlet
 | 
			
		||||
{
 | 
			
		||||
    public class JavasoltJelenletGetRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public JavasoltJelenletKeyGetRequestCo[] Key { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,13 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.EgyediOra.JavasoltJelenlet
 | 
			
		||||
{
 | 
			
		||||
    public class JavasoltJelenletGetResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int TantargyId { get; set; }
 | 
			
		||||
        public int OsztalyCsoportId { get; set; }
 | 
			
		||||
        public DateTime OraKezdetDatuma { get; set; }
 | 
			
		||||
        public List<JavasoltJelenletTanuloGetResponseCo> TanuloLista { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,15 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.EgyediOra.JavasoltJelenlet
 | 
			
		||||
{
 | 
			
		||||
    using System;
 | 
			
		||||
 | 
			
		||||
    public class JavasoltJelenletKeyGetRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public DateTime OraKezdetDatuma { get; set; }
 | 
			
		||||
 | 
			
		||||
        public DateTime OraVegDatuma { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int OsztalyCsoportId { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int TantargyId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,22 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.EgyediOra.JavasoltJelenlet
 | 
			
		||||
{
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.Common;
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Enum;
 | 
			
		||||
 | 
			
		||||
    public class JavasoltJelenletSzuroGetResponseCo : IJavasoltJelenletSzuroGetResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public JavasoltJelenletSzuroGetResponseCo(JavasoltJelenletTemplateType tipus)
 | 
			
		||||
        {
 | 
			
		||||
            this.Megjegyzes = Constant.GetMegjegyzesByJavasoltJelenletTemplateType(tipus);
 | 
			
		||||
            this.Tipus = tipus;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private JavasoltJelenletSzuroGetResponseCo()
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public string Megjegyzes { get; set; }
 | 
			
		||||
 | 
			
		||||
        public JavasoltJelenletTemplateType Tipus { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,11 @@
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.Common;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.EgyediOra.JavasoltJelenlet
 | 
			
		||||
{
 | 
			
		||||
    public class JavasoltJelenletTanuloGetResponseCo : IJavasoltJelenletTanuloGetResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int TanuloId { get; set; }
 | 
			
		||||
        public List<IJavasoltJelenletSzuroGetResponseCo> JavasoltJelenletTemplateTipusSzuroLista { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,10 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.JavasoltJelenletTemplate
 | 
			
		||||
{
 | 
			
		||||
    using Kreta.Enums.ManualEnums;
 | 
			
		||||
 | 
			
		||||
    public class JavasoltJelenletTemplateGetRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public string Hash { get; set; }
 | 
			
		||||
        public TanoraAllapotaEnum OraAllapot { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,12 @@
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Enum;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.JavasoltJelenletTemplate
 | 
			
		||||
{
 | 
			
		||||
    public class JavasoltJelenletTemplateGetResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int Prioritas { get; set; }
 | 
			
		||||
        public JavasoltJelenletTemplateType Tipus { get; set; }
 | 
			
		||||
        public List<JavasoltJelenletTemplateItemGetResponseCo> SzuroElemLista { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,23 @@
 | 
			
		||||
using System;
 | 
			
		||||
using Kreta.Enums;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.JavasoltJelenletTemplate
 | 
			
		||||
{
 | 
			
		||||
    public class JavasoltJelenletTemplateItemGetResponseCo : IEquatable<JavasoltJelenletTemplateItemGetResponseCo>
 | 
			
		||||
    {
 | 
			
		||||
        public JavasoltJelenletTemplateItemGetResponseCo(bool isDefault, bool isEnabled, MulasztasTipusEnum mulasztasTipusAdatszotar)
 | 
			
		||||
        {
 | 
			
		||||
            IsDefault = isDefault;
 | 
			
		||||
            IsEnabled = isEnabled;
 | 
			
		||||
            MulasztasTipusAdatszotar = mulasztasTipusAdatszotar;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public bool IsDefault { get; set; }
 | 
			
		||||
        public bool IsEnabled { get; set; }
 | 
			
		||||
        public MulasztasTipusEnum MulasztasTipusAdatszotar { get; set; }
 | 
			
		||||
 | 
			
		||||
        public bool Equals(JavasoltJelenletTemplateItemGetResponseCo other) => MulasztasTipusAdatszotar == other.MulasztasTipusAdatszotar;
 | 
			
		||||
 | 
			
		||||
        public override int GetHashCode() => MulasztasTipusAdatszotar.GetHashCode();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.OrarendiOra.JavasoltJelenlet
 | 
			
		||||
{
 | 
			
		||||
    public class JavasoltJelenletGetRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public JavasoltJelenletKeyGetRequestCo[] Key { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,12 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.OrarendiOra.JavasoltJelenlet
 | 
			
		||||
{
 | 
			
		||||
    public class JavasoltJelenletGetResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int OrarendiOraId { get; set; }
 | 
			
		||||
        public DateTime OraKezdetDatuma { get; set; }
 | 
			
		||||
        public List<JavasoltJelenletTanuloGetResponseCo> TanuloLista { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,12 @@
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.OrarendiOra.JavasoltJelenlet
 | 
			
		||||
{
 | 
			
		||||
    public class JavasoltJelenletKeyGetRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public int OrarendiOraId { get; set; }
 | 
			
		||||
        public DateTime OraKezdetDatuma { get; set; }
 | 
			
		||||
        public DateTime OraVegDatuma { get; set; }
 | 
			
		||||
        public bool IsHelyettesitesKeresoAltalTalaltOra { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,22 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.OrarendiOra.JavasoltJelenlet
 | 
			
		||||
{
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.Common;
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Enum;
 | 
			
		||||
 | 
			
		||||
    public class JavasoltJelenletSzuroGetResponseCo : IJavasoltJelenletSzuroGetResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public JavasoltJelenletSzuroGetResponseCo(JavasoltJelenletTemplateType tipus)
 | 
			
		||||
        {
 | 
			
		||||
            this.Megjegyzes = Constant.GetMegjegyzesByJavasoltJelenletTemplateType(tipus);
 | 
			
		||||
            this.Tipus = tipus;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private JavasoltJelenletSzuroGetResponseCo()
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public string Megjegyzes { get; set; }
 | 
			
		||||
 | 
			
		||||
        public JavasoltJelenletTemplateType Tipus { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,11 @@
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.Common;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.OrarendiOra.JavasoltJelenlet
 | 
			
		||||
{
 | 
			
		||||
    public class JavasoltJelenletTanuloGetResponseCo : IJavasoltJelenletTanuloGetResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int TanuloId { get; set; }
 | 
			
		||||
        public List<IJavasoltJelenletSzuroGetResponseCo> JavasoltJelenletTemplateTipusSzuroLista { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.TanitasiOra.JavasoltJelenlet
 | 
			
		||||
{
 | 
			
		||||
    public class JavasoltJelenletGetRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public JavasoltJelenletKeyGetRequestCo[] Key { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,10 @@
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.TanitasiOra.JavasoltJelenlet
 | 
			
		||||
{
 | 
			
		||||
    public class JavasoltJelenletGetResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int TanitasiOraId { get; set; }
 | 
			
		||||
        public List<JavasoltJelenletTanuloGetResponseCo> TanuloLista { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.TanitasiOra.JavasoltJelenlet
 | 
			
		||||
{
 | 
			
		||||
    public class JavasoltJelenletKeyGetRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public int TanitasiOraId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,22 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.TanitasiOra.JavasoltJelenlet
 | 
			
		||||
{
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.Common;
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Enum;
 | 
			
		||||
 | 
			
		||||
    public class JavasoltJelenletSzuroGetResponseCo : IJavasoltJelenletSzuroGetResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public JavasoltJelenletSzuroGetResponseCo(JavasoltJelenletTemplateType tipus)
 | 
			
		||||
        {
 | 
			
		||||
            this.Megjegyzes = Constant.GetMegjegyzesByJavasoltJelenletTemplateType(tipus);
 | 
			
		||||
            this.Tipus = tipus;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private JavasoltJelenletSzuroGetResponseCo()
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public string Megjegyzes { get; set; }
 | 
			
		||||
 | 
			
		||||
        public JavasoltJelenletTemplateType Tipus { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,11 @@
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.Common;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Ora.TanitasiOra.JavasoltJelenlet
 | 
			
		||||
{
 | 
			
		||||
    public class JavasoltJelenletTanuloGetResponseCo : IJavasoltJelenletTanuloGetResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int TanuloId { get; set; }
 | 
			
		||||
        public List<IJavasoltJelenletSzuroGetResponseCo> JavasoltJelenletTemplateTipusSzuroLista { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,10 @@
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Orarend
 | 
			
		||||
{
 | 
			
		||||
    public class OraGetRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public string Hash { get; set; }
 | 
			
		||||
        public DateTime Datum { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,30 @@
 | 
			
		||||
using System;
 | 
			
		||||
using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Enum;
 | 
			
		||||
using Kreta.Enums.ManualEnums;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Orarend
 | 
			
		||||
{
 | 
			
		||||
    public class OraGetResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int? OrarendiOraId { get; set; }
 | 
			
		||||
        public int? TanitasiOraId { get; set; }
 | 
			
		||||
        public NaploEnumCo<TanoraAllapotaEnum> Allapot { get; set; }
 | 
			
		||||
        public DateTime Kezdete { get; set; }
 | 
			
		||||
        public DateTime Vege { get; set; }
 | 
			
		||||
        public int? Oraszam { get; set; }
 | 
			
		||||
        public int? EvesOraszam { get; set; }
 | 
			
		||||
        public bool IsElmaradt { get; set; }
 | 
			
		||||
        public string Tema { get; set; }
 | 
			
		||||
        public int TantargyId { get; set; }
 | 
			
		||||
        public string TantargyNev { get; set; }
 | 
			
		||||
        public string TantargyKategoria { get; set; }
 | 
			
		||||
        public int OsztalyCsoportId { get; set; }
 | 
			
		||||
        public string OsztalyCsoportNev { get; set; }
 | 
			
		||||
        public string TeremNev { get; set; }
 | 
			
		||||
        public string HazifeladatSzovege { get; set; }
 | 
			
		||||
        public int? HazifeladatId { get; set; }
 | 
			
		||||
        public DateTime? HazifeladatHatarido { get; set; }
 | 
			
		||||
        public TanarSimplifiedGetResponseCo OraTulajdonosTanar { get; set; }
 | 
			
		||||
        public int? HelyettesitoId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,9 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Orarend
 | 
			
		||||
{
 | 
			
		||||
    public class TanarSimplifiedGetResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int Id { get; set; }
 | 
			
		||||
        public string Nev { get; set; }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanar
 | 
			
		||||
{
 | 
			
		||||
    public class IskolaorRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public string Hash { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,15 @@
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanar
 | 
			
		||||
{
 | 
			
		||||
    public class IskolaorResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int Id { get; set; }
 | 
			
		||||
        public string Nev { get; set; }
 | 
			
		||||
        public int FeladatEllatasiHelyId { get; set; }
 | 
			
		||||
        public string FeladatEllatasiHely { get; set; }
 | 
			
		||||
        public string EmailCim { get; set; }
 | 
			
		||||
        public string Telefonszam { get; set; }
 | 
			
		||||
        public string IdpEgyediAzonosito { get; set; }
 | 
			
		||||
        public string IntezmenyAzonosito { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanar
 | 
			
		||||
{
 | 
			
		||||
    public class ProfilRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public string Hash { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,14 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanar
 | 
			
		||||
{
 | 
			
		||||
    public class ProfilResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int Id { get; set; }
 | 
			
		||||
        public string Nev { get; set; }
 | 
			
		||||
        public string Kep { get; set; }
 | 
			
		||||
        public int FeladatEllatasiHelyId { get; set; }
 | 
			
		||||
        public string FeladatEllatasiHely { get; set; }
 | 
			
		||||
        public string PublikusEmailCim { get; set; }
 | 
			
		||||
        public string MunkahelyiEmailCim { get; set; }
 | 
			
		||||
        public string PublikusTelefonszam { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,7 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanmenet
 | 
			
		||||
{
 | 
			
		||||
    public class TanmenetGetRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public TanmenetKeyGetRequestCo[] Key { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,12 @@
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanmenet
 | 
			
		||||
{
 | 
			
		||||
    public class TanmenetGetResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int OsztalyCsoportId { get; set; }
 | 
			
		||||
        public int TantargyId { get; set; }
 | 
			
		||||
        public int FeltoltoTanarId { get; set; }
 | 
			
		||||
        public List<TanmenetItemGetResponseCo> Items { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,12 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanmenet
 | 
			
		||||
{
 | 
			
		||||
    public class TanmenetItemGetResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int Id { get; set; }
 | 
			
		||||
        public string Megjegyzes { get; set; }
 | 
			
		||||
        public string Nev { get; set; }
 | 
			
		||||
        public string RovidNev { get; set; }
 | 
			
		||||
        public string Tema { get; set; }
 | 
			
		||||
        public int EvesOraszam { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,9 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanmenet
 | 
			
		||||
{
 | 
			
		||||
    public class TanmenetKeyGetRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public int OsztalyCsoportId { get; set; }
 | 
			
		||||
        public int TantargyId { get; set; }
 | 
			
		||||
        public int FeltoltoTanarId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,11 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanulo
 | 
			
		||||
{
 | 
			
		||||
    public class ErtekelesFajtaCo
 | 
			
		||||
    {
 | 
			
		||||
        public int? Osztalyzat { get; set; }
 | 
			
		||||
 | 
			
		||||
        public string Szoveg { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int? Szazalek { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,9 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanulo
 | 
			
		||||
{
 | 
			
		||||
    public class ErtekelesGetRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public int TanuloId { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int TantargyId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,23 @@
 | 
			
		||||
using System;
 | 
			
		||||
using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Enum;
 | 
			
		||||
using Kreta.Enums;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanulo
 | 
			
		||||
{
 | 
			
		||||
    public class ErtekelesGetResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int Id { get; set; }
 | 
			
		||||
 | 
			
		||||
        public ErtekelesFajtaCo Ertekeles { get; set; }
 | 
			
		||||
 | 
			
		||||
        public DateTime Datum { get; set; }
 | 
			
		||||
 | 
			
		||||
        public NaploEnumCo<ErtekelesTipusEnum> Tipus { get; set; }
 | 
			
		||||
 | 
			
		||||
        public NaploEnumCo<ErtekelesModEnum> Mod { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int Suly { get; set; }
 | 
			
		||||
 | 
			
		||||
        public string Tema { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,125 @@
 | 
			
		||||
using System;
 | 
			
		||||
using Kreta.Core.CustomAttributes;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanulo
 | 
			
		||||
{
 | 
			
		||||
    public class ErtekelesResponseDao
 | 
			
		||||
    {
 | 
			
		||||
        [ColumnName("TipusId")]
 | 
			
		||||
        public int TipusId { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("TipusId_DNAME")]
 | 
			
		||||
        public string TipusNeve { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("Datum")]
 | 
			
		||||
        public DateTime Datum { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("ID")]
 | 
			
		||||
        public int Id { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("ErtekeloId")]
 | 
			
		||||
        public int ErtekeloId { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("ErtekeloNyomtatasiNev")]
 | 
			
		||||
        public string ErtekeloNyomtatasiNev { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("IsMagatartasSzorgalom")]
 | 
			
		||||
        public bool IsMagatartasSzorgalom { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("RogzitesDatum")]
 | 
			
		||||
        public DateTime RogzitesDatum { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("OsztalyCsoportId")]
 | 
			
		||||
        public int OsztalyCsoportId { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("ErtekelesModId")]
 | 
			
		||||
        public int? ErtekelesModId { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("ErtekelesModId_DNAME")]
 | 
			
		||||
        public string ErtekelesModNeve { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("ErtekelesTema")]
 | 
			
		||||
        public string ErtekelesTema { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("TantargyId")]
 | 
			
		||||
        public int? TantargyId { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("TantargyNev")]
 | 
			
		||||
        public string TantargyNev { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("TantargyKategoriaId")]
 | 
			
		||||
        public int? TantargyKategoriaId { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("TantargyKategoriaId_DNAME")]
 | 
			
		||||
        public string TantargyKategoriaNeve { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("IsFotargy")]
 | 
			
		||||
        public bool? IsFotargy { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("SorSzam")]
 | 
			
		||||
        public int? SorSzam { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("FotargyId")]
 | 
			
		||||
        public int? FotargyId { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("FotargyNev")]
 | 
			
		||||
        public string FotargyNev { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("FotargyTantargyKategoriaId")]
 | 
			
		||||
        public int? FotargyTantargyKategoriaId { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("ErtekelesOsztalyzatId_DNAME")]
 | 
			
		||||
        public string ErtekelesOsztalyzatNeve { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("ErtekelesSzoveg")]
 | 
			
		||||
        public string ErtekelesSzoveg { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("SzovegesErtekelesRovidNev")]
 | 
			
		||||
        public string SzovegesErtekelesRovidNev { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("ErtekelesSzovegFormazott")]
 | 
			
		||||
        public string ErtekelesSzovegFormazott { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("ErtekelesSzazalek")]
 | 
			
		||||
        public int? ErtekelesSzazalekErteke { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("ErtekelesOsztalyzatId")]
 | 
			
		||||
        public int? ErtekelesOsztalyzatId { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("ErtekelesSuly")]
 | 
			
		||||
        public int ErtekelesSuly { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("MagatartasOsztalyzatId_DNAME")]
 | 
			
		||||
        public string MagatartasOsztalyzatSzovegesen { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("MagatartasSzoveg")]
 | 
			
		||||
        public string MagatartasSzoveg { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("MagatartasSzovegFormazott")]
 | 
			
		||||
        public string MagatartasSzovegFormazott { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("MagatartasErtekId_DNAME")]
 | 
			
		||||
        public string MagatartasErtekSzovegesen { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("MagatartasOsztalyzatId")]
 | 
			
		||||
        public int? MagatartasOsztalyzatId { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("SzorgalomOsztalyzatId_DNAME")]
 | 
			
		||||
        public string SzorgalomOsztalyzatSzovegesen { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("SzorgalomSzoveg")]
 | 
			
		||||
        public string SzorgalomSzoveg { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("SzorgalomSzovegFormazott")]
 | 
			
		||||
        public string SzorgalomSzovegFormazott { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("SzorgalomErtekId_DNAME")]
 | 
			
		||||
        public string SzorgalomErtekSzoveges { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("SzorgalomOsztalyzatId")]
 | 
			
		||||
        public int? SzorgalomOsztalyzatId { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("TanuloId")]
 | 
			
		||||
        public int TanuloId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,8 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanulo
 | 
			
		||||
{
 | 
			
		||||
    public class FeljegyzesRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public string Hash { get; set; }
 | 
			
		||||
        public int TanoraId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,18 @@
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Enum;
 | 
			
		||||
using Kreta.Enums;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanulo
 | 
			
		||||
{
 | 
			
		||||
    public class FeljegyzesResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public List<FeljegyzesInfoResponseCo> FeljegyzesLista { get; set; }
 | 
			
		||||
        public int TanuloId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public class FeljegyzesInfoResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int Id { get; set; }
 | 
			
		||||
        public NaploEnumCo<EsemenyTipusEnum> Tipus { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,8 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanulo
 | 
			
		||||
{
 | 
			
		||||
    public class MulasztasRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public string Hash { get; set; }
 | 
			
		||||
        public int TanoraId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,13 @@
 | 
			
		||||
using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Enum;
 | 
			
		||||
using Kreta.Enums;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanulo
 | 
			
		||||
{
 | 
			
		||||
    public class MulasztasResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int Id { get; set; }
 | 
			
		||||
        public NaploEnumCo<MulasztasTipusEnum> Tipus { get; set; }
 | 
			
		||||
        public int? Keses { get; set; }
 | 
			
		||||
        public int TanuloId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,15 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanulo
 | 
			
		||||
{
 | 
			
		||||
    using System;
 | 
			
		||||
 | 
			
		||||
    public class OsztalyTanuloiRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        private DateTime? oraShortDatuma;
 | 
			
		||||
 | 
			
		||||
        public string Hash { get; set; }
 | 
			
		||||
 | 
			
		||||
        public DateTime? OraShortDatuma { get => this.oraShortDatuma; set => this.oraShortDatuma = value?.Date; }
 | 
			
		||||
 | 
			
		||||
        public int OsztalyCsoportId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,11 @@
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanulo
 | 
			
		||||
{
 | 
			
		||||
    public class OsztalyTanuloiResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int Id { get; set; }
 | 
			
		||||
        public string Nev { get; set; }
 | 
			
		||||
        public List<TanuloResponseCo> TanuloLista { get; set; } = new List<TanuloResponseCo>();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,9 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanulo
 | 
			
		||||
{
 | 
			
		||||
    public class TanugyiAdatokGetResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public bool IsJogviszonySzunetelteto { get; set; }
 | 
			
		||||
 | 
			
		||||
        public bool IsSzakmaiGyakorlatonLevo { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,21 @@
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanulo
 | 
			
		||||
{
 | 
			
		||||
    public class TanuloMentessegResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int TantargyId { get; set; }
 | 
			
		||||
        public bool IsErtkelesMentesseg { get; set; }
 | 
			
		||||
        public bool IsSzovegesenErtekelheto { get; set; }
 | 
			
		||||
        public bool IsTanoraLatogatasMentesseg { get; set; }
 | 
			
		||||
 | 
			
		||||
        public TanuloMentessegResponseCo() { }
 | 
			
		||||
 | 
			
		||||
        public TanuloMentessegResponseCo(int? tantargyId, bool? isErtekelesMentesseg, bool? isSzovegesenErtekelheto, bool? isOraMentesites)
 | 
			
		||||
        {
 | 
			
		||||
            TantargyId = tantargyId.Value;
 | 
			
		||||
            IsErtkelesMentesseg = isErtekelesMentesseg ?? false;
 | 
			
		||||
            IsSzovegesenErtekelheto = isSzovegesenErtekelheto ?? false;
 | 
			
		||||
            IsTanoraLatogatasMentesseg = isOraMentesites ?? false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,36 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanulo
 | 
			
		||||
{
 | 
			
		||||
    public class TanuloResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int Id { get; set; }
 | 
			
		||||
        public string Nev { get; set; }
 | 
			
		||||
        public string AnyjaNev { get; set; }
 | 
			
		||||
        public DateTime Szuletes { get; set; }
 | 
			
		||||
        public bool IsMaganTanulo { get; set; }
 | 
			
		||||
        public DateTime? MaganTanulosagKezdetDatuma { get; set; }
 | 
			
		||||
        public DateTime? MaganTanulosagVegeDatuma { get; set; }
 | 
			
		||||
        public TanugyiAdatokGetResponseCo TanugyiAdatok { get; set; }
 | 
			
		||||
        public List<TanuloMentessegResponseCo> Felmentesek { get; set; } = new List<TanuloMentessegResponseCo>();
 | 
			
		||||
 | 
			
		||||
        public TanuloResponseCo() { }
 | 
			
		||||
 | 
			
		||||
        public TanuloResponseCo(TanuloResponseDao dao)
 | 
			
		||||
        {
 | 
			
		||||
            Id = dao.TanuloId;
 | 
			
		||||
            Nev = dao.NyomtatasiNev;
 | 
			
		||||
            AnyjaNev = dao.AnyjaNeve;
 | 
			
		||||
            Szuletes = dao.SzuletesiDatum;
 | 
			
		||||
            IsMaganTanulo = dao.IsMaganTanulo ?? false;
 | 
			
		||||
            MaganTanulosagKezdetDatuma = dao.MaganTanulosagKezdetDatuma;
 | 
			
		||||
            MaganTanulosagVegeDatuma = dao.MaganTanulosagVegeDatuma;
 | 
			
		||||
            TanugyiAdatok = new TanugyiAdatokGetResponseCo
 | 
			
		||||
            {
 | 
			
		||||
                IsJogviszonySzunetelteto = dao.IsJogviszonySzunetelteto ?? false,
 | 
			
		||||
                IsSzakmaiGyakorlatonLevo = dao.IsSzakmaiGyakorlatonLevo ?? false
 | 
			
		||||
            };
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,50 @@
 | 
			
		||||
using System;
 | 
			
		||||
using Kreta.Core.CustomAttributes;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Get.Tanulo
 | 
			
		||||
{
 | 
			
		||||
    public class TanuloResponseDao
 | 
			
		||||
    {
 | 
			
		||||
        [ColumnName("TanuloId")]
 | 
			
		||||
        public int TanuloId { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("TanuloNyomtatasiNev")]
 | 
			
		||||
        public string NyomtatasiNev { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("TanuloAnyjaNev")]
 | 
			
		||||
        public string AnyjaNeve { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("TanuloSzuletesiDatum")]
 | 
			
		||||
        public DateTime SzuletesiDatum { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("OsztalyCsoportNev")]
 | 
			
		||||
        public string OsztalyCsoportNev { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("IsMaganTanulo")]
 | 
			
		||||
        public bool? IsMaganTanulo { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("MaganTanulosagKezdetDatuma")]
 | 
			
		||||
        public DateTime? MaganTanulosagKezdetDatuma { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("MaganTanulosagVegeDatuma")]
 | 
			
		||||
        public DateTime? MaganTanulosagVegeDatuma { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("IsJogviszonySzunetelteto")]
 | 
			
		||||
        public bool? IsJogviszonySzunetelteto { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("IsSzakmaiGyakorlatonLevo")]
 | 
			
		||||
        public bool? IsSzakmaiGyakorlatonLevo { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("TantargyId")]
 | 
			
		||||
        public int? TantargyId { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("IsErtekelesMentesseg")]
 | 
			
		||||
        public bool? IsErtekelesMentesseg { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("IsSzovegesenErtekelheto")]
 | 
			
		||||
        public bool? IsSzovegesenErtekelheto { get; set; }
 | 
			
		||||
 | 
			
		||||
        [ColumnName("IsOraMentesites")]
 | 
			
		||||
        public bool? IsOraMentesites { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,12 @@
 | 
			
		||||
using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Enum;
 | 
			
		||||
using Kreta.Enums;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Post.Ertekeles
 | 
			
		||||
{
 | 
			
		||||
    public class ErtekelesRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public NaploEnumCo<OsztalyzatTipusEnum> OsztalyzatTipus { get; set; }
 | 
			
		||||
        public int? Szazalek { get; set; }
 | 
			
		||||
        public string Szoveg { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,10 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Post.Ertekeles
 | 
			
		||||
{
 | 
			
		||||
    using Kreta.Core.Validation.Exceptions;
 | 
			
		||||
 | 
			
		||||
    public class ErtekelesResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public ValidationException Exception { get; set; }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,24 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Post.Ertekeles
 | 
			
		||||
{
 | 
			
		||||
    using System;
 | 
			
		||||
    using System.Collections.Generic;
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Enum;
 | 
			
		||||
    using Kreta.Enums;
 | 
			
		||||
 | 
			
		||||
    public class OsztalyCsoportErtekelesRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public DateTime Datum { get; set; }
 | 
			
		||||
 | 
			
		||||
        public NaploEnumCo<ErtekelesModEnum> Mod { get; set; }
 | 
			
		||||
 | 
			
		||||
        public NaploEnumCo<ErtekelesTipusEnum> Tipus { get; set; }
 | 
			
		||||
 | 
			
		||||
        public string Tema { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int OsztalyCsoportId { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int TantargyId { get; set; }
 | 
			
		||||
 | 
			
		||||
        public List<TanuloForOsztalyCsoportErtekelesRequestCo> TanuloLista { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,9 @@
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Post.Ertekeles
 | 
			
		||||
{
 | 
			
		||||
    public class OsztalyCsoportErtekelesResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public List<TanuloForOsztalyCsoportErtekelesResponseCo> TanuloLista { get; set; } = new List<TanuloForOsztalyCsoportErtekelesResponseCo>();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,11 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Post.Ertekeles
 | 
			
		||||
{
 | 
			
		||||
    public class TanuloForOsztalyCsoportErtekelesRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public ErtekelesRequestCo Ertekeles { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int TanuloId { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int MobilId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,8 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Post.Ertekeles
 | 
			
		||||
{
 | 
			
		||||
    public class TanuloForOsztalyCsoportErtekelesResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int Id { get; set; }
 | 
			
		||||
        public int ErtekelesId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,11 @@
 | 
			
		||||
using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Enum;
 | 
			
		||||
using Kreta.Enums;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Post.Naplozas
 | 
			
		||||
{
 | 
			
		||||
    public class MulasztasForOraNaplozasRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public NaploEnumCo<MulasztasTipusEnum> Tipus { get; set; }
 | 
			
		||||
        public int? Keses { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,126 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.ComponentModel.DataAnnotations;
 | 
			
		||||
using Kreta.BusinessLogic.Logic.Naplozas;
 | 
			
		||||
using Kreta.Enums;
 | 
			
		||||
using Kreta.Resources;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Post.Naplozas
 | 
			
		||||
{
 | 
			
		||||
    public class OraNaplozasRequestCo : IValidatableObject
 | 
			
		||||
    {
 | 
			
		||||
        public DateTime Datum { get; set; }
 | 
			
		||||
 | 
			
		||||
        public string Hazifeladat { get; set; }
 | 
			
		||||
 | 
			
		||||
        public DateTime? HazifeladatHatarido { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int? HazifeladatId { get; set; }
 | 
			
		||||
 | 
			
		||||
        public bool IsElmaradt { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int MobilId { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int? OrarendiOraId { get; set; }
 | 
			
		||||
 | 
			
		||||
        public DateTime RogzitesDatum { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int? TanitasiOraId { get; set; }
 | 
			
		||||
 | 
			
		||||
        public List<TanuloForOraNaplozasRequestCo> TanuloLista { get; set; }
 | 
			
		||||
 | 
			
		||||
        public string Tema { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int? CsatolmanyId { get; set; }
 | 
			
		||||
 | 
			
		||||
        public void ConvertTo(NaplozasMobilCo co)
 | 
			
		||||
        {
 | 
			
		||||
            co.OraAdat.Datum = Datum;
 | 
			
		||||
            co.OraAdat.IsElmaradt = IsElmaradt;
 | 
			
		||||
            co.OraAdat.Tema = Tema;
 | 
			
		||||
            co.OraAdat.OrarendiOraId = OrarendiOraId;
 | 
			
		||||
            co.OraAdat.TanitasiOraId = TanitasiOraId;
 | 
			
		||||
            co.Hazifeladat.Id = HazifeladatId;
 | 
			
		||||
            co.Hazifeladat.Szoveg = Hazifeladat;
 | 
			
		||||
            co.Hazifeladat.Hatarido = HazifeladatHatarido;
 | 
			
		||||
            co.Hazifeladat.CsatolmanyId = CsatolmanyId;
 | 
			
		||||
            co.OraAdat.RogzitesDatuma = RogzitesDatum;
 | 
			
		||||
            foreach (var tanulo in TanuloLista)
 | 
			
		||||
            {
 | 
			
		||||
                var tanuloMulasztas = new NaplozasMobilCo.MulasztasModel
 | 
			
		||||
                {
 | 
			
		||||
                    TanuloId = tanulo.Id,
 | 
			
		||||
                    MulasztasTipus = tanulo.Mulasztas.Tipus.Id,
 | 
			
		||||
                    Keses = tanulo.Mulasztas.Keses
 | 
			
		||||
                };
 | 
			
		||||
 | 
			
		||||
                foreach (var feljegyzesTipus in tanulo.FeljegyzesTipusLista)
 | 
			
		||||
                {
 | 
			
		||||
                    switch (feljegyzesTipus.Id)
 | 
			
		||||
                    {
 | 
			
		||||
                        case (int)EsemenyTipusEnum.HaziFeladatHiany:
 | 
			
		||||
                            tanuloMulasztas.HazifeladatHiany = true;
 | 
			
		||||
                            break;
 | 
			
		||||
                        case (int)EsemenyTipusEnum.Felszereleshiany:
 | 
			
		||||
                            tanuloMulasztas.FelszerelesHiany = true;
 | 
			
		||||
                            break;
 | 
			
		||||
                        case (int)EsemenyTipusEnum.Dicseret:
 | 
			
		||||
                            tanuloMulasztas.TanoraiDicseret = true;
 | 
			
		||||
                            break;
 | 
			
		||||
                        case (int)EsemenyTipusEnum.SzakmaiMentessegNemHivatalos:
 | 
			
		||||
                            tanuloMulasztas.Felmentes = true;
 | 
			
		||||
                            break;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                co.MulasztasList.Add(tanuloMulasztas);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
 | 
			
		||||
        {
 | 
			
		||||
            if (HazifeladatHatarido < Datum.Date.AddDays(1))
 | 
			
		||||
            {
 | 
			
		||||
                yield return new ValidationResult(ErrorResource.HazifeladatNemrogzithetoHataridoKorabbiMintAzOraDatuma);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (HazifeladatHatarido < DateTime.Today.AddDays(1))
 | 
			
		||||
            {
 | 
			
		||||
                yield return new ValidationResult(ErrorResource.HazifeladatNemrogzithetoHataridoKorabbiMintAHolnapiNap);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (HazifeladatId.HasValue && string.IsNullOrWhiteSpace(Hazifeladat))
 | 
			
		||||
            {
 | 
			
		||||
                yield return new ValidationResult(OrarendResource.HazifeladatSzovegKotelezo);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var occurrenceNumberByPrimaryKey = new Dictionary<int, int>();
 | 
			
		||||
 | 
			
		||||
            foreach (var tanulo in TanuloLista)
 | 
			
		||||
            {
 | 
			
		||||
                if (occurrenceNumberByPrimaryKey.ContainsKey(tanulo.Id))
 | 
			
		||||
                {
 | 
			
		||||
                    occurrenceNumberByPrimaryKey[tanulo.Id]++;
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    occurrenceNumberByPrimaryKey.Add(tanulo.Id, 1);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                //TODO: késés értékének felső határát is validálni (nagyobb átalakítás)
 | 
			
		||||
                if (tanulo.Mulasztas.Tipus.Id == (int)MulasztasTipusEnum.keses && tanulo.Mulasztas.Keses <= 0)
 | 
			
		||||
                {
 | 
			
		||||
                    yield return new ValidationResult(string.Format(ErrorResource.AKesesErtekeNemLehet0, tanulo.Mulasztas.Keses));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            foreach (var occurrenceNumberByPrimaryKeyItem in occurrenceNumberByPrimaryKey)
 | 
			
		||||
            {
 | 
			
		||||
                if (occurrenceNumberByPrimaryKeyItem.Value > 1)
 | 
			
		||||
                {
 | 
			
		||||
                    yield return new ValidationResult($"A tanuló többször szerepel: {nameof(TanuloForOraNaplozasRequestCo.Id)}={occurrenceNumberByPrimaryKeyItem.Key}");
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,10 @@
 | 
			
		||||
using Kreta.Core.Validation.Exceptions;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Post.Naplozas
 | 
			
		||||
{
 | 
			
		||||
    public class OraNaplozasResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int MobilId { get; set; }
 | 
			
		||||
        public ValidationException Exception { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,13 @@
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Enum;
 | 
			
		||||
using Kreta.Enums.ManualEnums;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Post.Naplozas
 | 
			
		||||
{
 | 
			
		||||
    public class TanuloForOraNaplozasRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public int Id { get; set; }
 | 
			
		||||
        public MulasztasForOraNaplozasRequestCo Mulasztas { get; set; }
 | 
			
		||||
        public List<NaploEnumCo<FeljegyzesTipusEnum>> FeljegyzesTipusLista { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,10 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Post.OpenBoard
 | 
			
		||||
{
 | 
			
		||||
    public class FeltoltottFajlRequestCo
 | 
			
		||||
    {
 | 
			
		||||
        public int? Id { get; set; }
 | 
			
		||||
        public string ContentAsBase64EncodedString { get; set; }
 | 
			
		||||
        public int? OrarendiOraId { get; set; }
 | 
			
		||||
        public int? TanitasiOraId { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,10 @@
 | 
			
		||||
using Kreta.Core.Validation.Exceptions;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co.Post.OpenBoard
 | 
			
		||||
{
 | 
			
		||||
    public class FeltoltottFajlResponseCo
 | 
			
		||||
    {
 | 
			
		||||
        public int FeltolthetoFajlokSzama { get; set; }
 | 
			
		||||
        public ValidationException Exception { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,56 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Net;
 | 
			
		||||
using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Logic;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Co
 | 
			
		||||
{
 | 
			
		||||
    public sealed class ResponseWrapperCo<T> where T : class, new()
 | 
			
		||||
    {
 | 
			
		||||
        public HttpStatusCode StatusCode { get; private set; } = HttpStatusCode.NotFound;
 | 
			
		||||
        public DateTime UtolsoSzinkronDatumUtc { get; } = DateTime.UtcNow;
 | 
			
		||||
        public string Hash => string.IsNullOrWhiteSpace(DatabaseHash + SourceHash) ? null : DatabaseHash + "." + SourceHash;
 | 
			
		||||
        public bool IsHashesOk => IsDatabaseHashOk && IsSourceHashOk;
 | 
			
		||||
        public bool IsDatabaseHashOk
 | 
			
		||||
            => !string.IsNullOrWhiteSpace(RequestHash) && !string.IsNullOrWhiteSpace(DatabaseHash) && RequestHash.StartsWith(DatabaseHash, StringComparison.CurrentCultureIgnoreCase);
 | 
			
		||||
        public bool IsSourceHashOk
 | 
			
		||||
            => !string.IsNullOrWhiteSpace(RequestHash) && !string.IsNullOrWhiteSpace(SourceHash) && RequestHash.EndsWith(SourceHash, StringComparison.CurrentCultureIgnoreCase);
 | 
			
		||||
        private string RequestHash { get; }
 | 
			
		||||
        private string DatabaseHash { get; }
 | 
			
		||||
        private string SourceHash { get; set; }
 | 
			
		||||
        public T Adatcsomag { get; private set; } = null;
 | 
			
		||||
 | 
			
		||||
        private ResponseWrapperCo() { }
 | 
			
		||||
        public ResponseWrapperCo(string requestHash, string databaseHash = null)
 | 
			
		||||
        {
 | 
			
		||||
            RequestHash = requestHash;
 | 
			
		||||
            DatabaseHash = databaseHash;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <param name="isStrictMode">True: Adatcsomag prop is only assigned if all hash are ok.</param>
 | 
			
		||||
        public void FillData(T adatcsomag, bool isStrictMode = false)
 | 
			
		||||
        {
 | 
			
		||||
            StatusCode = HttpStatusCode.OK;
 | 
			
		||||
            SourceHash = HashLogic.CreateSourceHash(adatcsomag);
 | 
			
		||||
            if (isStrictMode)
 | 
			
		||||
            {
 | 
			
		||||
                Fill(IsHashesOk, adatcsomag);
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                Fill(IsSourceHashOk, adatcsomag);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void Fill(bool isHashOk, T adatcsomag)
 | 
			
		||||
        {
 | 
			
		||||
            if (isHashOk)
 | 
			
		||||
            {
 | 
			
		||||
                StatusCode = HttpStatusCode.NotModified;
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                Adatcsomag = adatcsomag;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										28
									
								
								Kreta.BusinessLogic/Classes/MobileApi/Naplo/V2/Constant.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								Kreta.BusinessLogic/Classes/MobileApi/Naplo/V2/Constant.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2
 | 
			
		||||
{
 | 
			
		||||
    using System.Collections.Generic;
 | 
			
		||||
    using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Enum;
 | 
			
		||||
    using Kreta.Resources;
 | 
			
		||||
 | 
			
		||||
    public static class Constant
 | 
			
		||||
    {
 | 
			
		||||
        private static readonly Dictionary<JavasoltJelenletTemplateType, string> megjegyzesByJavasoltJelenletTemplateTypeDictionary = new Dictionary<JavasoltJelenletTemplateType, string>
 | 
			
		||||
        {
 | 
			
		||||
            { JavasoltJelenletTemplateType.Igazolas, NaploApiResource.ATanulonakIgazolasLettRogzitve },
 | 
			
		||||
            { JavasoltJelenletTemplateType.ElozoOranHianyzott, NaploApiResource.ElozoOranHianyzott },
 | 
			
		||||
            { JavasoltJelenletTemplateType.ParhuzamosOranNaplozott, NaploApiResource.ParuzamosOranMarNaploztak },
 | 
			
		||||
            { JavasoltJelenletTemplateType.Felmentes, NaploApiResource.ATanulonakFelmenteseVan },
 | 
			
		||||
            { JavasoltJelenletTemplateType.SzakmaiGyakorlat, NaploApiResource.SzakmaiGyakorlatonJelenlevo },
 | 
			
		||||
            { JavasoltJelenletTemplateType.JogviszonySzuneteltetes, NaploApiResource.JogviszonySzunetelteto },
 | 
			
		||||
            { JavasoltJelenletTemplateType.MagantanuloOralatogatasAloliMentesseg, NaploApiResource.Magantanulo }
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        public static string GetMegjegyzesByJavasoltJelenletTemplateType(JavasoltJelenletTemplateType tipus)
 | 
			
		||||
        {
 | 
			
		||||
            return megjegyzesByJavasoltJelenletTemplateTypeDictionary.TryGetValue(tipus, out string value) ? value : null;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static readonly int FeltolthetoFajlokMaxSzama = 25;
 | 
			
		||||
        public static readonly string DateTimeFormat = "yyyyMMdd_HHmm";
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,13 @@
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Converter
 | 
			
		||||
{
 | 
			
		||||
    public static class CustomJsonConverter
 | 
			
		||||
    {
 | 
			
		||||
        public static T DeserializeJsonToObject<T>(string json) where T : class, new()
 | 
			
		||||
            => !string.IsNullOrWhiteSpace(json) ? JsonConvert.DeserializeObject<T>(json) : null;
 | 
			
		||||
 | 
			
		||||
        public static string SerializeObjectToJson(object myObject)
 | 
			
		||||
            => (myObject != null) ? JsonConvert.SerializeObject(myObject) : string.Empty;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,10 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Enum
 | 
			
		||||
{
 | 
			
		||||
    public enum FelmentesType
 | 
			
		||||
    {
 | 
			
		||||
        None,
 | 
			
		||||
        OralatogatasAlol,
 | 
			
		||||
        ErtekelesAlol,
 | 
			
		||||
        OralatogatasEsErtekelesAlol = OralatogatasAlol | ErtekelesAlol
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,15 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Enum
 | 
			
		||||
{
 | 
			
		||||
    public enum JavasoltJelenletTemplateType
 | 
			
		||||
    {
 | 
			
		||||
        None,
 | 
			
		||||
        Default,
 | 
			
		||||
        ElozoOranHianyzott,
 | 
			
		||||
        Igazolas,
 | 
			
		||||
        ParhuzamosOranNaplozott,
 | 
			
		||||
        MagantanuloOralatogatasAloliMentesseg,
 | 
			
		||||
        Felmentes,
 | 
			
		||||
        SzakmaiGyakorlat,
 | 
			
		||||
        JogviszonySzuneteltetes
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,13 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Logic
 | 
			
		||||
{
 | 
			
		||||
    using System;
 | 
			
		||||
    using System.Collections.Generic;
 | 
			
		||||
    using Kreta.Core.ConnectionType;
 | 
			
		||||
    using Kreta.DataAccessManual.Interfaces;
 | 
			
		||||
 | 
			
		||||
    public static class EgyediOraLogic
 | 
			
		||||
    {
 | 
			
		||||
        public static List<int> ListParhuzamosOranNaplozottMulasztasTanuloId(DateTime oraKezdete, DateTime oraVege, IConnectionType connectionType, IDalHandler h)
 | 
			
		||||
            => OraLogic.ListParhuzamosOranNaplozottMulasztasTanuloId(oraKezdete, oraVege, -1, connectionType, h);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,13 @@
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Logic
 | 
			
		||||
{
 | 
			
		||||
    using System;
 | 
			
		||||
 | 
			
		||||
    public static class FelmentesLogic
 | 
			
		||||
    {
 | 
			
		||||
        public static bool CalculateIsNowFelmentettByDatum(DateTime examinedDate, DateTime? felmentesKezdetDatuma, DateTime? felmentesVegDatuma)
 | 
			
		||||
            => (!felmentesKezdetDatuma.HasValue && !felmentesVegDatuma.HasValue)
 | 
			
		||||
            || (!felmentesKezdetDatuma.HasValue && examinedDate <= felmentesVegDatuma)
 | 
			
		||||
            || (!felmentesVegDatuma.HasValue && felmentesKezdetDatuma <= examinedDate)
 | 
			
		||||
            || (felmentesKezdetDatuma <= examinedDate && examinedDate <= felmentesVegDatuma);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,18 @@
 | 
			
		||||
using System.Reflection;
 | 
			
		||||
using Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Converter;
 | 
			
		||||
 | 
			
		||||
namespace Kreta.BusinessLogic.Classes.MobileApi.Naplo.V2.Logic
 | 
			
		||||
{
 | 
			
		||||
    public static class HashLogic
 | 
			
		||||
    {
 | 
			
		||||
        private static string GetNonce() => Assembly.GetExecutingAssembly().GetName().Version.ToString().Replace(".", "_");
 | 
			
		||||
        public static string CreateSourceHash<T>(T responseCO) where T : class, new()
 | 
			
		||||
            => (responseCO != null) ? CustomJsonConverter.SerializeObjectToJson(responseCO)?.GetHashCode().ToString() + "__" + GetNonce() : null;
 | 
			
		||||
 | 
			
		||||
        //public static string CreateResponseHash<T>(T responseCO, string requestHash) where T : class, IGetResponseCo, new() 
 | 
			
		||||
        //    => (responseCO != null && !responseCO.Hash.Equals(requestHash)) ? responseCO.Hash : null;
 | 
			
		||||
        //public static T CreateResponseData<T>(T responseCO, string requestHash) where T : class, IGetResponseCo, new() 
 | 
			
		||||
        //    => (responseCO != null && !responseCO.Hash.Equals(requestHash)) ? responseCO : null;
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user