private void btnAddDoorbell_Click(object sender, RoutedEventArgs e) { if (cbboxBuildings.SelectedIndex >= 0) { var dialog = new AddDoorbellDialog(); dialog.ShowDialog(); if (dialog.DialogResult.HasValue && dialog.DialogResult.Value) { var building = (Building)cbboxBuildings.SelectedItem; var doorbell = new Doorbell(-1, dialog.DoorbellName, building); if (doorbell.AddDoorbell()) { MessageBox.Show("Doorbell added to the database."); building.RefreshDoorbells(); RefreshDataGrid(); } else { MessageBox.Show("Error: Could not add doorbell to database."); } } else { MessageBox.Show("Cancel"); } } }
public Log(Doorbell doorbell, int userId, DateTime dateTime, string picturePath, string errorMessage) { //DoorbellId = doorbellId; this.Doorbell = doorbell; UserId = userId; if (String.IsNullOrEmpty(picturePath) && String.IsNullOrEmpty(errorMessage)) { Type = LogType.None; } else if (String.IsNullOrEmpty(errorMessage)) { Type = LogType.DoorbellRang; } else { Type = LogType.Error; } DateTime = dateTime; PicturePath = picturePath; ErrorMessage = errorMessage; }
public LogDateLabel(Doorbell doorbell, int userId, DateTime dateTime, string picturePath, string errorMessage) : base(doorbell, userId, dateTime, picturePath, errorMessage) { }