public void PrevDay(object o = null) { DateFrom = DateFrom.AddDays(-1); DateTo = DateTo.AddDays(-1); ((DatePicker)o).UpdateLayout(); UpdateView(); }
private void SetDateFromDateTo(ReportType type) { switch (type) { case ReportType.Date: DateTo = DateFrom.AddDays(1).AddSeconds(-1); break; case ReportType.FromDateToDate: break; case ReportType.Month: DateFrom = new DateTime(Convert.ToInt32(itemYear.EditValue), Convert.ToInt32(itemMonth.EditValue), 1); DateTo = DateFrom.AddMonths(1).AddSeconds(-1); break; case ReportType.Quarter: DateFrom = new DateTime(Convert.ToInt32(itemYear.EditValue), Convert.ToInt32(itemQuarter.EditValue), 1); DateTo = DateFrom.AddMonths(3).AddSeconds(-1); break; case ReportType.Year: DateFrom = new DateTime(Convert.ToInt32(itemYear.EditValue), 1, 1); DateTo = new DateTime(Convert.ToInt32(itemYear.EditValue), 12, 31, 23, 59, 59); break; default: break; } }
public void init() { result = ""; client = new ServiceReference1.Service1Client(); DateFrom = DateTime.Now.AddDays(-3).Date; DateTo = DateFrom.AddDays(2).AddMilliseconds(-1); tableList.Add(new QueryState { ID = 0, TableName = TableNames.tablenames["FD"], DateFrom = this.DateFrom.AddDays(-10), DateTo = this.DateTo.AddDays(-5), Status = status.IDLE }); tableList.Add(new QueryState { ID = 1, TableName = TableNames.tablenames["REF"], DateFrom = this.DateFrom, DateTo = this.DateTo, Status = status.IDLE }); tableEnum = tableList.AsEnumerable(); this.initialized = true; }
private void UpdateEndDisplayDate() { EndDateDisplay = DateFrom.AddDays(1); if (DateTo != null && DateTo < EndDateDisplay) { DateTo = EndDateDisplay; } }
private void UpdateFromDisplayDate() { EndDateDisplay = DateFrom.AddDays(1); if (DateTo < EndDateDisplay) { DateTo = DateFrom.AddDays(10); } }
private void Search() { Income = _reportService.GetIncome(DateFrom, DateTo); Outcome = _reportService.GetOutcome(DateFrom, DateTo); Previous = _reportService.GetCurrentMoney(DateFrom.AddDays(-1)); TotalIncome = Income.Sum(x => x.Money); TotalOutcome = Outcome.Sum(x => x.Money); Remaining = TotalIncome - TotalOutcome; Current = Previous + Remaining; }
public void FixDates() { if (DateFrom < DateTime.Now) { DateFrom = DateTime.Now; } if (DateTo < DateFrom) { DateTo = DateFrom.AddDays(180); } }
private void ThisWeek() { DateTime now = DateTime.Today; int delta = DayOfWeek.Monday - now.DayOfWeek; if (delta > 0) { delta -= 7; } DateFrom = now.AddDays(delta); DateTo = DateFrom.AddDays(6); }
public override async Task Execute() { for (var i = 0; i < Days; i++) { var when = DateFrom.AddDays(i); var model = new DayViewModel <T>(); model.SetDate(when); model.Data = Source.Where(s => model.IsBetween(s.When)); model.Total = model.Data.Count(); Result.Add(model); } await Task.CompletedTask; }
private void Forward(object sender, RoutedEventArgs e) { switch (Interval) { case "Day": DateFrom = DateFrom.AddDays(1); break; case "Week": DateFrom = DateFrom.AddDays(7); break; case "Month": DateFrom = DateFrom.AddMonths(1); break; case "Year": DateFrom = DateFrom.AddYears(1); break; } }
public string AddSchedule(string Municipality, string TaxType, string Date) { string MunID, TaxID; DateTime DateFrom, DateTo; if (!DateTime.TryParse(Date, out DateFrom)) { return("Date value invalid"); } switch (TaxType.ToLower()) { case "yearly": DateTo = DateFrom.AddYears(1); break; case "monthly": DateTo = DateFrom.AddMonths(1); break; case "weekly": DateTo = DateFrom.AddDays(7); break; case "daily": DateTo = DateFrom.AddDays(1); break; default: return("Tax Type parameter invalid"); } SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["Connectas"].ConnectionString); try { conn.Open(); DataSet ds = new DataSet(); SqlDataAdapter konektas = new SqlDataAdapter("Select ID from Municipality where [Municipality] = '" + Municipality + "'", conn); konektas.Fill(ds); konektas.Dispose(); if (ds.Tables[0].Rows.Count == 0) { return("Municipality not defined"); } MunID = ds.Tables[0].Rows[0]["ID"].ToString(); ds = new DataSet(); konektas = new SqlDataAdapter("Select ID from TaxesConfig where [TaxTypeString] = '" + TaxType + "'", conn); konektas.Fill(ds); konektas.Dispose(); if (ds.Tables[0].Rows.Count == 0) { return("TaxesConfig not defined"); } TaxID = ds.Tables[0].Rows[0]["ID"].ToString(); SqlCommand cmd = new SqlCommand("INSERT INTO [Taxes] values (" + MunID + "," + TaxID + ",'" + DateFrom.ToString("yyyy-MM-dd") + "','" + DateTo.ToString("yyyy-MM-dd") + "')", conn); cmd.ExecuteNonQuery(); conn.Close(); return("OK"); } catch (Exception ex) { return(ex.Message); } }