public IList <EmployeeWorkChart> GetWorkChartForEmployeeByDate(IUnitOfWork uow, Employee employee, DateTime date)
        {
            EmployeeWorkChart ewcAlias = null;

            return(uow.Session.QueryOver <EmployeeWorkChart>(() => ewcAlias)
                   .Where(() => ewcAlias.Employee.Id == employee.Id)
                   .Where(() => ewcAlias.Date.Month == date.Month)
                   .Where(() => ewcAlias.Date.Year == date.Year)
                   .List());
        }
示例#2
0
        public IList <EmployeeWorkChart> GetWorkChart()
        {
            activeHalfCells.Sort();
            IList <EmployeeWorkChart> ewcList = new List <EmployeeWorkChart>();
            EmployeeWorkChart         tempEWC = new EmployeeWorkChart();

            HalfCell prevCell = null;
            HalfCell thisCell = null;
            HalfCell nextCell = null;

            for (int i = 0; i < activeHalfCells.Count; i++)
            {
                thisCell = activeHalfCells[i];

                if (i + 1 < activeHalfCells.Count)
                {
                    nextCell = activeHalfCells[i + 1];
                }

                tempEWC.Date = new DateTime(this.Date.Year, this.Date.Month, thisCell.CellNumber.X);

                if (prevCell == null)
                {
                    double timeToAdd = 0;
                    timeToAdd = activeHalfCells[i].CellNumber.Y - topHeadersCount;
                    if (activeHalfCells[i].half == Half.Bottom)
                    {
                        timeToAdd += 0.5;
                    }

                    tempEWC.StartTime = TimeSpan.FromHours(timeToAdd);
                }

                prevCell = thisCell;

                if (!IsOneSection(thisCell, nextCell))
                {
                    double timeToAdd = 0;
                    //Плюсуем половину, для того, чтобы в базу записывался весь промежуток
                    timeToAdd = activeHalfCells[i].CellNumber.Y - topHeadersCount + 0.5;
                    if (activeHalfCells[i].half == Half.Bottom)
                    {
                        timeToAdd += 0.5;
                    }

                    tempEWC.EndTime = TimeSpan.FromHours(timeToAdd);
                    ewcList.Add(tempEWC);
                    prevCell = null;
                    tempEWC  = new EmployeeWorkChart();
                }
            }
            return(ewcList);
        }
示例#3
0
        public IList<EmployeeWorkChart> GetWorkChart()
        {
            activeHalfCells.Sort();
            IList<EmployeeWorkChart> ewcList = new List<EmployeeWorkChart>();
            EmployeeWorkChart tempEWC = new EmployeeWorkChart();

            HalfCell prevCell = null;
            HalfCell thisCell = null;
            HalfCell nextCell = null;

            for (int i = 0; i < activeHalfCells.Count; i++)
            {
                thisCell = activeHalfCells[i];

                if (i + 1 < activeHalfCells.Count)
                    nextCell = activeHalfCells[i + 1];

                tempEWC.Date = new DateTime(this.Date.Year, this.Date.Month, thisCell.CellNumber.X);

                if (prevCell == null)
                {
                    double timeToAdd = 0;
                    timeToAdd = activeHalfCells[i].CellNumber.Y - topHeadersCount;
                    if (activeHalfCells[i].half == Half.Bottom)
                        timeToAdd += 0.5;

                    tempEWC.StartTime = TimeSpan.FromHours(timeToAdd);
                }

                prevCell = thisCell;

                if (!IsOneSection(thisCell, nextCell))
                {
                    double timeToAdd = 0;
                    //Плюсуем половину, для того, чтобы в базу записывался весь промежуток
                    timeToAdd = activeHalfCells[i].CellNumber.Y - topHeadersCount + 0.5;
                    if (activeHalfCells[i].half == Half.Bottom)
                        timeToAdd += 0.5;

                    tempEWC.EndTime = TimeSpan.FromHours(timeToAdd);
                    ewcList.Add(tempEWC);
                    prevCell = null;
                    tempEWC = new EmployeeWorkChart();
                }
            }
            return ewcList;
        }