init
This commit is contained in:
448
KretaWeb/Areas/KirImportExport/Models/KirSzinkronSaveModel.cs
Normal file
448
KretaWeb/Areas/KirImportExport/Models/KirSzinkronSaveModel.cs
Normal file
@@ -0,0 +1,448 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Kreta.BusinessLogic.Classes;
|
||||
using Kreta.BusinessLogic.HelperClasses;
|
||||
using Kreta.Core;
|
||||
using Kreta.Core.Domain;
|
||||
using Kreta.Enums;
|
||||
using Kreta.Web.Security;
|
||||
|
||||
namespace Kreta.Web.Areas.KirImportExport.Models
|
||||
{
|
||||
public class KirSzinkronSaveModel
|
||||
{
|
||||
public string FelhasznaloId { get; set; }
|
||||
public List<ValtozasDict> ValtozasDictData { get; set; }
|
||||
|
||||
public class ValtozasDict
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public static implicit operator KirTanarAdatCo(KirSzinkronSaveModel kirSzinkronSaveModel)
|
||||
{
|
||||
var kirTanarAdatCo = new KirTanarAdatCo();
|
||||
|
||||
if (int.TryParse(kirSzinkronSaveModel.FelhasznaloId, out int felhasznaloId))
|
||||
{
|
||||
kirTanarAdatCo.Id = felhasznaloId;
|
||||
}
|
||||
|
||||
List<ValtozasDict> ValtozasDictData = new List<ValtozasDict>(kirSzinkronSaveModel.ValtozasDictData);
|
||||
|
||||
for (int i = 0; i < ValtozasDictData.Count; i++)
|
||||
{
|
||||
if (ValtozasDictData[i].Key == nameof(KirAlkalmazott.AnyjaUtoneve))
|
||||
{
|
||||
kirTanarAdatCo.AnyjaUtoneve = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirAlkalmazott.AnyjaVezetekNeve))
|
||||
{
|
||||
kirTanarAdatCo.AnyjaCsaladiNeve = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirAlkalmazott.NevElotag))
|
||||
{
|
||||
kirTanarAdatCo.Elotag = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirAlkalmazott.SzuletesiUtonev))
|
||||
{
|
||||
kirTanarAdatCo.SzuletesiUtonev = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirAlkalmazott.SzuletesiVezeteknev))
|
||||
{
|
||||
kirTanarAdatCo.SzuletesiCsaladiNev = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirAlkalmazott.Utonev))
|
||||
{
|
||||
kirTanarAdatCo.MunkavallaloUtonev = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirAlkalmazott.Vezeteknev))
|
||||
{
|
||||
kirTanarAdatCo.MunkavallaloCsaladiNev = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirAlkalmazott.SzuletesiHely))
|
||||
{
|
||||
kirTanarAdatCo.SzuletesiHely = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirAlkalmazott.SzuletesiDatum))
|
||||
{
|
||||
kirTanarAdatCo.SzuletesiIdo = Convert.ToDateTime(ValtozasDictData[i].Value);
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirAlkalmazott.Nem))
|
||||
{
|
||||
if (Enum.TryParse(ValtozasDictData[i].Value.RemoveDiacritics(), true, out NemEnum nemEnum))
|
||||
{
|
||||
kirTanarAdatCo.Nem = (int)nemEnum;
|
||||
}
|
||||
else
|
||||
{
|
||||
kirTanarAdatCo.Nem = (int)NemEnum.NA;
|
||||
}
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirAlkalmazott.AlkalmazasKezdete))
|
||||
{
|
||||
kirTanarAdatCo.AlkalmazasKezdete = Convert.ToDateTime(ValtozasDictData[i].Value);
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirAlkalmazott.AlkalmazasMegszunese))
|
||||
{
|
||||
kirTanarAdatCo.AlkalmazasVege = Convert.ToDateTime(ValtozasDictData[i].Value);
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirAlkalmazott.FoglalkoztatasTipusa))
|
||||
{
|
||||
if (Enum.TryParse(ValtozasDictData[i].Value.RemoveDiacritics(), true, out FoglalkoztatasTipusaEnum foglalkoztatasTipusaEnum))
|
||||
{
|
||||
kirTanarAdatCo.FoglalkoztatasTipusa = (int)foglalkoztatasTipusaEnum;
|
||||
}
|
||||
else
|
||||
{
|
||||
kirTanarAdatCo.FoglalkoztatasTipusa = (int)FoglalkoztatasTipusaEnum.TeljesMunkaidos;
|
||||
}
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirAlkalmazott.OktatasiAzonosito))
|
||||
{
|
||||
kirTanarAdatCo.OktatasiAzonosito = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirAlkalmazott.Allampolgarsag))
|
||||
{
|
||||
if (Enum.TryParse(ValtozasDictData[i].Value.RemoveDiacritics(), true, out AllampolgarsagEnum allampolgarsagEnum))
|
||||
{
|
||||
kirTanarAdatCo.Allampolgarsag = (int)allampolgarsagEnum;
|
||||
}
|
||||
else
|
||||
{
|
||||
kirTanarAdatCo.Allampolgarsag = (int)AllampolgarsagEnum.magyar;
|
||||
}
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirAlkalmazott.Allampolgarsag2))
|
||||
{
|
||||
if (Enum.TryParse(ValtozasDictData[i].Value.RemoveDiacritics(), true, out AllampolgarsagEnum allampolgarsagEnum))
|
||||
{
|
||||
kirTanarAdatCo.Allampolgarsag = (int)allampolgarsagEnum;
|
||||
}
|
||||
else
|
||||
{
|
||||
kirTanarAdatCo.Allampolgarsag = (int)AllampolgarsagEnum.magyar;
|
||||
}
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirAlkalmazott.SzuletesiOrszag))
|
||||
{
|
||||
if (Enum.TryParse(ValtozasDictData[i].Value.RemoveDiacritics(), true, out OrszagTipusEnum orszagTipusEnum))
|
||||
{
|
||||
kirTanarAdatCo.SzuletesiOrszag = (int)orszagTipusEnum;
|
||||
}
|
||||
else
|
||||
{
|
||||
kirTanarAdatCo.SzuletesiOrszag = (int)OrszagTipusEnum.Magyarorszag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return kirTanarAdatCo;
|
||||
}
|
||||
|
||||
public static KirTanarAdatCo ModelToCo(KirSzinkronSaveModel kirSzinkronSaveModel) => kirSzinkronSaveModel;
|
||||
public static KirTanuloAdatCo ModelToTanuloAdatCo(KirSzinkronSaveModel kirSzinkronSaveModel) => kirSzinkronSaveModel;
|
||||
|
||||
public static FelhasznaloElerhetosegCimCO ModelToAllandoLakcimToElerhetosegCimCo(KirSzinkronSaveModel kirSzinkronSaveModel)
|
||||
{
|
||||
var felhasznaloElerhetosegCimCO = new FelhasznaloElerhetosegCimCO();
|
||||
|
||||
if (int.TryParse(kirSzinkronSaveModel.FelhasznaloId, out int FelhasznaloId))
|
||||
{
|
||||
felhasznaloElerhetosegCimCO.FelhasznaloId = FelhasznaloId;
|
||||
}
|
||||
|
||||
felhasznaloElerhetosegCimCO.Alapertelmezett = true;
|
||||
felhasznaloElerhetosegCimCO.CimTipus = (int)CimTipusEnum.allando_lakcim;
|
||||
|
||||
List<ValtozasDict> ValtozasDictData = new List<ValtozasDict>(kirSzinkronSaveModel.ValtozasDictData);
|
||||
|
||||
for (int i = 0; i < ValtozasDictData.Count; i++)
|
||||
{
|
||||
if (ValtozasDictData[i].Key == "AllandoLakcimHazszam")
|
||||
{
|
||||
felhasznaloElerhetosegCimCO.Hazszam = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == "AllandoLakcimIranyitoszam")
|
||||
{
|
||||
felhasznaloElerhetosegCimCO.Iranyitoszam = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == "AllandoLakcimKozteruletJellegeNev")
|
||||
{
|
||||
if (Enum.TryParse(ValtozasDictData[i].Value.RemoveDiacritics(), true, out KozteruletJellegEnum kozteruletJellegEnum))
|
||||
{
|
||||
felhasznaloElerhetosegCimCO.KozteruletTipusNev = kozteruletJellegEnum.GetDisplayName(ClaimData.SelectedTanevID.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
felhasznaloElerhetosegCimCO.KozteruletTipusNev = KozteruletJellegEnum.na.GetDisplayName(ClaimData.SelectedTanevID.Value);
|
||||
}
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == "AllandoLakcimKozteruletNev")
|
||||
{
|
||||
felhasznaloElerhetosegCimCO.KozteruletNev = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == "AllandoLakcimVaros")
|
||||
{
|
||||
felhasznaloElerhetosegCimCO.HelysegNev = ValtozasDictData[i].Value;
|
||||
}
|
||||
}
|
||||
|
||||
return felhasznaloElerhetosegCimCO;
|
||||
}
|
||||
|
||||
public static FelhasznaloElerhetosegCimCO ModelToTartozkodasiCimToElerhetosegCimCo(KirSzinkronSaveModel kirSzinkronSaveModel)
|
||||
{
|
||||
var felhasznaloElerhetosegCimCO = new FelhasznaloElerhetosegCimCO();
|
||||
|
||||
if (int.TryParse(kirSzinkronSaveModel.FelhasznaloId, out int FelhasznaloId))
|
||||
{
|
||||
felhasznaloElerhetosegCimCO.FelhasznaloId = FelhasznaloId;
|
||||
}
|
||||
|
||||
felhasznaloElerhetosegCimCO.Alapertelmezett = true;
|
||||
felhasznaloElerhetosegCimCO.CimTipus = (int)CimTipusEnum.tartozkodasi_hely;
|
||||
|
||||
List<ValtozasDict> ValtozasDictData = new List<ValtozasDict>(kirSzinkronSaveModel.ValtozasDictData);
|
||||
|
||||
for (int i = 0; i < ValtozasDictData.Count; i++)
|
||||
{
|
||||
if (ValtozasDictData[i].Key == "TartozkodasiCimHazszam")
|
||||
{
|
||||
felhasznaloElerhetosegCimCO.Hazszam = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == "TartozkodasiCimIranyitoszam")
|
||||
{
|
||||
felhasznaloElerhetosegCimCO.Iranyitoszam = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == "TartozkodasiCimKozteruletJellegeNev")
|
||||
{
|
||||
if (Enum.TryParse(ValtozasDictData[i].Value.RemoveDiacritics(), true, out KozteruletJellegEnum kozteruletJellegEnum))
|
||||
{
|
||||
felhasznaloElerhetosegCimCO.KozteruletTipusNev = kozteruletJellegEnum.GetDisplayName(ClaimData.SelectedTanevID.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
felhasznaloElerhetosegCimCO.KozteruletTipusNev = KozteruletJellegEnum.na.GetDisplayName(ClaimData.SelectedTanevID.Value);
|
||||
}
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == "TartozkodasiCimKozteruletNev")
|
||||
{
|
||||
felhasznaloElerhetosegCimCO.KozteruletNev = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == "TartozkodasiCimVaros")
|
||||
{
|
||||
felhasznaloElerhetosegCimCO.HelysegNev = ValtozasDictData[i].Value;
|
||||
}
|
||||
}
|
||||
|
||||
return felhasznaloElerhetosegCimCO;
|
||||
}
|
||||
|
||||
public static FelhasznaloElerhetosegTelCO ModelToFelhasznaloElerhetosegTelCo(KirSzinkronSaveModel kirSzinkronSaveModel)
|
||||
{
|
||||
var felhasznaloElerhetosegTelCO = new FelhasznaloElerhetosegTelCO();
|
||||
|
||||
List<ValtozasDict> ValtozasDictData = new List<ValtozasDict>(kirSzinkronSaveModel.ValtozasDictData);
|
||||
|
||||
for (int i = 0; i < ValtozasDictData.Count; i++)
|
||||
{
|
||||
if (ValtozasDictData[i].Key == nameof(KirAlkalmazott.Telefonszam))
|
||||
{
|
||||
felhasznaloElerhetosegTelCO.Telefonszam = ValtozasDictData[i].Value;
|
||||
felhasznaloElerhetosegTelCO.TelefonTipusa = (int)TelefonTipusEnum.Ismeretlen;
|
||||
}
|
||||
}
|
||||
|
||||
return felhasznaloElerhetosegTelCO;
|
||||
}
|
||||
|
||||
public static FelhasznaloElerhetosegEmailCO ModelToFelhasznaloElerhetosegEmailCo(KirSzinkronSaveModel kirSzinkronSaveModel)
|
||||
{
|
||||
var felhasznaloElerhetosegEmailCO = new FelhasznaloElerhetosegEmailCO();
|
||||
|
||||
List<ValtozasDict> ValtozasDictData = new List<ValtozasDict>(kirSzinkronSaveModel.ValtozasDictData);
|
||||
|
||||
for (int i = 0; i < ValtozasDictData.Count; i++)
|
||||
{
|
||||
if (ValtozasDictData[i].Key == nameof(KirAlkalmazott.Email))
|
||||
{
|
||||
felhasznaloElerhetosegEmailCO.EmailCim = ValtozasDictData[i].Value;
|
||||
felhasznaloElerhetosegEmailCO.EmailTipusa = (int)EmailTipusEnum.Na;
|
||||
}
|
||||
}
|
||||
|
||||
return felhasznaloElerhetosegEmailCO;
|
||||
}
|
||||
|
||||
public static implicit operator KirTanuloAdatCo(KirSzinkronSaveModel kirSzinkronSaveModel)
|
||||
{
|
||||
var kirTanuloAdatCo = new KirTanuloAdatCo();
|
||||
|
||||
if (int.TryParse(kirSzinkronSaveModel.FelhasznaloId, out int felhasznaloId))
|
||||
{
|
||||
kirTanuloAdatCo.Id = felhasznaloId;
|
||||
}
|
||||
|
||||
List<ValtozasDict> ValtozasDictData = new List<ValtozasDict>(kirSzinkronSaveModel.ValtozasDictData);
|
||||
|
||||
for (int i = 0; i < ValtozasDictData.Count; i++)
|
||||
{
|
||||
if (ValtozasDictData[i].Key == nameof(KirTanulo.AnyjaUtoneve))
|
||||
{
|
||||
kirTanuloAdatCo.AnyjaUtoneve = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirTanulo.AnyjaVezetekNeve))
|
||||
{
|
||||
kirTanuloAdatCo.AnyjaVezetekNeve = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirTanulo.NevElotag))
|
||||
{
|
||||
kirTanuloAdatCo.Elotag = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirTanulo.SzuletesiUtonev))
|
||||
{
|
||||
kirTanuloAdatCo.SzuletesiUtonev = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirTanulo.SzuletesiVezeteknev))
|
||||
{
|
||||
kirTanuloAdatCo.SzuletesiVezeteknev = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirTanulo.Utonev))
|
||||
{
|
||||
kirTanuloAdatCo.Utonev = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirTanulo.Vezeteknev))
|
||||
{
|
||||
kirTanuloAdatCo.Vezeteknev = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirTanulo.SzuletesiHely))
|
||||
{
|
||||
kirTanuloAdatCo.SzuletesiHely = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirTanulo.SzuletesiDatum))
|
||||
{
|
||||
kirTanuloAdatCo.SzuletesiDatum = Convert.ToDateTime(ValtozasDictData[i].Value);
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirTanulo.Nem))
|
||||
{
|
||||
if (Enum.TryParse(ValtozasDictData[i].Value.RemoveDiacritics(), true, out NemEnum nemEnum))
|
||||
{
|
||||
kirTanuloAdatCo.Nem = (int)nemEnum;
|
||||
}
|
||||
else
|
||||
{
|
||||
kirTanuloAdatCo.Nem = (int)NemEnum.NA;
|
||||
}
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirTanulo.JogviszonyKezdete))
|
||||
{
|
||||
kirTanuloAdatCo.JogviszonyKezdete = Convert.ToDateTime(ValtozasDictData[i].Value);
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirTanulo.JogviszonyVarBefejezese))
|
||||
{
|
||||
kirTanuloAdatCo.JogviszonyVarBefejezese = Convert.ToDateTime(ValtozasDictData[i].Value);
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirTanulo.JogviszonyStatusza))
|
||||
{
|
||||
kirTanuloAdatCo.JogviszonyStatusza = Convert.ToBoolean(ValtozasDictData[i].Value);
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirTanulo.JogviszonyJellege))
|
||||
{
|
||||
kirTanuloAdatCo.JogviszonyJellege = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirTanulo.Vendegtanulo))
|
||||
{
|
||||
kirTanuloAdatCo.Vendegtanulo = Convert.ToBoolean(ValtozasDictData[i].Value);
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirTanulo.Magantanulo))
|
||||
{
|
||||
kirTanuloAdatCo.Magantanulo = Convert.ToBoolean(ValtozasDictData[i].Value);
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirTanulo.OktatasiAzonosito))
|
||||
{
|
||||
kirTanuloAdatCo.OktatasiAzonosito = ValtozasDictData[i].Value;
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirTanulo.Allampolgarsag))
|
||||
{
|
||||
if (Enum.TryParse(ValtozasDictData[i].Value.RemoveDiacritics(), true, out AllampolgarsagEnum allampolgarsagEnum))
|
||||
{
|
||||
kirTanuloAdatCo.Allampolgarsag = (int)allampolgarsagEnum;
|
||||
}
|
||||
else
|
||||
{
|
||||
kirTanuloAdatCo.Allampolgarsag = (int)AllampolgarsagEnum.magyar;
|
||||
}
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirTanulo.Allampolgarsag2))
|
||||
{
|
||||
if (Enum.TryParse(ValtozasDictData[i].Value.RemoveDiacritics(), true, out AllampolgarsagEnum allampolgarsagEnum))
|
||||
{
|
||||
kirTanuloAdatCo.Allampolgarsag = (int)allampolgarsagEnum;
|
||||
}
|
||||
else
|
||||
{
|
||||
kirTanuloAdatCo.Allampolgarsag = (int)AllampolgarsagEnum.magyar;
|
||||
}
|
||||
}
|
||||
|
||||
if (ValtozasDictData[i].Key == nameof(KirTanulo.SzuletesiOrszag))
|
||||
{
|
||||
if (Enum.TryParse(ValtozasDictData[i].Value.RemoveDiacritics(), true, out OrszagTipusEnum orszagTipusEnum))
|
||||
{
|
||||
kirTanuloAdatCo.SzuletesiOrszag = (int)orszagTipusEnum;
|
||||
}
|
||||
else
|
||||
{
|
||||
kirTanuloAdatCo.SzuletesiOrszag = (int)OrszagTipusEnum.Magyarorszag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return kirTanuloAdatCo;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user