public override int GetHashCode() { int prime = 31; int result = 1; result = prime * result + Id.BitShiftThenBitOr(prime); result = prime * result + Name.StringToInt().BitShiftThenBitOr(prime); result = prime * result + Gender.GenderToInt().BitShiftThenBitOr(prime); result = prime * result + BirthDate.DateToInt().BitShiftThenBitOr(prime); result = prime * result + Email.StringToInt().BitShiftThenBitOr(prime); result = prime * result + Phone.StringToInt().BitShiftThenBitOr(prime); result = prime * result + ZipCode.BitShiftThenBitOr(prime); result = prime * result + Address.StringToInt().BitShiftThenBitOr(prime); result = prime * result + UserName.StringToInt().BitShiftThenBitOr(prime); result = prime * result + Password.StringToInt().BitShiftThenBitOr(prime); result = prime * result + Pin.BitShiftThenBitOr(prime); result = prime * result + LoginIP.StringToInt().BitShiftThenBitOr(prime); result = prime * result + MacAddress.StringToInt().BitShiftThenBitOr(prime); result = prime * result + StartingDate.DateToInt().BitShiftThenBitOr(prime); result = prime * result + Access.AccessToInt().BitShiftThenBitOr(prime); result = prime * result + AccountPriority.AccountPriorityToInt().BitShiftThenBitOr(prime); result = prime * result + MembershipType.MembershipToInt().BitShiftThenBitOr(prime); result = prime * result + Email.StringToInt().BitShiftThenBitOr(prime); result = prime * result + BirthDate.ToString().StringToInt().BitShiftThenBitOr(prime); result = prime * result + LastLogin.DateToInt().BitShiftThenBitOr(prime); result = prime * result + LastLogout.DateToInt().BitShiftThenBitOr(prime); result = prime * result + Age.BitShiftThenBitOr(prime); return(result); }
protected override void Execute(CodeActivityContext executionContext) { ITracingService tracer = executionContext.GetExtension <ITracingService>(); try { DateTime startingDate = StartingDate.Get(executionContext); DateTime endingDate = EndingDate.Get(executionContext); startingDate = new DateTime(startingDate.Year, startingDate.Month, startingDate.Day, startingDate.Hour, startingDate.Minute, 0, startingDate.Kind); endingDate = new DateTime(endingDate.Year, endingDate.Month, endingDate.Day, endingDate.Hour, endingDate.Minute, 0, endingDate.Kind); TimeSpan difference = startingDate - endingDate; int minutesDifference = Math.Abs(Convert.ToInt32(difference.TotalMinutes)); MinutesDifference.Set(executionContext, minutesDifference); } catch (Exception ex) { tracer.Trace("Exception: {0}", ex.ToString()); } }
protected override void ExecuteCrmWorkFlowActivity(CodeActivityContext context, LocalWorkflowContext localContext) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (localContext == null) { throw new ArgumentNullException(nameof(localContext)); } DateTime startingDate = StartingDate.Get(context); DateTime endingDate = EndingDate.Get(context); startingDate = new DateTime(startingDate.Year, startingDate.Month, startingDate.Day, startingDate.Hour, startingDate.Minute, startingDate.Second, startingDate.Kind); endingDate = new DateTime(endingDate.Year, endingDate.Month, endingDate.Day, endingDate.Hour, endingDate.Minute, endingDate.Second, endingDate.Kind); TimeSpan difference = startingDate - endingDate; int secondsDifference = Math.Abs(Convert.ToInt32(difference.TotalSeconds)); SecondsDifference.Set(context, secondsDifference); }
/// <summary> /// Class constructor. /// </summary> /// <param name="dateTimeProvider">Date and time provider.</param> /// <param name="termConfiguration">Term configuration.</param> public Term(IDateTimeProvider dateTimeProvider, IOptions <TermConfiguration> termConfiguration) { _dateTimeProvider = dateTimeProvider; _termConfiguration = termConfiguration.Value; StartingDate = _termConfiguration.StartingDateTime.Date; EndingDate = StartingDate.AddYears(_termConfiguration.DurationInYears).Date; }
protected override void ExecuteCrmWorkFlowActivity(CodeActivityContext context, LocalWorkflowContext localContext) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (localContext == null) { throw new ArgumentNullException(nameof(localContext)); } DateTime startingDate = StartingDate.Get(context); DateTime endingDate = EndingDate.Get(context); bool showSeconds = ShowSeconds.Get(context); TimeSpan diff = startingDate - endingDate; StringBuilder sb = new StringBuilder(); sb.Append($"{diff.Days}d."); sb.Append($"{diff.Hours:00}h:"); sb.Append($"{diff.Minutes:00}m"); if (showSeconds) { sb.Append($":{diff.Seconds:00}s"); } Difference.Set(context, sb.ToString()); }
public Course(string name, int lecturesPerWeek, DateTime startingDate) { this.Name = name; this.LecturesPerWeek = lecturesPerWeek; this.StartingDate = startingDate; this.EndingDate = StartingDate.AddDays(30); this.OnsiteStudents = new List <IStudent>(); this.OnlineStudents = new List <IStudent>(); this.Lectures = new List <ILecture>(); }
public Dictionary <string, string> Fetch() { Dictionary <string, string> res = new Dictionary <string, string> { { "date_debut", StartingDate.ToString("yyyy-MM-dd") }, { "date_fin", EndingDate.ToString("yyyy-MM-dd") }, { "salaries_id", Employee.Id.ToString() }, { "accepte", Convert.ToInt16(Accepted).ToString() } }; return(res); }
protected override void Execute(CodeActivityContext executionContext) { ITracingService tracer = executionContext.GetExtension <ITracingService>(); try { DateTime startingDate = StartingDate.Get(executionContext); DateTime dateToValidate = DateToValidate.Get(executionContext); DateTime endingDate = EndingDate.Get(executionContext); var between = dateToValidate > startingDate && dateToValidate < endingDate; Between.Set(executionContext, between); } catch (Exception ex) { tracer.Trace("Exception: {0}", ex.ToString()); } }
protected override void ExecuteCrmWorkFlowActivity(CodeActivityContext context, LocalWorkflowContext localContext) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (localContext == null) { throw new ArgumentNullException(nameof(localContext)); } DateTime startingDate = StartingDate.Get(context); DateTime dateToValidate = DateToValidate.Get(context); DateTime endingDate = EndingDate.Get(context); var between = dateToValidate > startingDate && dateToValidate < endingDate; Between.Set(context, between); }
protected override void Execute(CodeActivityContext executionContext) { ITracingService tracer = executionContext.GetExtension <ITracingService>(); try { DateTime startingDate = StartingDate.Get(executionContext); DateTime endingDate = EndingDate.Get(executionContext); TimeSpan difference = startingDate - endingDate; int hoursDifference = Math.Abs(Convert.ToInt32(difference.TotalHours)); HoursDifference.Set(executionContext, hoursDifference); } catch (Exception ex) { tracer.Trace("Exception: {0}", ex.ToString()); } }
protected override void ExecuteCrmWorkFlowActivity(CodeActivityContext context, LocalWorkflowContext localContext) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (localContext == null) { throw new ArgumentNullException(nameof(localContext)); } DateTime startingDate = StartingDate.Get(context); DateTime endingDate = EndingDate.Get(context); TimeSpan difference = startingDate - endingDate; int hoursDifference = Math.Abs(Convert.ToInt32(difference.TotalHours)); HoursDifference.Set(context, hoursDifference); }
public void Edit() { var updatedOpening = new DataLayer.EfClasses.Opening { OpeningNumber = OpeningToEdit.OpeningNumber, CompanyId = SelectedCompany.CompanyId, QualificationId = SelectedQualification.QualificationId, StartingDate = StartingDate, AnticipatedEndDate = EndDate, HourlyPay = Rate }; OpeningToEdit.CompanyName = SelectedCompany.CompanyName; OpeningToEdit.Qualification = SelectedQualification.QualificationCode; OpeningToEdit.StartingDate = StartingDate.ToShortDateString(); OpeningToEdit.StartingDate = EndDate.ToShortDateString(); OpeningToEdit.HourlyPay = Rate; _openingService.UpdateOpening(updatedOpening); }
public PriceList() { StartingDate = DateTime.Now; ExpirationDate = StartingDate.AddDays(356); }
private DateTime CalculateEndingDate() { return(StartingDate.AddDays(30)); }
protected override void ExecuteCrmWorkFlowActivity(CodeActivityContext context, LocalWorkflowContext localContext) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (localContext == null) { throw new ArgumentNullException(nameof(localContext)); } var startDate = StartingDate.Get(context); startDate = new DateTime(startDate.Year, startDate.Month, startDate.Day, startDate.Hour, startDate.Minute, 0); var endDate = EndingDate.Get(context); endDate = new DateTime(endDate.Year, endDate.Month, endDate.Day, endDate.Hour, endDate.Minute, 0); if (startDate == endDate) { MinutesDifference.Set(context, 0); return; } Entity calendar = null; EntityReference holidayClosureCalendar = HolidayClosureCalendar.Get(context); if (holidayClosureCalendar != null) { calendar = localContext.OrganizationService.Retrieve("calendar", holidayClosureCalendar.Id, new ColumnSet(true)); } var businessMinutes = 0; if (endDate > startDate) { while (startDate < endDate) { if (startDate.IsBusinessMinute(calendar)) { businessMinutes++; } startDate = startDate.AddMinutes(1); } } else { while (startDate > endDate) { if (startDate.IsBusinessMinute(calendar)) { businessMinutes--; } startDate = startDate.AddMinutes(-1); } } MinutesDifference.Set(context, businessMinutes); }
public override string ToString() { return(Name + "earns $" + Salary + "and started on " + StartingDate.ToShortDateString()); }
public override string ToString() { return($"{StartingDate.ToShortDateString()} {Technology.Name}"); }
protected override void Execute(CodeActivityContext executionContext) { ITracingService tracer = executionContext.GetExtension <ITracingService>(); try { DateTime startingDate = StartingDate.Get(executionContext); DateTime endingDate = EndingDate.Get(executionContext); DateTime fromDate; DateTime toDate; int increment = 0; int[] monthDay = { 31, -1, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; int month; int day; if (startingDate > endingDate) { fromDate = endingDate; toDate = startingDate; } else { fromDate = startingDate; toDate = endingDate; } if (fromDate.Day > toDate.Day) { increment = monthDay[fromDate.Month - 1]; } if (increment == -1) { increment = DateTime.IsLeapYear(fromDate.Year) ? 29 : 28; } if (increment != 0) { day = (toDate.Day + increment) - fromDate.Day; increment = 1; } else { day = toDate.Day - fromDate.Day; } if ((fromDate.Month + increment) > toDate.Month) { month = (toDate.Month + 12) - (fromDate.Month + increment); increment = 1; } else { month = (toDate.Month) - (fromDate.Month + increment); increment = 0; } int year = toDate.Year - (fromDate.Year + increment); int monthsDifference = month + (year * 12); MonthsDifference.Set(executionContext, monthsDifference); } catch (Exception ex) { tracer.Trace("Exception: {0}", ex.ToString()); } }
// returns string representation of VIP reservation object public override string ToString() { return(base.ToString() + " Since " + StartingDate.ToShortDateString()); } // end method ToString
protected override void Execute(CodeActivityContext executionContext) { ITracingService tracer = executionContext.GetExtension <ITracingService>(); try { DateTime startingDate = StartingDate.Get(executionContext); DateTime endingDate = EndingDate.Get(executionContext); string relativeTimeString; if (endingDate < startingDate) { relativeTimeString = "in the future"; RelativeTimeString.Set(executionContext, relativeTimeString); return; } const int second = 1; const int minute = 60 * second; const int hour = 60 * minute; const int day = 24 * hour; const int month = 30 * day; var ts = new TimeSpan(endingDate.Ticks - startingDate.Ticks); double delta = Math.Abs(ts.TotalSeconds); if (delta < 1 * minute) { relativeTimeString = ts.Seconds == 1 ? "one second ago" : ts.Seconds + " seconds ago"; RelativeTimeString.Set(executionContext, relativeTimeString); return; } if (delta < 2 * minute) { relativeTimeString = "a minute ago"; RelativeTimeString.Set(executionContext, relativeTimeString); return; } if (delta < 45 * minute) { relativeTimeString = ts.Minutes + " minutes ago"; RelativeTimeString.Set(executionContext, relativeTimeString); return; } if (delta < 90 * minute) { relativeTimeString = "an hour ago"; RelativeTimeString.Set(executionContext, relativeTimeString); return; } if (delta < 24 * hour) { relativeTimeString = ts.Hours + " hours ago"; RelativeTimeString.Set(executionContext, relativeTimeString); return; } if (delta < 48 * hour) { relativeTimeString = "yesterday"; RelativeTimeString.Set(executionContext, relativeTimeString); return; } if (delta < 30 * day) { relativeTimeString = ts.Days + " days ago"; RelativeTimeString.Set(executionContext, relativeTimeString); return; } if (delta < 12 * month) { int months = Convert.ToInt32(Math.Floor((double)ts.Days / 30)); relativeTimeString = months <= 1 ? "one month ago" : months + " months ago"; RelativeTimeString.Set(executionContext, relativeTimeString); return; } int years = Convert.ToInt32(Math.Floor((double)ts.Days / 365)); relativeTimeString = years <= 1 ? "one year ago" : years + " years ago"; RelativeTimeString.Set(executionContext, relativeTimeString); } catch (Exception ex) { tracer.Trace("Exception: {0}", ex.ToString()); } }
public Catalog() { StartingDate = DateTime.Now; ExpirationDate = StartingDate.AddDays(356); }
protected override void ExecuteCrmWorkFlowActivity(CodeActivityContext context, LocalWorkflowContext localContext) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (localContext == null) { throw new ArgumentNullException(nameof(localContext)); } DateTime startingDate = StartingDate.Get(context); DateTime endingDate = EndingDate.Get(context); string relativeTimeString; if (endingDate < startingDate) { relativeTimeString = "in the future"; RelativeTimeString.Set(context, relativeTimeString); return; } const int second = 1; const int minute = 60 * second; const int hour = 60 * minute; const int day = 24 * hour; const int month = 30 * day; var ts = new TimeSpan(endingDate.Ticks - startingDate.Ticks); double delta = Math.Abs(ts.TotalSeconds); if (delta < 1 * minute) { relativeTimeString = ts.Seconds == 1 ? "one second ago" : ts.Seconds + " seconds ago"; RelativeTimeString.Set(context, relativeTimeString); return; } if (delta < 2 * minute) { relativeTimeString = "a minute ago"; RelativeTimeString.Set(context, relativeTimeString); return; } if (delta < 45 * minute) { relativeTimeString = ts.Minutes + " minutes ago"; RelativeTimeString.Set(context, relativeTimeString); return; } if (delta < 90 * minute) { relativeTimeString = "an hour ago"; RelativeTimeString.Set(context, relativeTimeString); return; } if (delta < 24 * hour) { relativeTimeString = ts.Hours + " hours ago"; RelativeTimeString.Set(context, relativeTimeString); return; } if (delta < 48 * hour) { relativeTimeString = "yesterday"; RelativeTimeString.Set(context, relativeTimeString); return; } if (delta < 30 * day) { relativeTimeString = ts.Days + " days ago"; RelativeTimeString.Set(context, relativeTimeString); return; } if (delta < 12 * month) { int months = Convert.ToInt32(Math.Floor((double)ts.Days / 30)); relativeTimeString = months <= 1 ? "one month ago" : months + " months ago"; RelativeTimeString.Set(context, relativeTimeString); return; } int years = Convert.ToInt32(Math.Floor((double)ts.Days / 365)); relativeTimeString = years <= 1 ? "one year ago" : years + " years ago"; RelativeTimeString.Set(context, relativeTimeString); }
//constructor, etc. public override string ToString() { return(string.Format("{0}\t|\t{1}\t{2}\t{3}", Person.ToString(), TypeAbsence.ToString(), StartingDate.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture), EndingDate.ToString("yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture))); }
protected override void ExecuteCrmWorkFlowActivity(CodeActivityContext context, LocalWorkflowContext localContext) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (localContext == null) { throw new ArgumentNullException(nameof(localContext)); } DateTime startingDate = StartingDate.Get(context); DateTime endingDate = EndingDate.Get(context); DateTime fromDate; DateTime toDate; int increment = 0; int[] monthDay = { 31, -1, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; int month; int day; if (startingDate > endingDate) { fromDate = endingDate; toDate = startingDate; } else { fromDate = startingDate; toDate = endingDate; } if (fromDate.Day > toDate.Day) { increment = monthDay[fromDate.Month - 1]; } if (increment == -1) { increment = DateTime.IsLeapYear(fromDate.Year) ? 29 : 28; } if (increment != 0) { day = toDate.Day + increment - fromDate.Day; increment = 1; } else { day = toDate.Day - fromDate.Day; } if (fromDate.Month + increment > toDate.Month) { month = toDate.Month + 12 - (fromDate.Month + increment); increment = 1; } else { month = toDate.Month - (fromDate.Month + increment); increment = 0; } int year = toDate.Year - (fromDate.Year + increment); int monthsDifference = month + year * 12; MonthsDifference.Set(context, monthsDifference); }
public override string ToString() { return($"{Technology.Name}, {Teacher.FirstName} {Teacher.LastName}, {StartingDate.ToShortDateString()} - {EndingDate.ToShortDateString()}"); }