private void OnAreaChange(AreaController area) { playedSoundsCache.Clear(); currentLabels.Clear(); currentAlerts.Clear(); CurrentIcons.Clear(); }
private void LoadData(DataSet ds) { const int TBL_GENERAL = 0; const int TBL_LOCATIONS = 1; const int TBL_STATUS_HISTORY = 2; const int TBL_CURRENT_ICONS = 3; const int TBL_CURRENT_FILES = 4; const int TBL_CURRENT_ACCESS = 5; const int ROW_FIRST = 0; DataTable dtGeneral = ds.Tables[TBL_GENERAL]; if (dtGeneral.Rows.Count > 0) { DataRow dr = dtGeneral.Rows[ROW_FIRST]; // badge info Badge.BadgeID = (int)dr["BadgeID"]; Badge.BadgeNumber = (string)dr["BadgeNumber"]; Badge.BadgeColor = (string)dr["BadgeColor"]; Badge.WhenBecomesActive = (DateTime)dr["WhenBadgeBecomesActive"]; Badge.WhenExpires = (DateTime)dr["WhenBadgeExpires"]; Badge.BadgeStatus = (string)dr["BadgeStatus"]; // person info Person.NamePrefix = (string)dr["NamePrefixDescription"]; Person.FirstName = (string)dr["FirstName"]; Person.MiddleName = (string)dr["MiddleName"]; Person.LastName = (string)dr["LastName"]; Person.NameSuffix = (string)dr["NameSuffixDescription"]; // Unknown info Miscellaneous.FingerprintDate = Badge.WhenBecomesActive; Miscellaneous.PrintDate = Badge.WhenBecomesActive; Miscellaneous.PrintUser = "******"; // Company info Company.CompanyCode = (string)dr["CompanyCode"]; Company.CompanyID = (int)dr["CompanyID"]; Company.CorporationName = (string)dr["CorporationName"]; // Division info Division.DivisionID = (int)dr["DivisionID"]; Division.DivisionCode = (string)dr["DivisionCode"]; Division.DivisionName = (string)dr["DivisionName"]; if (dr.Table.Columns.Contains("DivisionTypeName")) { Division.DivisionTypeName = (string)dr["DivisionTypeName"]; } Division.JobRole = (string)dr["JobRoleDescription"]; } DataTable dtLocations = ds.Tables[TBL_LOCATIONS]; if (dtLocations.Rows.Count > 0) { foreach (DataRow row in dtLocations.Rows) { Locations.Add(new Location(row)); } SelectedLocation = Locations[0]; } DataTable dtStatusHistory = ds.Tables[TBL_STATUS_HISTORY]; StatusHistory.Clear(); if (dtStatusHistory.Rows.Count > 0) { foreach (DataRow row in dtStatusHistory.Rows) { StatusHistory.Add(new BadgeStatusPeriod(row)); } } DataTable dtCurrentIcons = ds.Tables[TBL_CURRENT_ICONS]; CurrentIcons.Clear(); if (dtCurrentIcons.Rows.Count > 0) { foreach (DataRow row in dtCurrentIcons.Rows) { CurrentIcons.Add(new BadgeIcon(row)); } } DataTable dtCurrentFiles = ds.Tables[TBL_CURRENT_FILES]; CurrentFiles.Clear(); if (dtCurrentFiles.Rows.Count > 0) { foreach (DataRow row in dtCurrentFiles.Rows) { CurrentFiles.Add(new BadgeFile(row)); } } /**** * else * { * CurrentFiles.Add(new BadgeFile("text file (54) (spoofed data)", "54", "text/plain")); * CurrentFiles.Add(new BadgeFile("pdf file (5) (spoofed data)", "5", "application/pdf")); * } */ DataTable dt = ds.Tables[TBL_CURRENT_ACCESS]; CurrentAccess.Clear(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { CurrentAccess.Add(new BadgeAccessCategory(row)); } } /*** * else * { * CurrentAccess.Add(new BadgeAccessCategory()); * CurrentAccess.Add(new BadgeAccessCategory()); * CurrentAccess.Add(new BadgeAccessCategory()); * CurrentAccess.Add(new BadgeAccessCategory()); * } */ }