private void OnCellEndEdit(object sender, DataGridViewCellEventArgs e) { DataGridViewRow row = dataGrid.CurrentRow; DataGridViewCell cell = dataGrid.CurrentCell; TickUserElement userElement = (TickUserElement)row.Tag; row.ErrorText = ""; userElement[e.ColumnIndex] = Int32.Parse(cell.Value.ToString()); saveNeeded = true; }
public ExceptionDialog(TickUserElement userElement) : base() { this.Icon = resources.stock_lock_32; this.Size = new Size(350, 350); this.Text = "Ausnahmen"; this.FormBorderStyle = FormBorderStyle.FixedDialog; this.userElement = userElement; createUI(); loadData(); }
private void OnRowDeleted(object sender, DataGridViewRowEventArgs e) { DataGridViewRow row = e.Row; TickUserElement userElement = (TickUserElement)row.Tag; if (userElement != null) { configuration.Users.Remove(userElement); } saveNeeded = true; }
private void OnCellContentClick(object sender, DataGridViewCellEventArgs e) { TickUserElement userElement = (TickUserElement)dataGrid.CurrentRow.Tag; if (e.ColumnIndex == dataGrid.ColumnCount - 1) { ExceptionDialog dialog = new ExceptionDialog(userElement); dialog.ShowDialog(this); saveNeeded = true; } }
private void OnRemoveUserButtonClick(object sender, EventArgs e) { DataGridViewRow row = dataGrid.CurrentRow; if (row != null) { TickUserElement userElement = (TickUserElement)row.Tag; DialogResult confirmation = MessageBox.Show( String.Format("Die Zeitbegrenzung für Benutzer '{0}' wirklich entfernen?", userElement.Name), "Bestätigung", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (confirmation == DialogResult.Yes) { dataGrid.Rows.Remove(row); configuration.Users.Remove(userElement); saveNeeded = true; } } }
private void OnAddUserButtonClick(object sender, EventArgs e) { string userName = Prompt.ShowDialog("Bitte Benutzername eingeben", "Neuer Benutzer"); if (!String.IsNullOrEmpty(userName)) { TickUserElement userElement = new TickUserElement(); userElement.Name = userName; configuration.Users.Add(userElement); int index = dataGrid.Rows.Add(new String[] { userElement.Name, userElement.Montag, userElement.Dienstag, userElement.Mittwoch, userElement.Donnerstag, userElement.Freitag, userElement.Samstag, userElement.Sonntag }); DataGridViewRow row = dataGrid.Rows[index]; row.Tag = userElement; dataGrid.CurrentCell = row.Cells[1]; dataGrid.BeginEdit(true); saveNeeded = true; } }
private int getUserLimitForDate(string username, DateTime date) { int limit = 0; TickUserElement userElement = configuration.Users[username]; if (userElement != null) { int dayOfWeek = (int)date.DayOfWeek; if (dayOfWeek == 0) { dayOfWeek = 7; } limit = userElement[dayOfWeek]; if (userElement.Exceptions != null) { if (userElement.Exceptions[date] != null) { limit = userElement.Exceptions[date].Minutes; } } } return(limit); }
public void Add(TickUserElement userElement) { base.BaseAdd(userElement); }
public void Remove(TickUserElement userElement) { base.BaseRemove(userElement.Name); }