protected void drpSegmentQuery_SelectedIndexChanged(object sender, System.EventArgs e) { this.drpShiftQuery.Items.Clear(); this.txtStepSequence.Segment = this.drpSegmentQuery.SelectedValue; if (this.drpSegmentQuery.SelectedValue != "") { BaseModelFacade facade = new FacadeFactory(base.DataProvider).CreateBaseModelFacade(); Segment segment = facade.GetSegment(this.drpSegmentQuery.SelectedValue) as Segment; if (segment != null) { object[] shifts = new FacadeFactory(base.DataProvider).CreateShfitModelFacade().QueryShiftBySegment("", segment.SegmentCode, 0, System.Int32.MaxValue); if (shifts != null) { string selected = ""; int now = FormatHelper.TODateInt(System.DateTime.Now); foreach (Shift shift in shifts) { if (shift.ShiftBeginTime <= now && shift.ShiftEndTime >= now) { selected = shift.ShiftCode; } this.drpShiftQuery.Items.Add(shift.ShiftCode); } try { this.drpShiftQuery.SelectedValue = selected; } catch { this.drpShiftQuery.SelectedIndex = 0; } } } } }