private void contextMenuStrip_Opening(object sender, CancelEventArgs e) { if (ReadOnly) { e.Cancel = true; } if (!isUserWriteRight) { return; } if (FocusedEntity == null) { sm_EditUAAH.Enabled = false; sm_DeleteUAAH.Enabled = false; } else { sm_EditUAAH.Enabled = FocusedEntity.Year >= DateTime.Now.Year && !UCCountryEdit.IsEstimationExist(FocusedEntity.Year, Country.ID); sm_DeleteUAAH.Enabled = sm_EditUAAH.Enabled; } if (EntityCountry == null) { e.Cancel = true; } }
public bool AddWithChecking(DateTime dt) { if (!IsExistsYearlyWorkingDay(dt) && dt >= DateTime.Now.Date && !UCCountryEdit.IsEstimationExist(dt, CountryID)) { Add(new YearlyWorkingDay(dt, CountryID)); return(true); } return(false); }
private void updateEnableButtonNew() { for (int i = 0; i < dateNavigatorClosedDay.Selection.Count; i++) { if (dateNavigatorClosedDay.Selection[i].Date < DateTime.Now.Date || UCCountryEdit.IsEstimationExist(dateNavigatorClosedDay.Selection[i], Country.ID)) { btn_Add.Enabled = false; return; } } btn_Add.Enabled = true; }
protected void UpdateBarButtons() { if (FocusedEntity == null) { bi_EditUAAH.Enabled = false; bi_DeleteUAAH.Enabled = false; } else { bi_DeleteUAAH.Enabled = FocusedEntity.Year >= DateTime.Now.Year && !UCCountryEdit.IsEstimationExist(FocusedEntity.Year, Country.ID); bi_EditUAAH.Enabled = bi_DeleteUAAH.Enabled; } }
void UpdateEnableButton() { if (FocusedEntity == null) { bi_DeleteClosedDays.Enabled = false; } else { bi_DeleteClosedDays.Enabled = FocusedEntity.WorkingDay >= DateTime.Now.Date && !UCCountryEdit.IsEstimationExist(FocusedEntity.WorkingDay, Country.ID); } bt_Apply.Enabled = FocusedEntity != null; }
private void GridControl_MouseDoubleClick(object sender, MouseEventArgs e) { if (!isUserWriteRight) { return; } GridHitInfo info = gridView_UnAdHours.CalcHitInfo(e.X, e.Y); if (info.InRowCell && gridView_UnAdHours.IsDataRow(info.RowHandle)) { CountryAdditionalHour amount = GetEntityByRowHandle(info.RowHandle); if (amount != null) { if (FocusedEntity.Year >= DateTime.Now.Year && !UCCountryEdit.IsEstimationExist(FocusedEntity.Year, Country.ID)) { EditEntity(amount); } } } }
private void gridView_KeyDown(object sender, KeyEventArgs e) { if (!isUserWriteRight) { return; } switch (e.KeyCode) { case Keys.Insert: NewEntity(); break; case Keys.Delete: if (FocusedEntity != null) { if (FocusedEntity.Year >= DateTime.Now.Year && !UCCountryEdit.IsEstimationExist(FocusedEntity.Year, Country.ID)) { DeleteEntity(); } } break; } }
public bool DeleteEntity(YearlyWorkingDay amount) { YearlyWorkingDay am = amount; if (am == null) { return(false); } if (am.WorkingDay < DateTime.Now.Date || UCCountryEdit.IsEstimationExist(am.WorkingDay, Country.ID)) { return(false); } try { ClientEnvironment.YearlyWorkingDayService.DeleteByID(am.ID); YearlyWorkingDay removing = ListOfClosedDays.GetItemByID(am.ID); if (removing != null) { ListOfClosedDays.Remove(removing); UpdateEnableButton(); return(true); } } catch (ValidationException) { ErrorMessage("CantDeleteYearlyAppearance"); return(false); } catch (EntityException ex) { ProcessEntityException(ex); return(false); } return(false); }
private void gridView_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e) { if (FocusedEntity != null) { bi_DeleteClosedDays.Enabled = FocusedEntity.WorkingDay >= DateTime.Now.Date && !UCCountryEdit.IsEstimationExist(FocusedEntity.WorkingDay, Country.ID); } }
private void gridViewCloseDay_KeyDown(object sender, KeyEventArgs e) { if (!isWriteRigth) { return; } switch (e.KeyCode) { case Keys.Insert: NewEntity(); break; case Keys.Delete: if (FocusedEntity != null && FocusedEntity.WorkingDay >= DateTime.Now.Date && !UCCountryEdit.IsEstimationExist(FocusedEntity.WorkingDay, Country.ID)) { DeleteEntity(); } break; } }
private void contextMenuStripCloseDay_Opening(object sender, CancelEventArgs e) { if (ReadOnly) { e.Cancel = true; } if (FocusedEntity == null) { toolStripMenuItem_DeleteClosedDays.Enabled = false; } else { toolStripMenuItem_DeleteClosedDays.Enabled = FocusedEntity.WorkingDay >= DateTime.Now.Date && !UCCountryEdit.IsEstimationExist(FocusedEntity.WorkingDay, Country.ID); } if (EntityCountry == null) { e.Cancel = true; } }
private void gridViewYearly_focusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { if (FocusedEntity != null) { bi_EditYearlyAppearance.Enabled = FocusedEntity.Year >= DateTime.Now.Year && !UCCountryEdit.IsEstimationExist(FocusedEntity.Year, EntityCountry.ID); bi_DeleteYearlyAppearance.Enabled = bi_EditYearlyAppearance.Enabled; } }
void UpdateButtonEnable() { if (FocusedEntity == null) { bi_EditYearlyAppearance.Enabled = bi_DeleteYearlyAppearance.Enabled = false; } else { bi_EditYearlyAppearance.Enabled = FocusedEntity.Year >= DateTime.Now.Year && !UCCountryEdit.IsEstimationExist(FocusedEntity.Year, EntityCountry.ID); bi_DeleteYearlyAppearance.Enabled = bi_EditYearlyAppearance.Enabled; } //set focuse by row with now dateTime if (FocusedEntity != null) { if (FocusedEntity.Year != DateTime.Today.Year) { for (int i = 0; i < gridViewYearly.RowCount; i++) { if (GetEntityByRowHandle(i).Year == DateTime.Now.Year) { gridViewYearly.FocusedRowHandle = i; return; } } } } }
public UCCountryProperties() { InitializeComponent(); btn_Save.Enabled = UCCountryEdit.isUserWriteRight(); }