Ejemplo n.º 1
0
        private void tm_ClearTime_Click(object sender, EventArgs e)
        {
            if (ReadOnly)
            {
                return;
            }


            if (gridView.SelectedRowsCount == 1)
            {
                GridCell[] cells = gridView.GetSelectedCells();

                if (cells != null && cells.Length >= 1)
                {
                    bool ignore = false;
                    for (int i = 0; i < cells.Length; i++)
                    {
                        if (cells[i].Column.Tag == null)
                        {
                            ignore = true;
                        }
                    }
                    if (!ignore)
                    {
                        EmployeePlanningWeek empl = FocusedEntity;
                        if (empl != null)
                        {
                            EmployeeDayView dayView = m_dailyView.GetByEmployeeId(empl.EmployeeId);
                            if (dayView != null)
                            {
                                int begin = GetColumnInfo(cells[0].Column).FromTime;
                                int end   = GetColumnInfo(cells[cells.Length - 1].Column).FromTime;
                                for (int i = begin; i < end + (int)CurrentView; i += (int)CurrentView)
                                {
                                    dayView.RemoveWorkingTime(i, i + (int)CurrentView);
                                }
                                if (dayView.Modified)
                                {
                                    Context.Modified = true;
                                }
                            }
                        }
                        UpdateEmployeePlanningDays();

                        return;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void gridControl_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (ReadOnly)
            {
                return;
            }

            GridHitInfo info = gridView.CalcHitInfo(e.X, e.Y);

            if (info.InRow)
            {
                TimeColumnInfo timeinfo = GetColumnInfo(info.Column);

                if (timeinfo != null)
                {
                    EmployeeDayView dayView = GetEmployeeDayView();

                    if (dayView != null)
                    {
                        if (dayView.IsBuzyByTimeRange(timeinfo.FromTime, timeinfo.ToTime))
                        {
                            dayView.RemoveWorkingTime(timeinfo.FromTime, timeinfo.ToTime);
                        }
                        else
                        {
                            dayView.AddWorkingTime(timeinfo.FromTime, timeinfo.ToTime);
                        }

                        if (dayView.Modified)
                        {
                            Context.Modified = true;
                        }

                        UpdateEmployeePlanningDays();
                    }
                }
            }
        }