private DBList <DBBreak> CreateBreaks(IDateTimeIterator _dtIterator, DateTime _startDate, DateTime _endDate, int _count) { var breaks = new DBList <DBBreak>(); _count = _count.Min(MAX_BREAKS); foreach (var dt in _dtIterator.GetIterator(_startDate, _endDate, 0, _count)) { //Abwesenheit in MT Auftrag evtl. verboten //ANF-06805-F1G6Z2|Lifta| if (!Data.IsAbsenceAllowed(WorkerNr, dt + Begin.TimeOfDay, mandant.MTOhneAbwesenheiten)) { continue; } foreach (var workerNr in workerNrs) { var b = MakeBreak(); b.WorkerNr = workerNr; b.Nr = Data.GetBreakSequence(); if (groupNr == 0) { groupNr = b.Nr; } b.GroupNr = groupNr; b.GroupRule = groupRule; b.Begin = dt + Begin.TimeOfDay; b.Date = dt; breaks.Add(b); EventHub.Handle(lang, EventType.WorkerBreak, DateTime.Now, this.GetType().Name, this.username, EventParams.Create("workernr", workerNr, "info", FLS.Texts.Text.Get(lang, FLS.Texts.Text.Pauseaenderung), "text", FLS.Texts.Text.Get(lang, FLS.Texts.Text.Pauseaenderung) + ":" + b.Begin, "shift", shift)); } } return(breaks); }
/// <param name="ShowLoginHistory">Allow user to select from list of previous usernames and databases</param> /// <param name="HistoryLength">Number of items to store in the history</param> /// <param name="SettingsDir">Settings directory (location to store list of logins)</param> /// <param name="SchemaPath">Full path to directory where XML Schemas are stored</param> /// <param name="Databases">List of databases to allow the user to choose from</param> public Login( bool ShowLoginHistory, int HistoryLength, string SettingsDir, string SchemaPath, StringCollection Servers) { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); //Clears text boxes UserName = ""; Password = ""; Server = ""; //In case they didn't pass a trailing backslash if (SettingsDir[SettingsDir.Length - 1] != '\\') { SettingsDir += "\\"; } if (SchemaPath[SchemaPath.Length - 1] != '\\') { SchemaPath += "\\"; } //Create the settings directory, in case it doesn't exist if (!System.IO.Directory.Exists(SettingsDir)) { System.IO.Directory.CreateDirectory(SettingsDir); } userListXmlFile = SettingsDir + "DBLoginHistory.xml"; //Create the login history list history = new LoginHistory(SchemaPath, userListXmlFile); //Just in case the HistoryLength passed is negative history.HistoryLength = Math.Abs(HistoryLength); //safeguard against negative input //This is how you disable the Login History, if ShowLoginHistory is false userName.Properties.Buttons[0].Visible = ShowLoginHistory; //Load databases into the combo box's dropdown DBList.Clear(); foreach (string db in Servers) { DBList.Add(db); } SetWindowText(); }
public DBConfig(JArray config_arr) { foreach (var item in config_arr) { DBList.Add(new DBConfig() { Tag = item["tag"]?.ToString(), Conn = Common.AESDecrypt(item["conn"]?.ToString(), CommonConfig.GGUID), DbType = (EnumDBType)int.Parse(item["db_type"].ToString()), ActionType = (EnumDBActionType)int.Parse(item["action_type"].ToString()), }); } DBConfig db = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? Get("main_origin") : Get("main"); this.Tag = db.Tag; this.Conn = db.Conn; this.DbType = db.DbType; this.ActionType = db.ActionType; Instance = this; }
/// <param name="ShowLoginHistory">Allow user to select from list of previous usernames and databases</param> /// <param name="HistoryLength">Number of items to store in the history</param> /// <param name="SettingsDir">Settings directory (location to store list of logins)</param> /// <param name="SchemaPath">Full path to directory where XML Schemas are stored</param> /// <param name="Servers">List of databases to allow the user to choose from</param> public frmLogin( bool ShowLoginHistory, int HistoryLength, string SettingsDir, string SchemaPath, StringCollection Servers) { InitializeComponent(); //Clears text boxes UserName = ""; Password = ""; Server = ""; Database = ""; settingsDir = SettingsDir; //In case they didn't pass a trailing backslash if (SettingsDir[SettingsDir.Length - 1] != '\\') { SettingsDir += "\\"; } if (SchemaPath[SchemaPath.Length - 1] != '\\') { SchemaPath += "\\"; } //Create the settings directory, in case it doesn't exist if (!System.IO.Directory.Exists(SettingsDir)) { System.IO.Directory.CreateDirectory(SettingsDir); } userListXmlFile = Path.Combine(SettingsDir, "DBLoginHistory.xml"); string userListXmdFile = Path.Combine(SettingsDir, "LoginHistory.xsd"); string xsdDistLocation = Path.Combine(System.Environment.CurrentDirectory, "LoginHistory.xsd"); if (!File.Exists(userListXmdFile)) { File.Copy(xsdDistLocation, userListXmdFile); } ReadUserSettings(); //Create the login history list history = new LoginHistory(SchemaPath, userListXmlFile); //Just in case the HistoryLength passed is negative history.HistoryLength = Math.Abs(HistoryLength); //safeguard against negative input //This is how you disable the Login History, if ShowLoginHistory is false userName.Properties.Buttons[0].Visible = ShowLoginHistory; //Load databases into the combo box's dropdown DBList.Clear(); foreach (string db in Servers) { DBList.Add(db); } SetWindowText(); }