init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,211 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using Kreta.BusinessLogic.Classes;
|
||||
using Kreta.Core.ConnectionType;
|
||||
using Kreta.DataAccessManual;
|
||||
using Kreta.Enums;
|
||||
using Kreta.Enums.ManualEnums;
|
||||
|
||||
namespace Kreta.BusinessLogic.Helpers.Nyomtatvanyok.Iktatas
|
||||
{
|
||||
public class KulcsszoHelper : LogicBase
|
||||
{
|
||||
public KulcsszoHelper(IConnectionType connectionType) : base(connectionType) { }
|
||||
|
||||
public NameValueCollection GetKulcsszavak(Enums.DokumentumTipusEnum? dokumentumTipus, List<KulcsszoDefinicioModel> kulcsszoDefinicioModel, DataSet ds)
|
||||
{
|
||||
NameValueCollection kulcsSzavak = new NameValueCollection();
|
||||
foreach (var kulcsszo in kulcsszoDefinicioModel)
|
||||
{
|
||||
switch (kulcsszo.Type)
|
||||
{
|
||||
case DokumentumKulcsszoTipusEnum.DokumentumTipus:
|
||||
kulcsSzavak.Add(kulcsszo.Type.ToString(), (dokumentumTipus != null) ? dokumentumTipus.AsInt().ToString() : "Nem beazonosított dokumentum típus");
|
||||
break;
|
||||
case DokumentumKulcsszoTipusEnum.Csoportjellemzo:
|
||||
if (ds.Tables.Count > 0 && ds.Tables[kulcsszo.TableName] != null && ds.Tables[kulcsszo.TableName].Rows.Count > 0 && ds.Tables[kulcsszo.TableName].Columns.Contains("CSJVegzosEvfolyamu_BOOL") && ds.Tables[kulcsszo.TableName].Rows.Cast<DataRow>().Any(x => (bool)x["CSJVegzosEvfolyamu_BOOL"]))
|
||||
{
|
||||
kulcsSzavak.Add(kulcsszo.Type.ToString(), CsoportJellemzoEnum.VegzosEvfolyamu.AsInt().ToString());
|
||||
}
|
||||
if (ds.Tables.Count > 0 && ds.Tables[kulcsszo.TableName] != null && ds.Tables[kulcsszo.TableName].Rows.Count > 0 && ds.Tables[kulcsszo.TableName].Columns.Contains("OJCSJKeresztfeleves_BOOL") && ds.Tables[kulcsszo.TableName].Rows.Cast<DataRow>().Any(x => (bool)x["OJCSJKeresztfeleves_BOOL"]))
|
||||
{
|
||||
kulcsSzavak.Add(kulcsszo.Type.ToString(), CsoportJellemzoEnum.Keresztfeleves.AsInt().ToString());
|
||||
}
|
||||
if (ds.Tables.Count > 0 && ds.Tables[kulcsszo.TableName] != null && ds.Tables[kulcsszo.TableName].Rows.Count > 0 && ds.Tables[kulcsszo.TableName].Columns.Contains("OJIsGyogypedagogiaiLogopediai_BOOL") && ds.Tables[kulcsszo.TableName].Rows.Cast<DataRow>().Any(x => (bool)x["OJIsGyogypedagogiaiLogopediai_BOOL"]))
|
||||
{
|
||||
kulcsSzavak.Add(kulcsszo.Type.ToString(), CsoportJellemzoEnum.IsGyogypedagogiaiLogopediai.AsInt().ToString());
|
||||
}
|
||||
break;
|
||||
case DokumentumKulcsszoTipusEnum.Osztalyjellemzo:
|
||||
if (ds.Tables.Count > 0 && ds.Tables[kulcsszo.TableName] != null && ds.Tables[kulcsszo.TableName].Rows.Count > 0 && ds.Tables[kulcsszo.TableName].Columns.Contains("OJCSJKeresztfeleves_BOOL") && ds.Tables[kulcsszo.TableName].Rows.Cast<DataRow>().Any(x => (bool)x["OJCSJKeresztfeleves_BOOL"]))
|
||||
{
|
||||
kulcsSzavak.Add(kulcsszo.Type.ToString(), OsztalyJellemzoEnum.Keresztfeleves.AsInt().ToString());
|
||||
}
|
||||
if (ds.Tables.Count > 0 && ds.Tables[kulcsszo.TableName] != null && ds.Tables[kulcsszo.TableName].Rows.Count > 0 && ds.Tables[kulcsszo.TableName].Columns.Contains("OJTechnikaiOsztaly_BOOL") && ds.Tables[kulcsszo.TableName].Rows.Cast<DataRow>().Any(x => (bool)x["OJTechnikaiOsztaly_BOOL"]))
|
||||
{
|
||||
kulcsSzavak.Add(kulcsszo.Type.ToString(), OsztalyJellemzoEnum.TechnikaiOsztaly.AsInt().ToString());
|
||||
}
|
||||
if (ds.Tables.Count > 0 && ds.Tables[kulcsszo.TableName] != null && ds.Tables[kulcsszo.TableName].Rows.Count > 0 && ds.Tables[kulcsszo.TableName].Columns.Contains("OJNemzetisegi_BOOL") && ds.Tables[kulcsszo.TableName].Rows.Cast<DataRow>().Any(x => (bool)x["OJNemzetisegi_BOOL"]))
|
||||
{
|
||||
kulcsSzavak.Add(kulcsszo.Type.ToString(), OsztalyJellemzoEnum.Nemzetisegi.AsInt().ToString());
|
||||
}
|
||||
if (ds.Tables.Count > 0 && ds.Tables[kulcsszo.TableName] != null && ds.Tables[kulcsszo.TableName].Rows.Count > 0 && ds.Tables[kulcsszo.TableName].Columns.Contains("OJKettannyelvu_BOOL") && ds.Tables[kulcsszo.TableName].Rows.Cast<DataRow>().Any(x => (bool)x["OJKettannyelvu_BOOL"]))
|
||||
{
|
||||
kulcsSzavak.Add(kulcsszo.Type.ToString(), OsztalyJellemzoEnum.Kettannyelvu.AsInt().ToString());
|
||||
}
|
||||
if (ds.Tables.Count > 0 && ds.Tables[kulcsszo.TableName] != null && ds.Tables[kulcsszo.TableName].Rows.Count > 0 && ds.Tables[kulcsszo.TableName].Columns.Contains("OJNyelviElokeszito_BOOL") && ds.Tables[kulcsszo.TableName].Rows.Cast<DataRow>().Any(x => (bool)x["OJNyelviElokeszito_BOOL"]))
|
||||
{
|
||||
kulcsSzavak.Add(kulcsszo.Type.ToString(), OsztalyJellemzoEnum.NyelviElokeszito.AsInt().ToString());
|
||||
}
|
||||
if (ds.Tables.Count > 0 && ds.Tables[kulcsszo.TableName] != null && ds.Tables[kulcsszo.TableName].Rows.Count > 0 && ds.Tables[kulcsszo.TableName].Columns.Contains("OJIsGyogypedagogiaiLogopediai_BOOL") && ds.Tables[kulcsszo.TableName].Rows.Cast<DataRow>().Any(x => (bool)x["OJIsGyogypedagogiaiLogopediai_BOOL"]))
|
||||
{
|
||||
kulcsSzavak.Add(kulcsszo.Type.ToString(), OsztalyJellemzoEnum.IsGyogypedagogiaiLogopediai.AsInt().ToString());
|
||||
}
|
||||
if (ds.Tables.Count > 0 && ds.Tables[kulcsszo.TableName] != null && ds.Tables[kulcsszo.TableName].Rows.Count > 0 && ds.Tables[kulcsszo.TableName].Columns.Contains("OJSportOsztaly_BOOL") && ds.Tables[kulcsszo.TableName].Rows.Cast<DataRow>().Any(x => (bool)x["OJSportOsztaly_BOOL"]))
|
||||
{
|
||||
kulcsSzavak.Add(kulcsszo.Type.ToString(), OsztalyJellemzoEnum.SportOsztaly.AsInt().ToString());
|
||||
}
|
||||
if (ds.Tables.Count > 0 && ds.Tables[kulcsszo.TableName] != null && ds.Tables[kulcsszo.TableName].Rows.Count > 0 && ds.Tables[kulcsszo.TableName].Columns.Contains("OJAranyJanosProgram_BOOL") && ds.Tables[kulcsszo.TableName].Rows.Cast<DataRow>().Any(x => (bool)x["OJAranyJanosProgram_BOOL"]))
|
||||
{
|
||||
kulcsSzavak.Add(kulcsszo.Type.ToString(), OsztalyJellemzoEnum.AranyJanosProgram.AsInt().ToString());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (kulcsszo.Multiple)
|
||||
{
|
||||
DataView view = ds.Tables[kulcsszo.TableName].DefaultView;
|
||||
string[] columns = (kulcsszo.AlternativeColumnName != null) ? new string[2] { kulcsszo.ColumnName, kulcsszo.AlternativeColumnName } : new string[1] { kulcsszo.ColumnName };
|
||||
DataTable distinctTable = view.ToTable(true, columns);
|
||||
foreach (DataRow row in distinctTable.Rows)
|
||||
{
|
||||
if (!(row[kulcsszo.ColumnName] is DBNull))
|
||||
{
|
||||
if (!(kulcsSzavak[kulcsszo.Type.ToString()] ?? "").Contains(row[kulcsszo.ColumnName].ToString()))
|
||||
{
|
||||
kulcsSzavak.Add(kulcsszo.Type.ToString(), row[kulcsszo.ColumnName].ToString());
|
||||
}
|
||||
}
|
||||
else if ((kulcsszo.AlternativeColumnName != null) && !(row[kulcsszo.AlternativeColumnName] is DBNull))
|
||||
{
|
||||
string prefix;
|
||||
switch (kulcsszo.Type)
|
||||
{
|
||||
case DokumentumKulcsszoTipusEnum.TanuloEgyediAzonosito:
|
||||
prefix = "T";
|
||||
break;
|
||||
case DokumentumKulcsszoTipusEnum.AlkalmazottEgyediAzonosito:
|
||||
prefix = "A";
|
||||
break;
|
||||
default:
|
||||
prefix = "??";
|
||||
break;
|
||||
}
|
||||
var val = string.Format("{0}_{1}_{2}_{3}", prefix, IntezmenyId, TanevId, row[kulcsszo.AlternativeColumnName].ToString());
|
||||
if (!(kulcsSzavak[kulcsszo.Type.ToString()] ?? "").Contains(val))
|
||||
{
|
||||
kulcsSzavak.Add(kulcsszo.Type.ToString(), val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ds.Tables.Count > 0 && ds.Tables[kulcsszo.TableName] != null && ds.Tables[kulcsszo.TableName].Rows.Count > 0 && ds.Tables[kulcsszo.TableName].Columns.Contains(kulcsszo.ColumnName) && !(ds.Tables[kulcsszo.TableName].Rows[0][kulcsszo.ColumnName] is DBNull))
|
||||
{
|
||||
kulcsSzavak.Add(kulcsszo.Type.ToString(), ds.Tables[kulcsszo.TableName].Rows[0][kulcsszo.ColumnName].ToString());
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return kulcsSzavak;
|
||||
}
|
||||
|
||||
public FoszamDefinicioValueModel FillFoszamDefinicioErtekek(NameValueCollection kulcsszavak, FoszamDefinicioModel foszamDefinicio)
|
||||
{
|
||||
if (foszamDefinicio == null)
|
||||
{
|
||||
throw new ApplicationException("Hiányzó főszám definíció");
|
||||
}
|
||||
FoszamDefinicioValueModel valueModel = new FoszamDefinicioValueModel();
|
||||
valueModel.Szint = foszamDefinicio.Szint;
|
||||
if (foszamDefinicio.IntezmenyId)
|
||||
{
|
||||
valueModel.IntezmenyId = IntezmenyId;
|
||||
}
|
||||
if (foszamDefinicio.TanevId)
|
||||
{
|
||||
valueModel.TanevId = TanevId;
|
||||
}
|
||||
if (foszamDefinicio.OsztalyId)
|
||||
{
|
||||
valueModel.OsztalyId = int.Parse(kulcsszavak[DokumentumKulcsszoTipusEnum.OsztalyNev.ToString()]);
|
||||
}
|
||||
if (foszamDefinicio.CsoportId)
|
||||
{
|
||||
valueModel.CsoportId = int.Parse(kulcsszavak[DokumentumKulcsszoTipusEnum.CsoportNev.ToString()]);
|
||||
}
|
||||
if (foszamDefinicio.TanarId)
|
||||
{
|
||||
valueModel.TanarId = int.Parse(kulcsszavak[DokumentumKulcsszoTipusEnum.Alkalmazott.ToString()]);
|
||||
}
|
||||
if (foszamDefinicio.EvfolyamId)
|
||||
{
|
||||
valueModel.EvfolyamId = int.Parse(kulcsszavak[DokumentumKulcsszoTipusEnum.Evfolyam.ToString()]);
|
||||
}
|
||||
if (foszamDefinicio.TeremId)
|
||||
{
|
||||
valueModel.TeremId = int.Parse(kulcsszavak[DokumentumKulcsszoTipusEnum.Terem.ToString()]);
|
||||
}
|
||||
if (foszamDefinicio.GondviseloNeve)
|
||||
{
|
||||
valueModel.GondviseloNeve = kulcsszavak[DokumentumKulcsszoTipusEnum.Gondviselo.ToString()];
|
||||
}
|
||||
if (foszamDefinicio.TanuloNeve)
|
||||
{
|
||||
valueModel.TanuloNeve = kulcsszavak[DokumentumKulcsszoTipusEnum.Tanulo.ToString()];
|
||||
}
|
||||
if (foszamDefinicio.AlkalmazottEgyediAzonosito)
|
||||
{
|
||||
valueModel.AlkalmazottEgyediAzonosito = kulcsszavak[DokumentumKulcsszoTipusEnum.AlkalmazottEgyediAzonosito.ToString()];
|
||||
}
|
||||
if (foszamDefinicio.TanuloEgyediAzonosito)
|
||||
{
|
||||
valueModel.TanuloEgyediAzonosito = kulcsszavak[DokumentumKulcsszoTipusEnum.TanuloEgyediAzonosito.ToString()];
|
||||
}
|
||||
return valueModel;
|
||||
}
|
||||
|
||||
public List<Tuple<string, string>> GetKulcsszoTipusErtekParos(int iktatottDokumentumId)
|
||||
{
|
||||
return Dal.CustomConnection.Run(ConnectionType, (h) =>
|
||||
{
|
||||
var ret = new List<Tuple<string, string>>();
|
||||
var dal = h.NyomtatvanyokDal();
|
||||
DataSet ds = dal.GetKulcsszoertekekOnIktatottDokumentum(IntezmenyId, TanevId, iktatottDokumentumId);
|
||||
|
||||
foreach (DataRow row in ds.Tables[0].Rows)
|
||||
{
|
||||
if ((int)row["tipus"] == (int)DokumentumKulcsszoTipusEnum.Osztalyjellemzo)
|
||||
{
|
||||
row["ertek"] = int.Parse(row["ertek"].ToString()).GetDisplayName<OsztalyJellemzoEnum>(TanevId);
|
||||
}
|
||||
else if ((int)row["tipus"] == (int)DokumentumKulcsszoTipusEnum.Csoportjellemzo)
|
||||
{
|
||||
row["ertek"] = int.Parse(row["ertek"].ToString()).GetDisplayName<CsoportJellemzoEnum>(TanevId);
|
||||
}
|
||||
ret.Add(new Tuple<string, string>(row["tipus_DNAME"].ToString(), row["ertek"].ToString()));
|
||||
}
|
||||
/// TODO: Mert ha kilóg belőle, akkor az utolsó sor nem látszik.
|
||||
if (ret.Count > 13)
|
||||
{
|
||||
ret.Add(new Tuple<string, string>("", ""));
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue