本文整理汇总了C#中TList.Exists方法的典型用法代码示例。如果您正苦于以下问题:C# TList.Exists方法的具体用法?C# TList.Exists怎么用?C# TList.Exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TList
的用法示例。
在下文中一共展示了TList.Exists方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildListSection
/// <summary>
/// Build object to string result
/// </summary>
/// <param name="lstRosters"></param>
/// <param name="date"></param>
/// <returns></returns>
private static object BuildListSection(TList<Roster> lstRosters, DateTime? date)
{
object lst = null;
try
{
DataRepository.RosterProvider.DeepLoad(lstRosters);
// Lay danh sach doctor theo appointment
var lstDoctor = new TList<Users>();
// Lay danh sach service theo appointment
var lstService = new TList<Services>();
foreach (var roster in lstRosters)
{
Roster roster1 = roster;
if (!lstDoctor.Exists(doctor => doctor.Username == roster1.Username))
{
lstDoctor.Add(roster.UsernameSource);
}
lstDoctor.Sort((p1, p2) => p1.DisplayName.CompareTo(p2.DisplayName));
DataRepository.UsersProvider.DeepLoad(roster1.UsernameSource);
if (!lstService.Exists(service => service.Id == roster1.UsernameSource.ServicesId))
{
lstService.Add(DataRepository.ServicesProvider.GetById(Convert.ToInt32(roster1.UsernameSource.ServicesId)));
}
}
// Sort theo priority
lstService.Sort("PriorityIndex ASC");
var dtStart = Convert.ToDateTime(date);
var dtEnd = new DateTime(dtStart.Year, dtStart.Month, dtStart.Day, 23, 59, 59);
dtStart = new DateTime(dtStart.Year, dtStart.Month, dtStart.Day);
lst = lstService.Select(service => new
{
service.Id,
Title = string.IsNullOrEmpty(service.ShortTitle) ? service.Title : service.ShortTitle,
Date = String.Format("{0:MM-dd-yyyy HH:mm:ss}", date),
Doctors = lstDoctor.Where(doctor => doctor.ServicesId == service.Id)
.Select(doctor => new
{
key = doctor.Username,
label = doctor.DisplayName,
Rosters = lstRosters.Where(roster => roster.Username == doctor.Username)
.Select(roster => new
{
startTime = (roster.StartTime < dtStart ? dtStart : roster.StartTime).ToString("MM-dd-yyyy HH:mm:ss"),
endTime = (roster.EndTime > dtEnd ? dtEnd : roster.EndTime).ToString("MM-dd-yyyy HH:mm:ss"),
color = roster.RosterTypeIdSource.ColorCode
}).ToList()
}).ToList()
}).ToList();
}
catch (Exception ex)
{
LoggerController.WriteLog(System.Runtime.InteropServices.Marshal.GetExceptionCode(), ex, Network.GetIpClient());
}
return lst;
}