public void getUTCStringTest() { Debug.Assert( string.Compare( DateCalc.getUTCString("2019/02/01 08:59:59", new System.Globalization.CultureInfo("ja-JP")), "2019-01-31 23:59:59") == 0); }
public CollectionEvents(int daysView, int daysOccurred) { this._daysView = daysView; this._daysOccurred = daysOccurred; this._proccessinMinYears = DateCalc.getProcessingYear(daysOccurred); this._proccessinMaxYears = DateCalc.getProcessingYear(daysView); _eventsAndTasks = new List <IEvent>(); }
private void timerDateControl_Tick(object sender, EventArgs e) // Контроль наступления нового дня { if (DateCalc.currDate() != currentDate) { currentDate = DateCalc.currDate(); tabPageView_Enter(sender, e); } }
public Task(string date, string description, bool completed, ICollectionEvents collectionEvents) : base(date, description) { this.setCompleted(completed); if (DateCalc.checkDate(date) == true) { collectionEvents.addEventOrTask(this); } }
public FormMain() { InitializeComponent(); settings = new Settings(Const.DATA_SETTING_FILE_NAME, numericUpDownDayAfter, numericUpDownOccurred, richTextBoxData); currentDate = DateCalc.currDate(); this.richTextBoxView.ContextMenuStrip = new RichTextBoxContextMenu(this.richTextBoxView, true); this.richTextBoxData.ContextMenuStrip = new RichTextBoxContextMenu(this.richTextBoxData, false); }
/*********************************************************************************************** * 弃用 ,统一使用 Course 表 ************************************************************************************************/ // GET: PublicPublicCourse public ActionResult Index(int publicCourseTypeID, string openID, int page = 1, int pageSize = 7) { ResponseMessage msg = new ResponseMessage(); List <PublicCourseBusiness> cbList = new List <PublicCourseBusiness>(); string startTime; string endTime; DateTime st; DateTime et; Children cModel = new Children(); var ct = DateCalc.GetWeekFirstDayMon(DateTime.Now); st = ct.AddDays((page - 1) * pageSize); et = ct.AddDays(page * pageSize); startTime = st.ToString(FormatDateTime.ShortDateTimeStr); endTime = et.ToString(FormatDateTime.ShortDateTimeStr); List <PublicCourse> cList = new List <PublicCourse>(); using (ClassScheduleDBEntities db = new ClassScheduleDBEntities()) { msg.Status = true; try { cList = db.PublicCourse.Where(p => p.PublicCourseTypeID == publicCourseTypeID && string.Compare(p.StartTime, startTime, StringComparison.Ordinal) >= 0 && string.Compare(p.EndTime, endTime, StringComparison.Ordinal) <= 0) .ToList(); //默认使用第一个孩子的背景色 cModel = db.Children.FirstOrDefault(p => p.OpenID == openID); //防止没有孩子的情况出现。 if (cModel == null) { cModel = new Children(); } } catch (Exception e) { msg.Status = false; } } for (int i = 0; i < pageSize; i++) { PublicCourseBusiness model = new PublicCourseBusiness(); model.DayOfWeek = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(st.AddDays(i).DayOfWeek); model.StartTime = st.AddDays(i).ToString(FormatDateTime.ShortDateTimeStr); model.BackgroundColor = cList.Any(p => p.StartTime.Contains(model.StartTime)) ? cModel.Background : ""; model.IsToday = model.StartTime == DateTime.Now.ToString(FormatDateTime.ShortDateTimeStr) ? true : false; cbList.Add(model); } msg.Data = cbList; return(Json(msg, JsonRequestBehavior.AllowGet)); }
public MainPageViewModel() { DataTransferManager dataTransferManager = DataTransferManager.GetForCurrentView(); dataTransferManager.DataRequested += DataTransferManager_DataRequested; DateCalcObject = new DateCalc(); ViewModelLoaded?.Invoke(this, EventArgs.Empty); myClickHandler = new ClickHandler(FeedbackButton_Click); shareButtonHandler = new ClickHandler(ShareButton_Click); copyButtonHandler = new ClickHandler(CopyButton_Click); }
public HolidayEvent(string date, string description, ICollectionEvents collectionEvents) : base(date, description) { this.dateHolidayEvent = date; this.setTypeEvents(Const.TYPE_EVENTS.Holiday); for (int dYear = -collectionEvents.getProccessinMinYears(); dYear <= collectionEvents.getProccessinMaxYears(); dYear++) { var _dt = DateCalc.assemblyDate(date, dYear); if (DateCalc.checkDate(_dt) == true) { this.setDate(_dt); collectionEvents.addEventOrTask((Event)this.MemberwiseClone()); } } }
public override string ToString() { string remainingDaysText = ""; int? remainingDays = this.getRemainingDays(); if (remainingDays < 0) { remainingDaysText = "(" + (Math.Abs((decimal)remainingDays).ToString()) + " дн. назад)"; } if (remainingDays > 0) { remainingDaysText = "(через " + remainingDays + " дн.)"; } return(string.Format("{0} {1} {2}", DateCalc.DateToExtDate(this.getDate()), this.getDescription(), remainingDaysText)); }
public AnnualEvent(int day, int month, string description, ICollectionEvents collectionEvents) : base(description) { this.dayAnnualEvent = day; this.monthAnnualEvent = month; this.setTypeEvents(Const.TYPE_EVENTS.Annual); for (int dYear = -collectionEvents.getProccessinMinYears(); dYear <= collectionEvents.getProccessinMaxYears(); dYear++) { var _dt = DateCalc.assemblyDate(day, month, dYear); if (DateCalc.checkDate(_dt) == true) { this.setDate(_dt); collectionEvents.addEventOrTask((Event)this.MemberwiseClone()); } } }
public MonthlyEvent(int day, string description, ICollectionEvents collectionEvents) : base(description) { this.dayMonthlyEvent = day; this.setTypeEvents(Const.TYPE_EVENTS.Monthly); for (int dYear = -collectionEvents.getProccessinMinYears(); dYear <= collectionEvents.getProccessinMaxYears(); dYear++) { for (int month = DateCalc.START_MONTH; month <= DateCalc.END_MONTH; month++) { var _dt = DateCalc.assemblyDate(day, month, dYear); if (DateCalc.checkDate(_dt) == true) { this.setDate(_dt); collectionEvents.addEventOrTask((Event)this.MemberwiseClone()); } } } }
public override string ToString() { int?dYear = (DateCalc.diffDatesYears(getDateHolidayEvent(), DateCalc.currDate())) + (DateCalc.getYear(getDate()) - DateCalc.curYear()); if ((dYear > 0)) { return(string.Format("{0} [{1}-я годовщина]", base.ToString(), dYear)); } if (dYear < 0) { return(string.Format("{0} [еще не настало]", base.ToString())); } if (dYear == 0) { return(string.Format("{0} [рождение]", base.ToString())); } return(base.ToString()); }
public int?getRemainingDays() { return(DateCalc.diffDatesDay(DateCalc.currDate(), _date)); }
public void StringToDateTest() { DateTime result = DateCalc.StringToDate("2019/02/01", new System.Globalization.CultureInfo("ja-JP")); Debug.Assert(DateTime.Compare(result, new DateTime(2019, 2, 1, 0, 0, 0)) == 0); }
private void setReadOnly(User user) { bool keepChecking = true; string currentStatus = this.Status.StatusCode; //check if it's been closed for more than 30 days if (currentStatus == StatusType.CLOSED || currentStatus == StatusType.CLOSED_ACTION_COMPLETED) { int daysOld = DateCalc.DaysBetween(this.ResolvedAt.Value, DateTime.Now); if (daysOld >= 30) { keepChecking = false; IsReadOnly = true; } } //check if user has read only permissions if (keepChecking) { IsReadOnly = ((UserUtil.UserHasPermission(user, CorrectiveActionPermissionEnum.VIEW_ALL_CORRECTIVE_ACTIONS)) || (UserUtil.UserHasPermission(user, CorrectiveActionPermissionEnum.VIEW_ALL_ARCHIVED_CORRECTIVE_ACTIONS))); keepChecking = !IsReadOnly; } //check for users with editing permissions if (keepChecking) { bool isSCReviewer = UserUtil.UserHasRole(user, ApplicationRoleType.SC_REVIEWER); bool isSCSpecialist = UserUtil.UserHasRole(user, ApplicationRoleType.SC_SPECIALIST); bool isBRCReviewer = UserUtil.UserHasRole(user, ApplicationRoleType.PPRB_REVIEWER); bool isBRCSpecialist = UserUtil.UserHasRole(user, ApplicationRoleType.PPRB_SPECIALIST); bool isPPRMReviewer = UserUtil.UserHasRole(user, ApplicationRoleType.PPRM_REVIEWER); bool isPPRMSpecialist = UserUtil.UserHasRole(user, ApplicationRoleType.PPRM_SPECIALIST); if (isBRCSpecialist || isSCSpecialist || isPPRMSpecialist) { if ((this.AssignedToUserId == user.UserId) || (this.CreatedByUserId == user.UserId)) { IsReadOnly = false; //It's assigned to them } else { IsReadOnly = true; } } else if (isBRCReviewer || isSCReviewer || isPPRMReviewer) { if ((this.AssignedToOrgId == user.OrgId.Value) || (this.CreatedAtOrgId == user.OrgId.Value)) { IsReadOnly = false; //It's assigned to their org } else { IsReadOnly = true; } } else { IsReadOnly = true; } } }
public void DateToStringTest() { string result = DateCalc.DateToString(new DateTime(2019, 1, 31, 15, 0, 0), new System.Globalization.CultureInfo("ja-JP")); Debug.Assert(string.Compare(result, "2019/01/31") == 0); }
public void SQLiteStringToDateTimeTest() { DateTime result = DateCalc.SQLiteStringToDateTime("2019-02-01 12:34:56"); Debug.Assert(DateTime.Compare(result, new DateTime(2019, 2, 1, 12, 34, 56)) == 0); }