private void cmbInHostimes_SelectedIndexChanged(object sender, EventArgs e) { DataRow[] dr; if (chkMid.Checked == true) { dr = leaveHosRecordData.Tables[0].Select("INHOSTIMES = " + cmbInHostimes.Text, "CURRENTINHOSMARK"); } else { dr = leaveHosRecordData.Tables[0].Select("CURRENTINHOSMARK = " + cmbInHostimes.Text, "CURRENTINHOSMARK"); } if (dr.Length > 0) { txtStartDate.DateTime = Convert.ToDateTime(dr[0]["ENTERHOSDATE"]); txtStartTime.Time = Convert.ToDateTime(Convert.ToDateTime(dr[0]["ENTERHOSDATE"]).ToString("yyyy-MM-dd") + " 00:00:00"); txtEndTime.Time = Convert.ToDateTime(dr[dr.Length - 1]["LEAVEHOSDATE"]).AddMinutes(10); currentInHosMark1 = Convert.ToInt32(dr[0]["CURRENTINHOSMARK"]); //Case#28375 DateTime leavehosDate = Convert.ToDateTime(dr[dr.Length - 1]["LEAVEHOSDATE"]);//出院时间 TimeSpan ts1 = new TimeSpan(leavehosDate.Hour, leavehosDate.Minute, leavehosDate.Second); TimeSpan ts2 = new TimeSpan(23, 49, 59); //比较时分秒大小 if (ts1 > ts2) { txtEndDate.DateTime = Convert.ToDateTime(dr[dr.Length - 1]["LEAVEHOSDATE"]).AddDays(1); } else { txtEndDate.DateTime = Convert.ToDateTime(dr[dr.Length - 1]["LEAVEHOSDATE"]); } } }