public virtual void SaveConfig(FXmlNode config) { // Type config[PTY_TYPE] = _type.ToString(); config.Set(PTY_VALID, _valid); // Day config config.Set(PTY_DAY_INTERVAL, _dayInterval); // Week config config.Set(PTY_WEEK_INTERVAL, _weekInterval); config[PTY_WEEKDAYS] = ((int)_weekDays).ToString(); // Month config config[PTY_MONTH_TYPE] = ((int)_monthType).ToString(); config.Set(PTY_MONTH_INTERVAL, _monthInterval); config.Set(PTY_MONTH_DAY, _monthDay); config[PTY_MONTH_WEEK] = ((int)_monthWeek).ToString(); config.Set(PTY_MONTH_WEEK_DAY, _monthWeekDay); config[PTY_MONTHS] = ((int)_months).ToString(); // Once config config[PTY_ONCE_DATE] = RDate.Format(_onceDate, FMT_DATE); // Public config config[PTY_BEGIN_DATE] = RDate.Format(_beginDate, FMT_DATE); config.Set(PTY_END_VALID, _endValid); config[PTY_END_DATE] = RDate.Format(_endDate, FMT_DATE); config[PTY_TIME] = RDate.Format(_time, FMT_TIME); }
//============================================================ // <T>格式化。</T> // // @param buffer 字符串对象 // @param level 级别 //============================================================ public virtual void Format(FString format, ELoggerLevel level, object refer, string method, Exception exception, string message, object[] parameters) { // 追加时间 format += RDate.Format(_dateFormat) + ' '; // 追加级别 AppendLevel(format, level); // 追加线程编号 format += ':' + Thread.CurrentThread.ManagedThreadId.ToString("X2"); // 追加函数信息 if (refer is Type) { format += "-<static> ["; format += ((Type)refer).Name + '.' + method; } else { format += "-" + refer.GetHashCode().ToString("X8") + " ["; format += refer.GetType().Name + '.' + method; } format.AppendRepeat(' ', LOGGER_SPACE - format.Length); format += "] "; // 追加信息内容 if (null != parameters) { format += String.Format(message, parameters); } // 追加例外内容 if (null != exception) { format.AppendLine(); RException.MakeMessage(format, exception); } }
private void DetermineStartingRecurrence(RDate rdate, ref Date_Time dt) { foreach (Period p in rdate.Periods) { if (p.StartTime < dt) { dt = p.StartTime.Copy(); } } }
public void Load() { // Create AppDomain string domainName = RDate.Format("Domain-HH24MISS"); _domain = AppDomain.CreateDomain(domainName, _evidence, _setup); // Create Loader string assemblyName = typeof(FAppLoader).Assembly.FullName; string loaderName = typeof(FAppLoader).FullName; _loader = (FAppLoader)_domain.CreateInstanceAndUnwrap(assemblyName, loaderName); }
private void ShowDate(RDate rDate, bool shown) { var label = rDate == RDate.From ? NoMinLabel : NoMaxLabel; var dtp = rDate == RDate.From ? FromDateTimePicker : ToDateTimePicker; if (shown) { label.Hide(); dtp.Show(); } else { label.Location = dtp.Location; label.Size = dtp.Size; label.Show(); dtp.Hide(); } }
/// <summary> /// Adds a single exception for this recurring component /// </summary> /// <param name="recur">The date/time when this component will NOT recur.</param> public void AddSingleException(Date_Time dt) { RDate exdate = new RDate(); exdate.Name = "EXDATE"; exdate.Add(dt); exdate.Parent = this; if (ExDate != null) { RDate[] dates = new RDate[ExDate.Length + 1]; ExDate.CopyTo(dates, 0); dates[dates.Length - 1] = exdate; ExDate = dates; } else { ExDate = new RDate[] { exdate } }; }
/// <summary> /// Adds a single recurrence for this recurring component. /// </summary> /// <param name="dt">The date/time when this component will recur.</param> public void AddSingleRecurrence(Date_Time dt) { RDate rdate = new RDate(); rdate.Name = "RDATE"; rdate.Add(dt); rdate.Parent = this; if (RDate != null) { RDate[] dates = new RDate[RDate.Length + 1]; RDate.CopyTo(dates, 0); dates[dates.Length - 1] = rdate; RDate = dates; } else { RDate = new RDate[] { rdate } }; }
protected DateTime QueryNextRunTimeInner(DateTime date) { // Before first start datetime long ticks = _time.TimeOfDay.Ticks; DateTime startDate = _beginDate.AddTicks(ticks); if (date < startDate) { date = startDate.Date; } // Week days if (_monthType == EScheduleMonthType.Date) { // This month day DateTime firstDay; int monthDays = DateTime.DaysInMonth(date.Year, date.Month); if (_monthDay > monthDays) { firstDay = RDate.FirstDateForMonth(date.AddMonths(1)); } else { DateTime monthDate = new DateTime(date.Year, date.Month, Math.Min(_monthDay, monthDays)).AddTicks(ticks); firstDay = RDate.FirstDateForMonth((monthDate < date) ? date.AddMonths(1) : date); } // Next month day return(QueryNextMonthByDate(firstDay, ticks)); } else if (_monthType == EScheduleMonthType.Interval) { DateTime resultDate = QueryNextMonthByInterval(date, ticks); if (resultDate < date) { resultDate = QueryNextMonthByInterval(RDate.FirstDateForMonth(date).AddMonths(1), ticks); } return(resultDate); } return(DateTime.MaxValue); }
/// <summary> /// Combines RDate values /// </summary> /// <param name="rdateOld"></param> /// <param name="rdateNew"></param> /// <returns></returns> private RDate UnionRDates(RDate rdateOld, RDate rdateNew) { if (rdateNew != null) { if (rdateOld != null) { DateRange[] range = new DateRange[rdateOld.DtRange.Length + rdateNew.DtRange.Length]; Array.Copy(rdateOld.DtRange, range, rdateOld.DtRange.Length); Array.Copy(rdateNew.DtRange, 0, range, rdateOld.DtRange.Length, rdateNew.DtRange.Length); rdateNew.DtRange = range; } return (rdateNew); } return (rdateOld); }
/// <summary> /// Processes RDate Value=Period values /// </summary> /// <param name="entry"></param> /// <returns></returns> private RDate ProcessRDatePeriod(CalendarEntry entry) { string[] dates = entry.Value.Split(','); if (dates.Length > 0) { RDate rdate = new RDate(); rdate.DtRange = new DateRange[dates.Length]; for (int i = 0; i < dates.Length; i++) { string[] parts = dates[i].Split('/'); if (parts.Length != 2) { ReportError(entry, "RDATE PERIOD not formed correctly"); break; } rdate.DtRange[i] = new DateRange(); rdate.DtRange[i].StartTime = ProcessDateTime(entry, parts[0]); parts[1] = parts[1].TrimStart(' '); if (parts[1].StartsWith("P") == true) { TimeSpan duration = ProcessDuration(entry, parts[1]); rdate.DtRange[i].EndTime = rdate.DtRange[i].StartTime.Add(duration); } else { rdate.DtRange[i].EndTime = ProcessDateTime(entry, parts[1]); } } return (rdate); } return (null); }
/// <summary> /// Processes RDate Value=DateTime values /// </summary> /// <param name="tzId"></param> /// <param name="entry"></param> /// <param name="value"></param> /// <returns></returns> private RDate ProcessTzIdRDateTimeValues(string tzId, CalendarEntry entry, string value) { string[] dates = value.Split(','); if (dates.Length > 0) { RDate rdate = new RDate(); rdate.DtRange = new DateRange[dates.Length]; for (int i = 0; i < dates.Length; i++) rdate.DtRange[i].StartTime = ProcessTzIdDateTime(tzId, entry, dates[i]); return (rdate); } return (null); }
public string PrettyPrint() => RDate.ToLongDateString() + ": Location - " + City + ", " + (!string.IsNullOrEmpty(State) ? (State + ", " + Country) : (Country)) + "--- " + TemperatureCelsius + "C/" + TemperatureFarenheit + "F\n";
public virtual void LoadConfig(FXmlNode config) { // Type if (config.Contains(PTY_TYPE)) { _type = REnum.ToValue <EScheduleTaskType>(config[PTY_TYPE]); } // Valid if (config.Contains(PTY_VALID)) { _valid = config.GetBoolean(PTY_VALID); } // Day Interval if (config.Contains(PTY_DAY_INTERVAL)) { _dayInterval = RInt.Parse(config[PTY_DAY_INTERVAL]); } // Week Interval if (config.Contains(PTY_WEEK_INTERVAL)) { _weekInterval = RInt.Parse(config[PTY_WEEK_INTERVAL]); } // Month Interval if (config.Contains(PTY_MONTH_INTERVAL)) { _monthInterval = RInt.Parse(config[PTY_MONTH_INTERVAL]); } // WeekDays if (config.Contains(PTY_WEEKDAYS)) { string weekDays = config[PTY_WEEKDAYS]; if (!RString.IsEmpty(weekDays)) { _weekDays = (EScheduleWeekDay)RInt.Parse(weekDays); } } // Month type if (config.Contains(PTY_MONTH_TYPE)) { string monthType = config[PTY_MONTH_TYPE]; if (!RString.IsEmpty(monthType)) { _monthType = (EScheduleMonthType)RInt.Parse(monthType); } } // Month day if (config.Contains(PTY_MONTH_DAY)) { _monthDay = RInt.Parse(config[PTY_MONTH_DAY]); } // Month week if (config.Contains(PTY_MONTH_WEEK)) { string monthWeek = config[PTY_MONTH_WEEK]; if (!RString.IsEmpty(monthWeek)) { _monthWeek = (EScheduleMonthWeek)RInt.Parse(monthWeek); } } // Month week day if (config.Contains(PTY_MONTH_WEEK_DAY)) { _monthWeekDay = RInt.Parse(config[PTY_MONTH_WEEK_DAY]); } // Months if (config.Contains(PTY_MONTHS)) { string months = config[PTY_MONTHS]; if (!RString.IsEmpty(months)) { _months = (EScheduleMonth)RInt.Parse(months); } } // Once date if (config.Contains(PTY_ONCE_DATE)) { _onceDate = RDate.Parse(config[PTY_ONCE_DATE]); } // Begin date if (config.Contains(PTY_BEGIN_DATE)) { _beginDate = RDate.Parse(config[PTY_BEGIN_DATE]); } // End valid if (config.Contains(PTY_END_VALID)) { _endValid = config.GetBoolean(PTY_END_VALID); } // End date if (config.Contains(PTY_END_DATE)) { _endDate = RDate.Parse(config[PTY_END_DATE]); } // Time if (config.Contains(PTY_TIME)) { _time = RDate.Parse(config[PTY_TIME]); } }
protected void btn_Save_Click(object sender, EventArgs e) { Bank _objbnk = new Bank(); string strMinValue = "1/1/2099"; foreach (GridViewRow row in gvBankreco.Rows) { if (((CheckBox)row.FindControl("chkBxSelect")).Checked == true) { /////To check RDate should not more than 3 months string CDate, RDate; DateTime RecoDate; DateTime ChkDate; int flag1 = 0; RDate = ((TextBox)row.FindControl("txtrecodate")).Text; CDate = ((Label)row.FindControl("lbldDate")).Text; ChkDate = Convert.ToDateTime(CDate); if (RDate == "") { RecoDate = Convert.ToDateTime(strMinValue); flag1 = 1; } else { RDate = RDate.Split('/')[1] + "/" + RDate.Split('/')[0] + "/" + RDate.Split('/')[2]; RecoDate = Convert.ToDateTime(RDate); } if (flag1 == 0) { if (ChkDate > RecoDate) { MessageBox("Reconsile date should be greater than deposit date..."); } else { int compMonth = (RecoDate.Month + RecoDate.Year * 12) - (ChkDate.Month + ChkDate.Year * 12); double daysInEndMonth = (RecoDate - RecoDate.AddMonths(1)).Days; double months = compMonth + (ChkDate.Day - RecoDate.Day) / daysInEndMonth; if (months > 3) { MessageBox("Recosile date should be within 3 months from CheckDate"); } else { _objbnk.Recoid = Convert.ToInt32(((Label)row.FindControl("lbldetailid")).Text); _objbnk.IsReco = Convert.ToBoolean(((CheckBox)row.FindControl("chkBxSelect")).Checked); // string DDate = ((TextBox)row.FindControl("txtrecodate")).Text; //if (RDate == "") //{ // _objbnk.RecoDate = Convert.ToDateTime(strMinValue); // //_objbnk.BankDescription = "-1"; //} //else //{ // //DDate = DDate.Split('/')[1] + "/" + DDate.Split('/')[0] + "/" + DDate.Split('/')[2]; // _objbnk.RecoDate = Convert.ToDateTime(RDate); //} _objbnk.RecoDate = RecoDate; _objbnk.flag = ((Label)row.FindControl("lblflag")).Text.ToString().Trim(); _objbnk.Update_BankRaconcilation(); MessageBox("Record saved Successfully"); BindGrid(); } } } else { _objbnk.Recoid = Convert.ToInt32(((Label)row.FindControl("lbldetailid")).Text); _objbnk.IsReco = Convert.ToBoolean(((CheckBox)row.FindControl("chkBxSelect")).Checked); _objbnk.RecoDate = RecoDate; _objbnk.flag = ((Label)row.FindControl("lblflag")).Text.ToString().Trim(); _objbnk.Update_BankRaconcilation(); MessageBox("Record saved Successfully"); BindGrid(); } } } }
public RDateSerializer(RDate rdate) : base(rdate) { this.m_RDate = rdate; }
public void Process() { if (CheckCondition()) { _logger.Debug(this, "Process", "Process schedule - start (date=[{0}] text=[{1}])", RDate.Format(DateTime.Now, "yymmdd hh24miss"), _text); _events.Process(); _logger.Debug(this, "Process", "Process schedule - end"); } }
/// <summary> /// Processes RDate attributes and values /// </summary> /// <param name="entry"></param> /// <param name="rdateOld"></param> /// <returns></returns> private RDate ProcessRDate(CalendarEntry entry, RDate rdateOld) { RDate rdateNew = null; if (entry.Attributes.Count > 0) { foreach (AttributeData attr in entry.Attributes) { ParameterToken tkn = (ParameterToken)GetToken(_parameters, attr.Id); switch (tkn) { case ParameterToken.TzId: if (rdateNew != null) ReportError(entry, "Multiple RDATE parameter types"); rdateNew = ProcessTzIdRDateTimeValues(attr.Value, entry, entry.Value); break; case ParameterToken.Value: if (rdateNew != null) ReportError(entry, "Multiple RDATE parameter types"); switch ((ValueToken)GetToken(_values, attr.Value)) { case ValueToken.Date: rdateNew = ProcessRDateValues(entry); break; case ValueToken.DateTime: rdateNew = ProcessRDateTimeValues(entry, entry.Value); break; case ValueToken.Period: rdateNew = ProcessRDatePeriod(entry); break; default: ReportError(entry, "Unrecognized RDate attribute Value (" + attr.Id + "=" + attr.Value + ")"); break; } break; } } } if (rdateNew == null) rdateNew = ProcessRDateTimeValues(entry, entry.Value); return (UnionRDates(rdateOld, rdateNew)); }
protected void QueryNextJobs(DateTime date) { // Query next datetime DateTime result = DateTime.MaxValue; while (true) { result = DateTime.MaxValue; foreach (FSchedule schedule in _console.Schedules) { if (schedule.Valid) { DateTime next = schedule.QueryNextRunTime(_lastDateTime); result = (next < result) ? next : result; } } if (result == DateTime.MaxValue || result > date) { break; } if (result <= date) { UpdateJobs(result, _lastDateTime); _lastDateTime = result; } } if (!_scheduleJobs.IsEmpty()) { FScheduleThread thread = new FScheduleThread(_scheduleJobs.Flush()); thread.Process(); } // Set next timer TimeSpan intervalSpan = result - date; if (intervalSpan == TimeSpan.Zero) { throw new FFatalException("Invalid interval(zero)"); } if (intervalSpan > MAX_INTERVAL) { intervalSpan = MAX_INTERVAL; } else { UpdateJobs(result, _lastDateTime); } _lastDateTime = date; if (_logger.DebugAble) { _logger.Debug(this, "QueryNextJobs", "Last=[{0}] next=[{1}] count=[{2}] interval=[{3}]", RDate.Format(_lastDateTime, "yymmdd hh24miss"), RDate.Format(result, "yymmdd hh24miss"), _scheduleJobs.Count, intervalSpan.ToString()); } // Set next timer _timer.Interval = intervalSpan.TotalMilliseconds; if (!_isActive) { _timer.Start(); _isActive = true; } }
/// <summary> /// Processes RDate Value=Date values /// </summary> /// <param name="entry"></param> /// <returns></returns> private RDate ProcessRDateValues(CalendarEntry entry) { string[] dates = entry.Value.Split(','); if (dates.Length > 0) { RDate rdate = new RDate(); rdate.DtRange = new DateRange[dates.Length]; for (int i = 0; i < dates.Length; i++) rdate.DtRange[i].StartTime = ProcessDateValue(entry, dates[i]); return (rdate); } return (null); }