private void complianceDirectiveControl_SelectedItemsChanged(object sender, SelectedItemsChangeEventArgs e) { bool permission = currentDetail.HasPermission(Users.CurrentUser, DataEvent.Update); buttonEditRecord.Enabled = (permission && (e.ItemsCount > 0) && (e.ItemsCount < 2)); buttonDeleteRecord.Enabled = (permission && (e.ItemsCount > 0)); }
/// <summary> /// Заполняет поля для редактирования агрегата /// </summary> public void UpdateInformation() { double e = 0.00000001; /*if ((currentDetail.Warranty.IsHoursApplicable && currentDetail.Warranty.Hours.TotalHours > 0) || * (currentDetail.Warranty.IsCyclesApplicable && currentDetail.Warranty.Cycles > 0)) * radioButtonOperationalTime.Checked = true; * else if (currentDetail.Warranty.IsCalendarApplicable && currentDetail.Warranty.Calendar.TotalDays > 0) * radioButtonExpires.Checked = true;*/ if (Math.Abs(currentDetail.Warranty.Hours.TotalHours) > e || currentDetail.Warranty.Cycles > 0) { radioButtonOperationalTime.Checked = true; } else if (Math.Abs(currentDetail.Warranty.Calendar.TotalDays) > e) { radioButtonExpires.Checked = true; } else { radioButtonNoWarranty.Checked = true; } lifelengthViewerWarranty.Lifelength = currentDetail.Warranty; lifelengthViewerRemains.Lifelength = currentDetail.WarrantyRemains; dateTimePickerExpires.Value = currentDetail.ManufactureDate.AddDays(currentDetail.Warranty.Calendar.TotalDays); bool permission = (currentDetail.HasPermission(Users.CurrentUser, DataEvent.Update)); lifelengthViewerWarranty.ReadOnly = !permission; }
/// <summary> /// ќбновл¤ет информацию об агрегате /// </summary> public void UpdateInformation() { if (currentDetail is BaseDetail) { statusLinkLabel.Status = (Statuses)((BaseDetail)currentDetail).ConditionState; } else { statusLinkLabel.Status = (Statuses)currentDetail.ConditionState; } statusLinkLabel.Text = "Status: " + UsefulMethods.EnumToString(statusLinkLabel.Status); checkBoxServiceable.Checked = currentDetail.Serviceable; buttonDeleteDetail.Enabled = currentDetail.HasPermission(Users.CurrentUser, DataEvent.Remove); checkBoxServiceable.Enabled = currentDetail.HasPermission(Users.CurrentUser, DataEvent.Update); if (currentDetail is BaseDetail) { flowLayoutPanelLinks.UpdateInformation(); } }
/// <summary> /// Заполняет поля для редактирования агрегата /// </summary> public void UpdateInformation(AbstractDetail detail) { if (detail == null) { throw new ArgumentNullException("detail"); } UpdateRadioButtonsStores(); CurrentStore = parentStore; ShelfLife = detail.ShelfLife; Location = detail.Location; ExpirationDate = currentDetail.ExpirationDate; NotificationDate = detail.NotificationDate; bool permission = (detail.HasPermission(Users.CurrentUser, DataEvent.Update)); for (int i = 0; i < radioButtonsStores.Count; i++) { radioButtonsStores[i].Enabled = permission; } textBoxShelfLife.ReadOnly = !permission; textBoxLocation.ReadOnly = !permission; dateTimePickerExpirationDate.Enabled = permission; dateTimePickerNotificationDate.Enabled = permission; }