Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 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;
     }
 }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 6
0
        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);
                    }
                }
            }
        }
Exemplo n.º 7
0
        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;
            }
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
 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);
     }
 }
Exemplo n.º 10
0
        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;
            }
        }
Exemplo n.º 11
0
 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;
     }
 }
Exemplo n.º 12
0
 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;
     }
 }
Exemplo n.º 13
0
        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;
                        }
                    }
                }
            }
        }
Exemplo n.º 14
0
 public UCCountryProperties()
 {
     InitializeComponent();
     btn_Save.Enabled = UCCountryEdit.isUserWriteRight();
 }