Пример #1
0
        public void CreateTAReport(int userId, int?departmentId, string name,
                                   DateTime ReportDate, Int16 day, float hours, int shift, byte status, Boolean completed, Boolean isDeleted)
        {
            using (IUnitOfWork work = UnitOfWork.Begin())
            {
                TAReport taReport = new TAReport();

                taReport              = DomainObjectFactory.CreateTAReport();
                taReport.UserId       = userId;
                taReport.DepartmentId = departmentId;
                taReport.Name         = name;
                //taReport.YearMonth = yearMonth;
                taReport.Day        = day;
                taReport.Hours      = hours;
                taReport.ReportDate = ReportDate;
                TimeSpan t = TimeSpan.FromSeconds(hours);
                taReport.Hours_Min    = string.Format("{0:D2}:{1:D2}:{2:D2}", t.Hours, t.Minutes, t.Seconds);
                taReport.Shift        = shift;
                taReport.Status       = status;
                taReport.Completed    = completed;
                taReport.IsDeleted    = isDeleted;
                taReport.Timestamp    = BitConverter.GetBytes(DateTime.Now.Ticks);
                taReport.ModifiedLast = DateTime.Now;
                taReport.ModifiedId   = CurrentUser.Get().Id;
                _taReportRepository.Add(taReport);
                work.Commit();

                var taReportLogEntity = new TAReportEventEntity(taReport);
                _logService.CreateLog(CurrentUser.Get().Id, "web", flag, CurrentUser.Get().HostName, CurrentUser.Get().CompanyId, taReportLogEntity.GetCreateMessage());

                string taReport_value = string.Format("{0} {1} {2}", name, hours, taReport.ModifiedLast.ToString("dd.MM.yyyy"));

                _controllerUpdateService.CreateControllerUpdate(CurrentUser.Get().Id, taReport.Id, UpdateParameter.TAReportChange, ControllerStatus.Created, taReport_value);
            }
        }
Пример #2
0
        public void CreateTAMove(int userId, int departmentId, string name,
                                 DateTime ReportDate, Int16 day, float hours, int shift, byte status, Boolean completed, Boolean isDeleted)
        {
            int _hours, _minutes;

            using (IUnitOfWork work = UnitOfWork.Begin())
            {
                TAReport taReport = DomainObjectFactory.CreateTAReport();
                taReport.UserId       = userId;
                taReport.DepartmentId = departmentId;
                taReport.Name         = name;
                //taReport.YearMonth = yearMonth;
                taReport.Day       = day;
                taReport.Hours     = hours;
                _hours             = (int)Math.Floor(hours);            // täisarvulised tunnid
                _minutes           = (int)((hours - _hours) * 60) % 60; // murdosa minutiteks
                taReport.Hours_Min = Convert.ToString(_hours) + ':';
                if (_minutes < 10)
                {
                    taReport.Hours_Min = taReport.Hours_Min + Convert.ToString(_minutes);
                }
                else
                {
                    taReport.Hours_Min = taReport.Hours_Min + '0' + Convert.ToString(_minutes);
                }
                taReport.Shift     = shift;
                taReport.Status    = status;
                taReport.Completed = completed;
                taReport.IsDeleted = isDeleted;
                taReport.Timestamp = BitConverter.GetBytes(DateTime.Now.Ticks);
                //              taReport.ScheduleNo = 1;
                taReport.ModifiedLast = DateTime.Now;
                taReport.ModifiedId   = CurrentUser.Get().Id;
                _taReportRepository.Add(taReport);
                work.Commit();

                var taReportLogEntity = new TAReportEventEntity(taReport);

                _logService.CreateLog(CurrentUser.Get().Id, "web", falg, CurrentUser.Get().HostName, CurrentUser.Get().CompanyId, taReportLogEntity.GetCreateMessage());

                string taReport_value = string.Format("{0} {1} {2}", name, hours, taReport.ModifiedLast.ToString("dd.MM.yyyy"));

                _controllerUpdateService.CreateControllerUpdate(CurrentUser.Get().Id, taReport.Id, UpdateParameter.TAReportChange, ControllerStatus.Created, taReport_value);
            }
        }