当前位置: 首页>>代码示例>>C#>>正文


C# DateRange类代码示例

本文整理汇总了C#中DateRange的典型用法代码示例。如果您正苦于以下问题:C# DateRange类的具体用法?C# DateRange怎么用?C# DateRange使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DateRange类属于命名空间,在下文中一共展示了DateRange类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DateFilter

        public DateFilter(Point point)
        {
            InitializeComponent();
            DateRange = new DateRange();
            this.Location = point;
            panelDtp.Visible = false;
            panelMonth.Visible = false;

            cbFromMonth.SelectedIndex = 0;
            cbToMonth.SelectedIndex = 0;

            for (int i = DateTime.Now.Year - 5; i < DateTime.Now.Year + 5; i++)
            {
                cbFromYear.Items.Add(i);
                cbToYear.Items.Add(i);
            }
            cbFromYear.SelectedIndex = 0;
            cbToYear.SelectedIndex = 0;
            cbDateFilterType.SelectedIndex = 0;
            cbFromYear.SelectedIndexChanged += new System.EventHandler(cbFromYear_SelectedIndexChanged);
            cbToYear.SelectedIndexChanged += new System.EventHandler(cbToYear_SelectedIndexChanged);

            this.cbToMonth.SelectedIndexChanged += new System.EventHandler(this.cbToMonth_SelectedIndexChanged);
            this.cbFromMonth.SelectedIndexChanged += new System.EventHandler(this.cbFromMonth_SelectedIndexChanged);
        }
开发者ID:henleygao,项目名称:PMMS,代码行数:25,代码来源:DateFilter.cs

示例2: GenerateUsageReport

        private object GenerateUsageReport(IUnitOfWork uow, DateRange dateRange, int start,
            int length, out int count)
        {
            _dataUrlMappings = new Dictionary<string, string>();
            _dataUrlMappings.Add("BookingRequest", "/Dashboard/Index/");
            _dataUrlMappings.Add("Email", "/Dashboard/Index/");
            _dataUrlMappings.Add("User", "/User/Details?userID=");


            var factDO = uow.FactRepository.GetQuery().WhereInDateRange(e => e.CreateDate, dateRange);

            count = factDO.Count();

            return factDO
                .OrderByDescending(e => e.CreateDate)
                .Skip(start)
                .Take(length)
                .AsEnumerable()
                .Select(
                    f => new
                        {
                            PrimaryCategory = f.PrimaryCategory,
                            SecondaryCategory = f.SecondaryCategory,
                            Activity = f.Activity,
                            Status = f.Status,
                            Data = AddClickability(f.Data),
                            CreateDate = f.CreateDate.ToString(DateStandardFormat),
                        })
                .ToList();

        }
开发者ID:alexed1,项目名称:dtrack,代码行数:31,代码来源:Report.cs

示例3: ItemCount

        public static double ItemCount(CalendarAppointmentItem currentApp, UIElementCollection children)
        {
            double count = 0;
            foreach (UIElement child in children)
            {
                if (child is CalendarAppointmentItem)
                {
                    var currentChild = child as CalendarAppointmentItem;

                    var cStart = currentApp.GetValue(TimeSlotPanel.StartTimeProperty) as DateTime?;
                    var cEnd = currentApp.GetValue(TimeSlotPanel.EndTimeProperty) as DateTime?;
                    var toTest = new DateRange(cStart.Value, cEnd.Value);

                    var aStart = currentChild.GetValue(TimeSlotPanel.StartTimeProperty) as DateTime?;
                    var aEnd = currentChild.GetValue(TimeSlotPanel.EndTimeProperty) as DateTime?;
                    var current = new DateRange(aStart.Value, aEnd.Value);

                    if (toTest.Overlaps(current))
                    {
                        count++;
                    }
                }
            }
            return count;
        }
开发者ID:seniorOtaka,项目名称:ndoctor,代码行数:25,代码来源:Overlapping.cs

示例4: MyViewModel

        public MyViewModel()
        {
            var date = DateTime.Now;
            var ganttAPI = new GanttTask(date, date.AddDays(2), "Design public API") { Description = "Description: Design public API" };

            var ganttRendering = new GanttTask(date.AddDays(2).AddHours(8), date.AddDays(4), "Gantt Rendering") { Description = "Description: Gantt Rendering" };

            var ganttDemos = new GanttTask(date.AddDays(4.5), date.AddDays(7), "Gantt Demos") { Description = "Description: Gantt Demos" };

            var milestone = new GanttTask(date.AddDays(7), date.AddDays(7).AddHours(1), "Review") { Description = "Review", IsMilestone = true };

            ganttRendering.Dependencies.Add(new Dependency { FromTask = ganttAPI });
            ganttDemos.Dependencies.Add(new Dependency { FromTask = ganttRendering });

            var iterationTask = new GanttTask(date, date.AddDays(7), "Iteration 1")
            {
                Children = { ganttAPI, ganttRendering, ganttDemos, milestone }
            };

            this.tasks = new ObservableCollection<GanttTask>() { iterationTask };
            this.visibleTime = new DateRange(date.AddDays(-1), date.AddDays(9));
            this.timeLineDeadlineBehavior = new TimeLineDeadlineBehavior();

            this.ProjectDeadline = date.AddDays(8);
        }
开发者ID:jigjosh,项目名称:xaml-sdk,代码行数:25,代码来源:MyViewModel.cs

示例5: StartDateHaveToBeEarlierThanEndDate_ArgumentException

        public void StartDateHaveToBeEarlierThanEndDate_ArgumentException()
        {
            DateTime startDate = DateTime.Now.AddMonths(months: 2);
            DateTime endDate = DateTime.Now.AddMonths(months: 1);

            DateRange range = new DateRange(startDate, endDate);
        }
开发者ID:Hobb,项目名称:projector,代码行数:7,代码来源:DateRangeTests.cs

示例6: ImportConsent

 public ImportConsent(Guid notificationId, DateRange consentRange, string conditions, Guid userId)
 {
     ConsentRange = consentRange;
     Conditions = conditions;
     UserId = userId;
     NotificationId = notificationId;
 }
开发者ID:EnvironmentAgency,项目名称:prsd-iws,代码行数:7,代码来源:ImportConsent.cs

示例7: GetRangeStart

 protected DateTime GetRangeStart(DateRange range)
 {
     switch (range) {
         case DateRange.Today:
             return DateTime.Now.Date;
         case DateRange.Last24Hours:
             return DateTime.Now.AddDays(-1);
         case DateRange.ThisWeek:
             //TODO #################
             int diff = DateTime.Now.DayOfWeek - DayOfWeek.Monday;
             if (diff < 0){
                 diff += 7;
             }
             return DateTime.Now.AddDays(-1 * diff).Date;
         case DateRange.Last7Days:
             return DateTime.Now.Date.AddDays(-7);
         case DateRange.ThisMonth:
             return new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
         case DateRange.Last30Days:
             return new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day).AddDays(-30);
         case DateRange.ThisYear:
             return new DateTime(DateTime.Now.Year, 1, 1);
         case DateRange.LastYear:
             return new DateTime(DateTime.Now.Year, 1, 1).AddYears(-1);
         case DateRange.All:
             return new DateTime(1790, 1, 1);
         case DateRange.LastMonth:
             return new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(-1);
         default:
             break;
     }
     return DateTime.Now;
 }
开发者ID:kyvkri,项目名称:mgone,代码行数:33,代码来源:OrderMetrics.ascx.cs

示例8: Generate

 public object Generate(IUnitOfWork uow, DateRange dateRange, string type, int start,
     int length, out int recordcount)
 {
     recordcount = 0;
     switch (type)
     {
         case "alllogs":
             return ShowAllLogs(uow, dateRange, start,
      length, out recordcount);
         case "usage":
             return GenerateUsageReport(uow, dateRange, start,
      length, out recordcount);
         case "incident":
             return ShowAllIncidents(uow, dateRange, start,
     length, out recordcount);
         case "fiveRecentIncident":
             return ShowMostRecent5Incidents(uow, out recordcount);
         case "showBookerThroughput":
             return ShowBookerThroughput(uow, dateRange, start,
      length, out recordcount);
         case "showBRResponsiveness":
             return ShowBRResponsiveness(uow, dateRange, start,
      length, out recordcount);
     }
     return this;
 }
开发者ID:alexed1,项目名称:dtrack,代码行数:26,代码来源:Report.cs

示例9: Constructor_NullEffectiveDate_Succeeds

        public void Constructor_NullEffectiveDate_Succeeds()
        {
            DateTime? effectiveDate = null;
            DateTime expirationDate = new DateTime ( 2000, 1, 1 );

            DateRange dateRange = new DateRange ( effectiveDate, expirationDate );
        }
开发者ID:divyang4481,项目名称:REM,代码行数:7,代码来源:DateRangeTests.cs

示例10: GetRangeEnd

 protected DateTime GetRangeEnd(DateRange range)
 {
     switch (range) {
         case DateRange.Today:
             return DateTime.Now;
         case DateRange.Last24Hours:
             return DateTime.Now;
         case DateRange.ThisWeek:
             return DateTime.Now;
         case DateRange.Last7Days:
             return DateTime.Now;
         case DateRange.ThisMonth:
             return DateTime.Now;
         case DateRange.Last30Days:
             return DateTime.Now;
         case DateRange.ThisYear:
             return DateTime.Now;
         case DateRange.LastYear:
             return new DateTime(DateTime.Now.Year, 1, 1);
         case DateRange.All:
             return new DateTime(2030, 1, 1);
         case DateRange.LastMonth:
             return new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMinutes(-1);
         default:
             break;
     }
     return DateTime.Now;
 }
开发者ID:kyvkri,项目名称:mgone,代码行数:28,代码来源:OrderMetrics.ascx.cs

示例11: Constructor_LaterThanExpiration_ThrowsException

        public void Constructor_LaterThanExpiration_ThrowsException()
        {
            DateTime effectiveDate = new DateTime ( 2000, 1, 2 );
            DateTime expirationDate = new DateTime ( 2000, 1, 1 );

            DateRange dateRange = new DateRange ( effectiveDate, expirationDate );
        }
开发者ID:divyang4481,项目名称:REM,代码行数:7,代码来源:DateRangeTests.cs

示例12: EqualityTest

        public void EqualityTest()
        {
            DateRange sd = new DateRange(d1, d1);
            DateRange sd2 = new DateRange(d1, d1);
            Assert.AreEqual(sd, sd2);

            sd = new DateRange(d1, d2);
            sd2 = new DateRange(d1, d1);
            Assert.AreNotEqual(sd, sd2);

            sd = new DateRange(null, d1);
            sd2 = new DateRange(null, d1);
            Assert.AreEqual(sd, sd2);

            sd = new DateRange(d1, null);
            sd2 = new DateRange(d1, null);
            Assert.AreEqual(sd, sd2);

            sd = new DateRange(null, d1);
            sd2 = new DateRange(d1, null);
            Assert.AreNotEqual(sd, sd2);

            sd = new DateRange(null, null);
            sd2 = new DateRange(d1, null);
            Assert.AreNotEqual(sd, sd2);
        }
开发者ID:kailuowang,项目名称:MindLib,代码行数:26,代码来源:DateRangeFixture.cs

示例13: Map

        public void Map()
        {
            // Arrange
            var start = new DateTime(2010, 1, 1);
            var end = DateUtility.MaxDate;
            var range = new DateRange(start, end);

            var id = new MDM.Contracts.NexusId { SystemName = "Test", Identifier = "A" };
            var contractDetails = new MDM.Contracts.CurveDetails();
            var contract = new MDM.Contracts.Curve
            {
                Identifiers = new MDM.Contracts.NexusIdList { id },
                Details = contractDetails,
                Nexus = new MDM.Contracts.SystemData { StartDate = start, EndDate = end }
            };

            // NB Don't assign validity here, want to prove SUT sets it
            var details = new Curve();

            var mapping = new CurveMapping();

            var mappingEngine = new Mock<IMappingEngine>();
            mappingEngine.Setup(x => x.Map<MDM.Contracts.NexusId, CurveMapping>(id)).Returns(mapping);
            mappingEngine.Setup(x => x.Map<MDM.Contracts.CurveDetails, Curve>(contractDetails)).Returns(details);

            var mapper = new CurveMapper(mappingEngine.Object);

            // Act
            var candidate = mapper.Map(contract);

            // Assert
            //Assert.AreEqual(1, candidate.Details.Count, "Detail count differs");
            Assert.AreEqual(1, candidate.Mappings.Count, "Mapping count differs");
            Check(range, details.Validity, "Validity differs");
        }
开发者ID:RaoulHolzer,项目名称:EnergyTrading-MDM-Sample,代码行数:35,代码来源:CurveMapperFixture.cs

示例14: Constructor_ValidDateRange_Succeeds

        public void Constructor_ValidDateRange_Succeeds()
        {
            DateTime effectiveDate = new DateTime ( 2000, 1, 1 );
            DateTime expirationDate = new DateTime ( 2000, 2, 1 );

            DateRange dateRange = new DateRange ( effectiveDate, expirationDate );
        }
开发者ID:divyang4481,项目名称:REM,代码行数:7,代码来源:DateRangeTests.cs

示例15: Education

 /**
  * @param validSince `validSince` is a <code>DateTime</code> object, it's the first time Pipl's
  *                   crawlers found this data on the page.
  * @param degree     degree
  * @param school     school
  * @param dateRange  `dateRange` is A <code>DateRange</code> object (Pipl.APIs.Data.Fields.DateRange),
  *                   that's the time the person was studying.
  */
 public Education(string degree = null, string school = null, DateRange dateRange = null, DateTime? validSince = null)
     : base(validSince)
 {
     this.Degree = degree;
     this.School = school;
     this.DateRange = dateRange;
 }
开发者ID:piplcom,项目名称:piplapis-csharp,代码行数:15,代码来源:Education.cs


注:本文中的DateRange类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。