Пример #1
0
        /// <summary>
        /// 시간당 체크 데이터 리스트 메소드
        /// </summary>
        /// <param name="day"></param>
        /// <returns></returns>
        public List <PeriodSummary> DaySearch(DateTime day)
        {
            using (var context = DbContextCreator.Create())
            {
                DateTime @from = day.Date;          //자정으로 임의의 날짜를 만듦. from은 키워드이기때문에 '@'가 들어간다.
                DateTime to    = from.AddDays(1);   //임의의 날짜 다음날(자정).

                var query = from x in context.Rents
                            //where x.RentDate >= @from && x.RentDate < to
                            select x;               //하루동안의 렌트 기록을 뽑는다.

                var list = query.ToList();          //리스트로 만들기.

                // RentedOn
                var query2 = from x in list
                             group x by x.RentDate.Hour into HourGroup //리스트를 모아 한 그룹을 g라고 한다.
                                                                       //select new ThePeriod { Hour = g.Key, Count = g.Count()};
                             select HourGroup;

                //return query2.ToList();

                List <PeriodSummary> periods = new List <PeriodSummary>();
                foreach (var g in query2)
                {
                    PeriodSummary period = new PeriodSummary();
                    period.Value = g.Key;                               //렌트기록중에 '시'만 뽑는다.
                    period.Count = g.Count();                           //ex) 2020.12.18. 14:58:12에 대여기록이 있다면 '14'

                    periods.Add(period);
                }

                return(periods);
            }
        }
Пример #2
0
        private void SavePeriodButton_Click(object sender, RoutedEventArgs e)
        {
            if (!ReportedDatePicker.SelectedDate.HasValue ||
                !Decimal.TryParse(xRateUSDToUAHTextBox.Text, out decimal xRateUSD) ||
                !Decimal.TryParse(xRateEURToUAHTextBox.Text, out decimal xRateEUR))
            {
                return;
            }

            PeriodSummary newPeriodSummary = new PeriodSummary(ReportedDatePicker.SelectedDate.Value, xRateUSD, xRateEUR);

            PeriodSummary result = _summaryService.AddPeriod(newPeriodSummary);

            Periods.Add(result);
            PeriodsListView.ItemsSource = Periods.OrderByDescending(p => p.ReportedDate);
        }
Пример #3
0
        private IEnumerable <PeriodSummary> CombineActualsAndOrganisations(IEnumerable <SummarisedActual> summarisedActuals, IEnumerable <Organisation> organisations)
        {
            var results = new List <PeriodSummary>(summarisedActuals?.Count() ?? 0);

            if (summarisedActuals == null)
            {
                return(results);
            }

            var orgLookup = organisations?.ToDictionary(o => o.OrganisationIdentifier, o => o.UKPRN) ?? new Dictionary <string, int>();

            foreach (var summarisedActual in summarisedActuals)
            {
                orgLookup.TryGetValue(summarisedActual.OrganisationId, out var ukprn);

                var ncdDed = new PeriodSummary
                {
                    Id = summarisedActual.ID,
                    CollectionReturnCode = summarisedActual.CollectionReturnCode,
                    UKPRN                    = ukprn,
                    OrganisationId           = summarisedActual.OrganisationId,
                    PeriodTypeCode           = summarisedActual.PeriodTypeCode,
                    Period                   = summarisedActual.Period,
                    FundingStreamPeriodCode  = summarisedActual.FundingStreamPeriodCode,
                    CollectionType           = summarisedActual.CollectionType,
                    ContractAllocationNumber = summarisedActual.ContractAllocationNumber,
                    UoPCode                  = summarisedActual.UoPCode,
                    DeliverableCode          = summarisedActual.DeliverableCode,
                    ActualVolume             = summarisedActual.ActualVolume,
                    ActualValue              = summarisedActual.ActualValue
                };

                results.Add(ncdDed);
            }

            return(results);
        }
Пример #4
0
        private void FillReport(bool isInitial = false, bool throwException = true)
        {
            string rep_params        = vals.Text;
            ReportGenericRequest req = new ReportGenericRequest();

            req.paramString = rep_params;

            ListResponse <Model.Reports.RT302> resp = _reportsService.ChildGetAll <Model.Reports.RT302>(req);

            //if (!resp.Success)
            //{
            //    throw new Exception(resp.Error + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + resp.LogId + "</br>");

            //}
            if (!resp.Success)
            {
                Common.ReportErrorMessage(resp, GetGlobalResourceObject("Errors", "Error_1").ToString(), GetGlobalResourceObject("Errors", "ErrorLogId").ToString());
            }
            string getLan = _systemService.SessionHelper.getLangauge();

            foreach (var item in resp.Items)

            {
                item.Absent        = item.absentDays;   // item.calendarDays - item.workingDays;
                item.totLateness   = item.NET_LATENESS; //item.LATE_CHECKIN + item.DURING_SHIFT_LEAVE + item.EARLY_LEAVE+item.SHIFT_LEAVE_WITHOUT_EXCUSE;
                item.totOvertime   = item.NET_OVERTIME; //item.OVERTIME + item.EARLY_CHECKIN;
                item.Total_Absent += item.Absent;
                //if (item.SHIFT_LEAVE_WITHOUT_EXCUSE >= 1)
                //{
                //    item.SHIFT_LEAVE_WITHOUT_EXCUSE = item.SHIFT_LEAVE_WITHOUT_EXCUSE * 60;
                //}

                //if (item.LATE_CHECKIN >= 1)
                //{
                //    item.LATE_CHECKIN = item.LATE_CHECKIN * 60;
                //}
            }

            Dictionary <string, string> parameters = Web.UI.Forms.Common.FetchReportParameters(texts.Text);
            PeriodSummary h = new PeriodSummary(parameters, getLan);

            h.RightToLeft       = _systemService.SessionHelper.CheckIfArabicSession() ? DevExpress.XtraReports.UI.RightToLeft.Yes : DevExpress.XtraReports.UI.RightToLeft.No;
            h.RightToLeftLayout = _systemService.SessionHelper.CheckIfArabicSession() ? DevExpress.XtraReports.UI.RightToLeftLayout.Yes : DevExpress.XtraReports.UI.RightToLeftLayout.No;
            h.DataSource        = resp.Items;

            //string from = DateTime.Parse(req.Parameters["_fromDate"]).ToString(_systemService.SessionHelper.GetDateformat(), new CultureInfo("en"));
            //string to = DateTime.Parse(req.Parameters["_toDate"]).ToString(_systemService.SessionHelper.GetDateformat(), new CultureInfo("en"));
            string user = _systemService.SessionHelper.GetCurrentUser();


            h.Parameters["User"].Value = user;



            //h.Parameters["Fitlers"].Value = texts.Text;

            h.CreateDocument();


            ASPxWebDocumentViewer1.DataBind();
            ASPxWebDocumentViewer1.OpenReport(h);
        }