public void DateFliter( DateType dateType, FromType fromType, // For date (fromType=0) or for Period (fromType=1) string startDate, string endDate, PeriodBack fromBack, PeriodAhead toAhead ) { ComboBox Drp = advanceSearch.Get <ComboBox>(SearchCriteria.ByAutomationId("cboDateType")); Drp.Items[(int)dateType].Select(); Console.WriteLine(Drp.SelectedItemText.ToString()); switch (fromType) { case FromType.Date: advanceSearch.Get <RadioButton>(SearchCriteria.ByAutomationId("rdbDate")).Click(); DateTimePicker stDate = advanceSearch.Get <DateTimePicker>(SearchCriteria.ByAutomationId("dteStartDate")); stDate.Get(SearchCriteria.ByAutomationId("txtDateTime")).SetValue(startDate); DateTimePicker edDate = advanceSearch.Get <DateTimePicker>(SearchCriteria.ByAutomationId("dteEndDate")); edDate.Get(SearchCriteria.ByAutomationId("txtDateTime")).SetValue(endDate); break; case FromType.Period: ComboBox Drp2 = advanceSearch.Get <ComboBox>(SearchCriteria.ByAutomationId("cboFromPeriod")); Drp2.Items[(int)fromBack].Select(); ComboBox Drp3 = advanceSearch.Get <ComboBox>(SearchCriteria.ByAutomationId("cboToPeriod")); Drp3.Items[(int)toAhead].Select(); break; } }
public void DateUsage(FromType fromType, string usageStartDate, string usageEndDate, PeriodBack fromBack, PeriodAhead toAhead) { switch (fromType) { case FromType.Date: DateTimePicker stDate = advanceSearch.Get <DateTimePicker>(SearchCriteria.ByAutomationId("dteUsageDateFrom")); stDate.Get(SearchCriteria.ByAutomationId("txtDateTime")).SetValue(usageStartDate); DateTimePicker edDate = advanceSearch.Get <DateTimePicker>(SearchCriteria.ByAutomationId("dteUsageDateTo")); stDate.Get(SearchCriteria.ByAutomationId("txtDateTime")).SetValue(usageEndDate); break; case FromType.Period: ComboBox Drp2 = advanceSearch.Get <ComboBox>(SearchCriteria.ByAutomationId("cboUsagePeriodFrom")); Drp2.Items[(int)fromBack].Select(); ComboBox Drp3 = advanceSearch.Get <ComboBox>(SearchCriteria.ByAutomationId("cboUsagePeriodTo")); Drp3.Items[(int)toAhead].Select(); break; } }