public DateTime GetEndDateTime() { if (cbEndedTime.Checked) { return(new DateTime(dtpEndDate.Value.Year, dtpEndDate.Value.Month, dtpEndDate.Value.Day, dtpEndTime.Value.Hour, dtpEndTime.Value.Minute, dtpEndTime.Value.Second)); } return(Data.MaxRangeDate()); }
private void btnReset_Click(object sender, EventArgs e) { cbStartedTime.Checked = false; cbEndedTime.Checked = false; dtpStartDate.Value = Data.MinRangeDate(); dtpStartTime.Value = Data.MinRangeDate(); dtpEndDate.Value = Data.MaxRangeDate(); dtpEndTime.Value = Data.MaxRangeDate(); }
private void btnNextDay_Click(object sender, EventArgs e) { if (dtpStartDate.Value != Data.MaxRangeDate() && dtpStartTime.Value != Data.MaxRangeDate()) { dtpStartDate.Value += new TimeSpan(1, 0, 0, 0); dtpStartTime.Value += new TimeSpan(1, 0, 0, 0); } if (dtpEndDate.Value != Data.MaxRangeDate() && dtpEndTime.Value != Data.MaxRangeDate()) { dtpEndDate.Value += new TimeSpan(1, 0, 0, 0); dtpEndTime.Value += new TimeSpan(1, 0, 0, 0); } }
public FormWorklogFilterEditor() { InitializeComponent(); foreach (var message in _messages) { var lvi = lvEvents.Items.Add(message); lvi.Checked = Data.FilterEventsList.Contains(message); } var dt1 = Data.FilterDateTimeRange.Item1; var dt2 = Data.FilterDateTimeRange.Item2; cbStartedTime.Checked = dt1 != Data.MinRangeDate(); try { dtpStartDate.Value = cbStartedTime.Checked ? new DateTime(dt1.Year, dt1.Month, dt1.Day) : Data.MinRangeDate(); dtpStartTime.Value = cbStartedTime.Checked ? new DateTime(dt1.Year, dt1.Month, dt1.Day, dt1.Hour, dt1.Minute, dt1.Second) : Data.MinRangeDate(); } catch (Exception) { dtpStartDate.Value = Data.MinRangeDate(); dtpStartTime.Value = Data.MinRangeDate(); } cbEndedTime.Checked = dt2 != Data.MaxRangeDate(); try { dtpEndDate.Value = cbEndedTime.Checked ? new DateTime(dt2.Year, dt2.Month, dt2.Day) : Data.MaxRangeDate(); dtpEndTime.Value = cbEndedTime.Checked ? new DateTime(dt2.Year, dt2.Month, dt2.Day, dt2.Hour, dt2.Minute, dt2.Second) : Data.MaxRangeDate(); } catch (Exception) { dtpEndDate.Value = Data.MinRangeDate(); dtpEndTime.Value = Data.MinRangeDate(); } var overpass = Data.FilterOverpassList; foreach (var item in lvOverpass.Items.Cast <ListViewItem>()) { item.Checked = overpass.Contains(item.Tag.ToString()); } var way = Data.FilterWayList; foreach (var item in lvWay.Items.Cast <ListViewItem>()) { item.Checked = way.Contains(item.Tag.ToString()); } var product = Data.FilterProductList; foreach (var item in lvProduct.Items.Cast <ListViewItem>()) { item.Checked = product.Contains(item.Tag.ToString()); } for (var i = 1; i <= 247; i++) { cbStartRisers.Items.Add(i.ToString("0")); cbEndRisers.Items.Add(i.ToString("0")); } var risers = Data.FilterRiserRange; cbStartRisers.Text = risers.Item1.ToString("0"); cbEndRisers.Text = risers.Item2.ToString("0"); }