コード例 #1
0
ファイル: UT_GPL.cs プロジェクト: iturribeitia/GPL
        public void Extensions_T013_AbsoluteStart_AbsoluteEnd()
        {
            /* Test with DateTime.MinValue */
            DateTime DateTimeForTest = DateTime.MinValue;

            DateTimeForTest = DateTimeForTest.AbsoluteStart();

            Assert.IsTrue(DateTimeForTest == DateTime.MinValue);

            DateTimeForTest = DateTime.MinValue;

            DateTimeForTest = DateTimeForTest.AbsoluteEnd();

            Assert.IsTrue(DateTimeForTest == "1/1/0001 23:59:59.9999999".Parse <DateTime>());



            /* Test with DateTime.MaxValue */
            DateTimeForTest = DateTime.MaxValue;

            DateTimeForTest = DateTimeForTest.AbsoluteStart();

            Assert.IsTrue(DateTimeForTest == DateTime.MaxValue.Date);

            DateTimeForTest = DateTime.MaxValue;

            DateTimeForTest = DateTimeForTest.AbsoluteEnd();

            Assert.IsTrue(DateTimeForTest == "12/31/9999 23:59:59.9999999".Parse <DateTime>());
        }
コード例 #2
0
        public JsonResult CustomizeReport(DateTime fromDate, DateTime toDate)
        {
            IResponseData <CustomizeReportItemResponse> response = new ResponseData <CustomizeReportItemResponse>();

            try
            {
                var filter = new FilterObject()
                {
                    FromDate = fromDate.AbsoluteStart(),
                    ToDate   = toDate.AbsoluteEnd()
                };

                var currentDrugStoreCode   = WebSessionManager.Instance.CurrentDrugStoreCode;
                var customizeReportService = IoC.Container.Resolve <ICustomizeReportService>();
                var data = customizeReportService.GetCustomizeReportItems(currentDrugStoreCode, filter);
                response.SetData(data);
            }
            catch (ValidationException ex)
            {
                response.SetErrors(ex.Errors);
                response.SetStatus(HttpStatusCode.PreconditionFailed);
            }

            return(Json(response));
        }
コード例 #3
0
ファイル: database.cs プロジェクト: vladasj/Kopinator
        public static double GetPayOfDay(DateTime date)
        {
            var startDate = date.AbsoluteStart();
            var endDate   = date.AbsoluteEnd();

            return(BudgetSum(startDate, endDate, RecordTypeEnum.Pay));
        }
コード例 #4
0
        public bool ExisteCupon(int tarjetaId, DateTime fechaCupon, int comercioId, int nroCupon)
        {
            var cupones = TransaccionRepository.GetAll().Where(x => x.Tarjeta.Id == tarjetaId &&
                                                               x.Comercio.Id == comercioId &&
                                                               x.NumeroCupon == nroCupon).ToList();

            return(cupones.Any(x => x.FechaCompra.AbsoluteStart() == fechaCupon.AbsoluteStart()));
        }
コード例 #5
0
ファイル: database.cs プロジェクト: vladasj/Kopinator
        public static double GetIndexOnDate(DateTime date)
        {
            date = date.AbsoluteStart();
            var indexRecord = IndexCollection.FindOne(t => t.Date == date);

            if (indexRecord != null)
            {
                return(indexRecord.Total);
            }

            indexRecord = IndexCollection.Find(t => t.Date < date).OrderByDescending(t => t.Date).FirstOrDefault();
            return(indexRecord?.Total ?? 0);
        }
コード例 #6
0
ファイル: database.cs プロジェクト: vladasj/Kopinator
 private static bool UpdateIndex(double ammount, DateTime date)
 {
     date = date.AbsoluteStart();
     do
     {
         var date1            = date;
         var currentDateIndex = IndexCollection.Find(t => t.Date == date1).First();
         currentDateIndex.Total += ammount;
         IndexCollection.Insert(currentDateIndex.Id, currentDateIndex);
         date = date.AddDays(1);
     } while (date < DateTime.Now);
     OnStateChanged();
     return(true);
 }
コード例 #7
0
        public static IList <DateTime> GetDaysDuringPeriod(DateTime startDateTime, DateTime endDateTime)
        {
            var result = new List <DateTime>();

            var periodStartTime = startDateTime.AbsoluteStart();
            var periodEndTime   = endDateTime.AbsoluteEnd();

            for (DateTime currentDate = periodStartTime; currentDate < periodEndTime; currentDate = currentDate.AddDays(1))
            {
                result.Add(currentDate);
            }

            return(result);
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: MohBrkat/GoogleDriveJob
        public static DateTime GetLastUsedDateFile()
        {
            Logger.Info($"Get Last Run Date from ReportsLastRunDate.txt file");

            var      reportInitialDate = _iconfiguration.GetSection("ReportsInitialDate").Value;
            DateTime from = Convert.ToDateTime(reportInitialDate);

            string fileName = $"ReportsLastRunDate.txt";
            string filePath = GetFilePath(fileName);

            if (System.IO.File.Exists(filePath))
            {
                string[] lines = System.IO.File.ReadAllLines(filePath);
                foreach (var line in lines)
                {
                    if (!string.IsNullOrWhiteSpace(line) && DateTime.TryParse(line, out DateTime value))
                    {
                        from = value;
                    }
                }
            }
            return(from.AbsoluteStart());
        }
コード例 #9
0
        public object GetHistory(string from, string to, bool isExport)
        {
            DateTime dtFrom = DateTime.Now, dtTo = DateTime.Now;
            bool     chkFrom = DateTime.TryParseExact(from, MP_FormatHelper.Format103, System.Globalization.CultureInfo.InvariantCulture,
                                                      System.Globalization.DateTimeStyles.None, out dtFrom);
            bool chkTo = DateTime.TryParseExact(to, MP_FormatHelper.Format103, System.Globalization.CultureInfo.InvariantCulture,
                                                System.Globalization.DateTimeStyles.None, out dtTo);

            if (!chkFrom || !chkTo)
            {
                return new { status = MP_AjaxError.DateFormat }
            }
            ;

            return(new { status = MP_AjaxError.OK, value = _loginHistoryServices.GetLoginHistory(dtFrom.AbsoluteStart(), dtTo.AbsoluteEnd(), isExport) });
        }
    }