コード例 #1
0
 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");
         }
     }
 }
コード例 #2
0
        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;
        }
コード例 #3
0
 public LogDateLabel(Doorbell doorbell, int userId, DateTime dateTime, string picturePath, string errorMessage) : base(doorbell, userId, dateTime, picturePath, errorMessage)
 {
 }