public IDateProjection Yearly(EMonth month, EWeeksInMonth weeksInMonth, EDaysOfWeekExt daysOfWeek) { return(new YearlyRelativeProjection() { Month = month, WeeksInMonth = weeksInMonth, DaysOfWeekExt = daysOfWeek }); }
public IDateProjection Yearly(EMonth month, int dayOfMonth) { return(new YearlyProjection() { Month = month, DayOfMonth = dayOfMonth }); }
public ActionResult Months() { var months = new EMonth().ConvertToCollection(); months.ForEach(month => month.Name = EnumResolver.Month(month.Value)); return(new JsonFactory().Success(months)); }
public void GetPreviousDayOfMonthLessThan1Exception() { EMonth month = EMonth.February; int dayOfMonth = 0; DateProjection dateProjection = DateProjection(month, dayOfMonth); Assert.That(() => dateProjection.GetPrevious(new DateTime(2017, 2, 28)), Throws.TypeOf <InvalidOperationException>()); }
public void GetPrevious() { EMonth month = EMonth.February; int dayOfMonth = 31; DateProjection dateProjection = DateProjection(month, dayOfMonth); Assert.That(dateProjection.GetPrevious(new DateTime(2017, 2, 28)), Is.EqualTo(new DateTime(2016, 2, 29))); }
public static int GetMonthNumber(EMonth month) { if (!Enum.IsDefined(typeof(EMonth), month)) { throw new ArgumentException($"The month value ({month}) is not defined!"); } return((int)month); }
public void GetPrevious() { EMonth month = EMonth.March; EWeeksInMonth weeksInMonth = EWeeksInMonth.Second; EDaysOfWeekExt daysOfWeek = EDaysOfWeekExt.Monday; DateProjection dateProjection = DateProjection(month, weeksInMonth, daysOfWeek); Assert.That(dateProjection.GetPrevious(new DateTime(2017, 2, 28)), Is.EqualTo(new DateTime(2016, 3, 14))); }
public void UpdateFromDto(DateProjectionDto dto) { this.ProjectionType = dto.ProjectionType; this.PeriodCount = dto.PeriodCount; this.DayOfMonth = dto.DayOfMonth; this.WeeksInMonth = dto.WeeksInMonth; this.Month = dto.Month; this.DaysOfWeekExt = dto.DaysOfWeekExt; this.DaysOfWeekFlags = dto.DaysOfWeekFlags; }
private static DateProjection DateProjection(EMonth month, int dayOfMonth) { var projection = new YearlyProjection() { Month = month, DayOfMonth = dayOfMonth, }; var dateProjection = new DateProjection(projection); return(dateProjection); }
public static Entity MockMonthlySamplinPlan(EMonth month) { Entity monthlySamplingPlan = new Entity("eims_monthlysamplingplan"); monthlySamplingPlan.Id = Guid.NewGuid(); monthlySamplingPlan["eims_groupa_checks"] = random.Next(0, 2); monthlySamplingPlan["eims_groupa_additional"] = random.Next(0, 2); monthlySamplingPlan["eims_groupb_audits"] = random.Next(0, 2); monthlySamplingPlan["eims_groupb_additional"] = random.Next(0, 2); monthlySamplingPlan["eims_reportingdate"] = new DateTime(2018, (int)month, 1); return(monthlySamplingPlan); }
public static bool Equals(EMonth type, string typeStr) { if (string.IsNullOrEmpty(typeStr)) { return(false); } if (string.Equals(GetValue(type).ToLower(), typeStr.ToLower())) { return(true); } return(false); }
private static DateProjection DateProjection(EMonth month, EWeeksInMonth weeksInMonth, EDaysOfWeekExt daysOfWeek) { var projection = new YearlyRelativeProjection() { Month = month, WeeksInMonth = weeksInMonth, DaysOfWeekExt = daysOfWeek, }; var dateProjection = new DateProjection(projection); return(dateProjection); }
public static string GetValue(EMonth type) { if (type == EMonth.LastMonth) { return("LastMonth"); } if (type == EMonth.MonthAgo) { return("MonthAgo"); } throw new Exception(); }
public static DateTime GetDate(int year, EMonth month, EWeeksInMonth weekInMonth, EDaysOfWeekExt dayOfWeekExt) { int monthNumber = Month.GetMonthNumber(month); bool lookForward = true; DateTime date; switch (weekInMonth) { case EWeeksInMonth.First: date = new DateTime(year, monthNumber, 1); break; case EWeeksInMonth.Second: date = new DateTime(year, monthNumber, 8); break; case EWeeksInMonth.Third: date = new DateTime(year, monthNumber, 15); break; case EWeeksInMonth.Fourth: date = new DateTime(year, monthNumber, 22); break; case EWeeksInMonth.Last: date = new DateTime(year, monthNumber, DateTime.DaysInMonth(year, monthNumber)); lookForward = false; break; default: throw new ArgumentException($"Unrecognized Week in Month ({weekInMonth})!"); } if (lookForward) { while (!date.DateMatches(dayOfWeekExt)) { date = date.AddDays(1); } } else { while (!date.DateMatches(dayOfWeekExt)) { date = date.AddDays(-1); } } return(date); }
private void AddMonthlyCount(EMonth month) { if (ShouldCountGroupA) { var total = MonthlySamplingPlans.Where(m => m.ReportingDate.Month == (int)month).Sum(m => m.GroupAChecks + m.GroupAAdditional); MonthlyCounts.Add(new MonthlyCount(total, EGroupType.ACheck, month)); } if (ShouldCountGroupB) { var total = MonthlySamplingPlans.Where(m => m.ReportingDate.Month == (int)month).Sum(m => m.GroupBAudits + m.GroupBAdditional); MonthlyCounts.Add(new MonthlyCount(total, EGroupType.BAudit, month)); } }
protected override string Execute(string[] InArguments, ref CSDT_CHEATCMD_DETAIL CheatCmdRef) { string empty = string.Empty; if (this.CheckArguments(InArguments, out empty)) { CheatCmdRef.stSetFreeHero = new CSDT_CHEAT_SET_FREE_HERO(); CheatCmdRef.stSetFreeHero.wYear = CheatCommandBase.SmartConvert <ushort>(InArguments[0]); EMonth eMonth = (EMonth)CheatCommandBase.StringToEnum(InArguments[1], typeof(EMonth)); CheatCmdRef.stSetFreeHero.bMonth = (byte)eMonth; CheatCmdRef.stSetFreeHero.bDay = CheatCommandBase.SmartConvert <byte>(InArguments[2]); CheatCmdRef.stSetFreeHero.bHour = CheatCommandBase.SmartConvert <byte>(InArguments[3]); CheatCmdRef.stSetFreeHero.dwHeroID = CheatCommandBase.SmartConvert <uint>(InArguments[4]); CheatCmdRef.stSetFreeHero.dwCreditLevel = CheatCommandBase.SmartConvert <uint>(InArguments[5]); return(CheatCommandBase.Done); } return(empty); }
public void TranslateProjectionType() { const int periodCount = 1; const EMonth month = EMonth.February; const int dayOfMonth = 3; const EDaysOfWeekExt dayOfWeekExt = EDaysOfWeekExt.Thursday; const EDaysOfWeekFlags dayOfWeekFlags = EDaysOfWeekFlags.Friday; const EWeeksInMonth weekInMonth = EWeeksInMonth.Last; DateProjection prj = new DateProjection(EDateProjectionType.Daily) { PeriodCount = periodCount, Month = month, DayOfMonth = dayOfMonth, DaysOfWeekExt = dayOfWeekExt, DaysOfWeekFlags = dayOfWeekFlags, WeeksInMonth = weekInMonth, }; prj.ProjectionType = EDateProjectionType.Weekly; Assert.That(DateProjection.ToShortDescription(prj), Is.EqualTo("Weekly")); prj.ProjectionType = EDateProjectionType.Monthly; Assert.That(DateProjection.ToShortDescription(prj), Is.EqualTo("Monthly")); prj.ProjectionType = EDateProjectionType.MonthlyRelative; Assert.That(DateProjection.ToShortDescription(prj), Is.EqualTo("Monthly Relative")); prj.ProjectionType = EDateProjectionType.Yearly; Assert.That(DateProjection.ToShortDescription(prj), Is.EqualTo("Yearly")); prj.ProjectionType = EDateProjectionType.YearlyRelative; Assert.That(DateProjection.ToShortDescription(prj), Is.EqualTo("Yearly Relative")); prj.ProjectionType = EDateProjectionType.Daily; Assert.That(DateProjection.ToShortDescription(prj), Is.EqualTo("Daily")); Assert.That(prj.PeriodCount, Is.EqualTo(periodCount)); Assert.That(prj.Month, Is.EqualTo(month)); Assert.That(prj.DayOfMonth, Is.EqualTo(dayOfMonth)); Assert.That(prj.DaysOfWeekExt, Is.EqualTo(dayOfWeekExt)); Assert.That(prj.DaysOfWeekFlags, Is.EqualTo(dayOfWeekFlags)); Assert.That(prj.WeeksInMonth, Is.EqualTo(weekInMonth)); Assert.That(DateProjection.ToShortDescription(null), Is.EqualTo("None")); }
/// <summary> /// Expects Spendings or Incomes list and month. /// </summary> /// <param name="data"></param> public UpdateBalance(Object data, EMonth month) { InitializeComponent(); lblSelectedMonth.Text = month.ToString(); if (data is List <Spending> ) { MonthSpendings = (List <Spending>)data; this.cmbType.DataSource = Enum.GetValues(typeof(ESpending)); SetInitialSpendingCombo(); } else if (data is List <Income> ) { MonthIncomes = (List <Income>)data; this.cmbType.DataSource = Enum.GetValues(typeof(EIncome)); SetInitialIncomeCombo(); } item.SelectedValueChanged += ItemChange; }
public TReturn YearlyLeadTime(EMonth month, int dayOfMonth) { this.Activity.LeadTime = new DateProjection(new DateProjectionCreateHelper().Yearly(month, dayOfMonth)); return((TReturn)this); }
public static bool Equals(string typeStr, EMonth type) { return(Equals(type, typeStr)); }
public Balance(EMonth month) : this() { this.month = month; }
public async Task <ActionResult <IEnumerable <MaintenanceCalendar> > > GetAll(int CustomerId, EMonth month) { var data = await _db.MaintenanceCalendars .Where(x => x.CustomerId == CustomerId && x.Month == month) .OrderBy(x => x.Machinery.NameMachinery) .ToListAsync(); //var datos = data.Where(x => x.Month == month).ToList(); return(data); }
public void MonthProviderFindMonth_GetFromValidRange_ReturnsMonth(int n, EMonth expected) { EMonth actual = _provider.FindMonth(n); Assert.AreEqual(expected, actual); }
public TReturn YearlyLeadTime(EMonth month, EWeeksInMonth weeksInMonth, EDaysOfWeekExt daysOfWeek) { this.Activity.LeadTime = new DateProjection(new DateProjectionCreateHelper().Yearly(month, weeksInMonth, daysOfWeek)); return((TReturn)this); }
public static DateTime GetDate(int year, EMonth month, EWeeksInMonth weekInMonth, EDaysOfWeek dayOfWeek) { return(GetDate(year, month, weekInMonth, DaysOfWeekExt.ConvertFrom(dayOfWeek))); }
public MonthlyCount(int total, EGroupType groupType, EMonth month) { Total = total; GroupType = groupType; Month = month; }