/// <summary> /// Seleção de Projeto /// </summary> private void PeriodoSelecionado() { ListView listView = (ListView)View; CriteriaOperator criteria = null; if (SingleChoiceFilterPeriodo.SelectedItem.Data != null || !SingleChoiceFilterPeriodo.SelectedItem.Caption.Equals("Todos")) { DateTime date01 = DateTime.MinValue, date02 = DateTime.MinValue; if (SingleChoiceFilterPeriodo.SelectedItem.Data.Equals("u15")) { date01 = DateTime.Today.Date.AddDays(-15); date02 = DateTime.Today; } else if (SingleChoiceFilterPeriodo.SelectedItem.Data.Equals("u30")) { date01 = DateTime.Today.Date.AddDays(-30); date02 = DateTime.Today; } else if (SingleChoiceFilterPeriodo.SelectedItem.Data.Equals("u45")) { date01 = DateTime.Today.Date.AddDays(-45); date02 = DateTime.Today; } else if (SingleChoiceFilterPeriodo.SelectedItem.Data.Equals("p15")) { date01 = DateTime.Today; date02 = DateTime.Today.Date.AddDays(15); } else if (SingleChoiceFilterPeriodo.SelectedItem.Data.Equals("p30")) { date01 = DateTime.Today; date02 = DateTime.Today.Date.AddDays(30); } else if (SingleChoiceFilterPeriodo.SelectedItem.Data.Equals("pm")) { date01 = DateTime.Today.AddMonths(1); if (date01.Day != 1) { date01 = date01.AddDays(-(date01.Day - 1)); } date02 = date01.AddMonths(1).AddDays(-1); } else if (SingleChoiceFilterPeriodo.SelectedItem.Data.Equals("am")) { date01 = DateTime.Today.AddMonths(-1); if (date01.Day != 1) { date01 = date01.AddDays(-(date01.Day - 1)); } date02 = date01.AddMonths(1).AddDays(-1); } else if (SingleChoiceFilterPeriodo.SelectedItem.Data.Equals("ma")) { date01 = DateTime.Today; if (date01.Day != 1) { date01 = date01.AddDays(-(date01.Day - 1)); } date02 = date01.AddMonths(1).AddDays(-1); } criteria = CriteriaOperator.Parse("(DtInicio >= ? AND _DtRetorno <= ?) OR (DtInicio <= ? AND _DtRetorno >= ? AND " + "_DtRetorno <= ?) OR (DtInicio >= ? AND DtInicio <= ? AND _DtRetorno >= ?)", date01.Date, date02.Date, date01.Date, date01.Date, date02.Date, date01.Date, date02.Date, date02.Date); } listView.CollectionSource.Criteria["periodo"] = criteria; Colaborador.RnSalvarPeriodoUltimoPlanejamentoFerias(colaborador.Session, colaborador, SingleChoiceFilterPeriodo.SelectedIndex); }