public Dictionary<string, List<DataRow>> GetSortedProjektSelection(SortOrder RequestedSortOrder, Basics.DataSelection RequestedPhase, String AddOnSelection = "") { DbEntities.dbserver3.wordup.rows.ProjektUebersicht[] SelectionProjektUebersicht = Data.DbServer3.WordUp .ProjektUebersichten .Find_PhasenRelatedProjektUebersichten(RequestedPhase.ToString(), RequestedSortOrder.ToString()); //DataTable SelectionProjektUebersicht = GetPhasenRichtigeProjektDaten // (RequestedPhase, RequestedSortOrder, ProjektUebersichtProjektSelectionItems, AddOnSelection); String OldSortContent = String.Empty; List<DataRow> ActualList = null; Dictionary<string, List<DataRow>> Result = new Dictionary<string, List<DataRow>>(); foreach (DataRow SortedRow in SelectionProjektUebersicht) { String SortContent = String.Empty; switch (RequestedSortOrder) { case SortOrder.Verantwortlich: SortContent = SortedRow["Zustaendig"].ToString(); break; case SortOrder.ArbeitsGruppen: case SortOrder.ArbeitsGruppenGetrennt: SortContent = SortedRow["OrtsTeil"].ToString() + " - " + SortedRow["ArbeitsGruppenNameID"].ToString(); break; case SortOrder.Typen: SortContent = SortedRow["ProjektTyp"].ToString(); break; case SortOrder.NumericProjektID: { SortContent = SortedRow["NumericProjektID"].ToString() + " - " + GetOrteBezeichnung(SortedRow) + " - " + SortedRow["ProjektBeschreibung"].ToString(); } break; } if (String.IsNullOrEmpty(SortContent)) SortContent = "Undefined"; if (!Result.Keys.Contains(SortContent)) Result[SortContent] = new List<DataRow>(); Result[SortContent].Add(SortedRow); } return Result; }
public DataTable GetPhasenRichtigeProjektDaten(Basics.DataSelection RequestedPhase, SortOrder RequestedSortOrder, String ItemsToSelect = "", String AdditionalSelector = "", String WordUpIDToUse = "") { if (String.IsNullOrEmpty(ItemsToSelect)) ItemsToSelect = ProjektUebersichtProjektSelectionItems; if (String.IsNullOrEmpty(WordUpIDToUse)) WordUpIDToUse = WordUpID; String OrderBy = String.Empty; switch (RequestedSortOrder) { case SortOrder.Verantwortlich: OrderBy = " Zustaendig, " + ActuallProjektUebersichtSortOrder; break; case SortOrder.ArbeitsGruppen: case SortOrder.ArbeitsGruppenGetrennt: OrderBy = ActuallProjektUebersichtSortOrder; break; case SortOrder.Typen: OrderBy = " ProjektTyp, " + ActuallProjektUebersichtSortOrder; break; case SortOrder.NumericProjektID: OrderBy = " NumericProjektID, " + ActuallProjektUebersichtSortOrder; break; } DataTable SelectionProjektUebersicht = null; switch (RequestedPhase) { case Basics.DataSelection.Wuensche: case Basics.DataSelection.Ideen: SelectionProjektUebersicht = WordUpBasics.WordUpWCFAccess.GetCommonDataSet ("Select " + ItemsToSelect + " from ProjektUebersicht where WordUpRootID = '" + WordUpIDToUse + "' " + AdditionalSelector + " order by " + OrderBy).Tables[ "ProjektUebersicht"]; break; case Basics.DataSelection.Planungen: SelectionProjektUebersicht = WordUpBasics.WordUpWCFAccess.GetCommonDataSet ("Select " + ItemsToSelect + " from ProjektUebersicht where WordUpRootID = '" + WordUpIDToUse + "' and Wertigkeit > 0 " + AdditionalSelector + " order by " + OrderBy) .Tables["ProjektUebersicht"]; break; case Basics.DataSelection.Projekte: SelectionProjektUebersicht = WordUpBasics.WordUpWCFAccess.GetCommonDataSet ("Select " + ItemsToSelect + " from ProjektUebersicht where WordUpRootID = '" + WordUpID + "' and ID in (" + "SELECT distinct (ProjektID) FROM Aktivitaeten where WordUpRootID = '" + WordUpIDToUse + "' " + " and (AktivitaetsTypenID = 'D208400A-2A5B-4384-86D6-F95618682BF9')) " + AdditionalSelector + " order by " + OrderBy).Tables["ProjektUebersicht"]; break; case Basics.DataSelection.Realisierungen: SelectionProjektUebersicht = WordUpBasics.WordUpWCFAccess.GetCommonDataSet ("Select " + ItemsToSelect + " from ProjektUebersicht where WordUpRootID = '" + WordUpID + "' and ID in (" + "SELECT distinct (ProjektID) FROM Aktivitaeten where WordUpRootID = '" + WordUpIDToUse + "' " + " and (AktivitaetsTypenID = 'EF1054D3-A3FD-4B98-A4AE-AA03DEB216EC')) " + AdditionalSelector + " order by " + OrderBy).Tables["ProjektUebersicht"]; break; case Basics.DataSelection.Fertig: SelectionProjektUebersicht = WordUpBasics.WordUpWCFAccess.GetCommonDataSet ("Select " + ItemsToSelect + " from ProjektUebersicht where WordUpRootID = '" + WordUpID + "' and ID in (" + "SELECT distinct (ProjektID) FROM Aktivitaeten where WordUpRootID = '" + WordUpIDToUse + "' " + " and (AktivitaetsTypenID = '060B72A5-8B39-4CC3-B5D0-CD09FD233DE1')) " + AdditionalSelector + " order by " + OrderBy).Tables["ProjektUebersicht"]; break; } return SelectionProjektUebersicht; }
/* #region handle DataEntryStatus public DataTable FillDataEntryStatus () { DataTable DataEntryStatus = CreateDataEntryStatusTable (); int SchulLevelConter = 100; foreach (DataRow SchulRow in WordUpBasics.WordUpWCFAccess.GetCommonDataSet ($"Select * from Organisationen where OrganisationenTypID = " + $"'{WordUp23.WordUpResources.OrganisationenTypen.Schule}' and ID in" + " (select OrganisationenID from OrganisationenZuWordUpID where WordUpID = '" + WordUpID + "') " + "order by Beschreibung").Tables["Organisationen"].Rows) { String LocalSchulDatenRoot = Path.Combine (WordUpBasics.SchuDatenRootPath, SchulRow["MaterialRoot"].ToString ()); DataRow SchulDataRow = DataEntryStatus.NewRow (); SchulDataRow ["ID"] = System.Guid.NewGuid ().ToString (); SchulDataRow["OrgOrder"] = Convert.ToString(++SchulLevelConter).Substring(1, 2); SchulDataRow["Typ"] = TypCacheInstance.GetTyp((Guid)SchulRow ["OrganisationenTypID"]).TypNameID; SchulDataRow["CodeName"] = SchulRow["Beschreibung"].ToString(); SchulDataRow["Root"] = SchulRow["MaterialRoot"].ToString(); SchulDataRow["Videos"] = Convert.ToString(WMB.Basics.GetFilesFromDirectory (Path.Combine (LocalSchulDatenRoot, "Videos"), new String [] {"*.M2T"}, -1).Count); SchulDataRow["Bilder"] = Convert.ToString(WMB.Basics.GetFilesFromDirectory (Path.Combine(LocalSchulDatenRoot, "Fotos"), new String[] { "*.JPG" }, -1).Count); DataEntryStatus.Rows.Add(SchulDataRow); FillKlassenEntryStatus (SchulRow, SchulDataRow["OrgOrder"].ToString (), DataEntryStatus); } return DataEntryStatus; } private bool FillKlassenEntryStatus (DataRow SchulRow, String OrgOrder, DataTable DataEntryStatus) { String SchulID = SchulRow ["ID"].ToString (); int KlassenLevelConter = 100; foreach (DataRow KlassenRow in WordUpBasics.WordUpWCFAccess.GetCommonDataSet ("Select * from Organisationen where ParentOrganisationsID = '" + SchulID + "' and ID in" + " (select OrganisationenID from OrganisationenZuWordUpID where WordUpID = '" + WordUpID + "') " + "order by Beschreibung").Tables ["Organisationen"].Rows) { String LocalSchulDatenRoot = Path.Combine (WordUpBasics.SchuDatenRootPath, SchulRow["MaterialRoot"].ToString()); String KlassenOrganisationsID = KlassenRow ["ID"].ToString (); DataRow KlassenDataRow = DataEntryStatus.NewRow(); DateTime Von = Convert.ToDateTime(WordUpBasics.WordUpWCFAccess.GetCommonDataSet ("select Von from FullOrganisationenZuTermine where OrganisationenID = '" + KlassenOrganisationsID + "'") .Tables["FullOrganisationenZuTermine"].Rows [0] [0]); KlassenDataRow["ID"] = System.Guid.NewGuid().ToString(); KlassenDataRow["OrgOrder"] = OrgOrder + Convert.ToString(++KlassenLevelConter).Substring(1, 2); KlassenDataRow["Typ"] = KlassenRow["Typ"].ToString(); KlassenDataRow["CodeName"] = KlassenRow["CodeName"].ToString(); KlassenDataRow["Datum"] = Von; String KlassenName = (KlassenRow ["CodeName"].ToString () + " ").Substring (4, 2); if (KlassenName.Substring (0, 1) == "4") { KlassenDataRow["Kopien"] = Convert.ToString(WMB.Basics.GetFilesFromDirectory (Path.Combine (LocalSchulDatenRoot, KlassenName + "\\WSPersonen"), new String [] {"*.JPG"}, -1).Count); KlassenDataRow ["Vorst"] = Convert.ToString(WordUpBasics.WordUpWCFAccess.GetCommonDataSet ("select count (*) from Personen where ID in " + "(select PersonenID from PersonenZuWordUpID where WordUpID = '" + WordUpID + "') " + "and PersonenTypID = 'A064EAE5-F18E-4A97-8733-0E2DE9E30815' " + "and OrganisationenID = '" + KlassenOrganisationsID + "'").Tables["Personen"].Rows[0][0]); KlassenDataRow["Stv"] = Convert.ToString(WordUpBasics.WordUpWCFAccess.GetCommonDataSet ("select count (*) from Personen where ID in " + "(select PersonenID from PersonenZuWordUpID where WordUpID = '" + WordUpID + "') " + "and PersonenTypID = '4E50F4B3-B1FC-4918-8122-DA4B11EB9C28' " + "and OrganisationenID = '" + KlassenOrganisationsID + "'").Tables["Personen"].Rows[0][0]); KlassenDataRow["Rat"] = Convert.ToString(WordUpBasics.WordUpWCFAccess.GetCommonDataSet ("select count (*) from Personen where ID in " + "(select PersonenID from PersonenZuWordUpID where WordUpID = '" + WordUpID + "') " + "and PersonenTypID = '0B747DCC-59FD-4D51-83C9-D408D722C455' " + "and OrganisationenID = '" + KlassenOrganisationsID + "'").Tables["Personen"].Rows[0][0]); KlassenDataRow["PlakatFotos"] = Convert.ToString(WMB.Basics.GetFilesFromDirectory (Path.Combine(LocalSchulDatenRoot, KlassenName + "\\WSPlakate"), new String[] { "*.JPG" }, -1).Count); KlassenDataRow["PlakateErf"] = Convert.ToString(WordUpBasics.WordUpWCFAccess.GetCommonDataSet ("Select count (distinct (Substring(ErfassungsID, 1, 2))) from WSPlakate where OrganisationenID = '" + KlassenOrganisationsID + "'").Tables["WSPlakate"].Rows[0][0]); KlassenDataRow["Zeilen"] = Convert.ToString(WordUpBasics.WordUpWCFAccess.GetCommonDataSet ("Select count (*) from WSPlakate where OrganisationenID = '" + KlassenOrganisationsID + "'").Tables["WSPlakate"].Rows[0][0]); KlassenDataRow["NichtZugeordnet"] = Convert.ToString(WordUpBasics.WordUpWCFAccess.GetCommonDataSet ("Select count (*) from WSPlakate where OrganisationenID = '" + KlassenOrganisationsID + "' and ProjektID is NULL").Tables["WSPlakate"].Rows[0][0]); } DataEntryStatus.Rows.Add(KlassenDataRow); } return true; } private DataTable CreateDataEntryStatusTable () { DataTable DataEntryStatus = new DataTable("DataEntryStatus"); DataEntryStatus.Columns.Add("ID", typeof(System.Guid)); DataEntryStatus.Columns.Add("OrgOrder", typeof(String)); DataEntryStatus.Columns.Add("Typ", typeof(String)); DataEntryStatus.Columns.Add("Datum", typeof(DateTime)); DataEntryStatus.Columns.Add("CodeName", typeof(String)); DataEntryStatus.Columns.Add("Root", typeof(String)); DataEntryStatus.Columns.Add("Videos", typeof(String)); DataEntryStatus.Columns.Add("Bilder", typeof(String)); DataEntryStatus.Columns.Add("Kopien", typeof(String)); DataEntryStatus.Columns.Add("Vorst", typeof(String)); DataEntryStatus.Columns.Add("Stv", typeof(String)); DataEntryStatus.Columns.Add("Rat", typeof(String)); DataEntryStatus.Columns.Add("PlakatFotos", typeof(String)); DataEntryStatus.Columns.Add("PlakateErf", typeof(String)); DataEntryStatus.Columns.Add("Zeilen", typeof(String)); DataEntryStatus.Columns.Add("NichtZugeordnet", typeof(String)); return DataEntryStatus; } #endregion */ #region Manipulate Chart Data public List<ChartBase> CreateChartBase(SortOrder RequestedSortOrder = SortOrder.ArbeitsGruppen, Basics.DataSelection ExtWordUpPhase = Basics.DataSelection.Error) { if (ExtWordUpPhase == Basics.DataSelection.Error) { ExtWordUpPhase = WordUpPhase; } List<ChartBase> ChartBases = new List<ChartBase>(); DataTable AllProjekte = GetPhasenRichtigeProjektDaten(ExtWordUpPhase, RequestedSortOrder, ChartBase.RequiredItemsFromProjekteUebersicht); foreach (DataRow ProjektRow in AllProjekte.Rows) ChartBases.Add(new ChartBase(ProjektRow)); return ChartBases; }