本文整理汇总了C#中Data.List.FirstOrDefault方法的典型用法代码示例。如果您正苦于以下问题:C# List.FirstOrDefault方法的具体用法?C# List.FirstOrDefault怎么用?C# List.FirstOrDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data.List
的用法示例。
在下文中一共展示了List.FirstOrDefault方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MigrateSurveyCustomer
public static void MigrateSurveyCustomer()
{
PortalDbContext portalDbContext = new PortalDbContext();
PortalDbRepository<Access> accesPortalDbRepository = new PortalDbRepository<Access>(portalDbContext);
PortalDbRepository<SurveyCustomer> surveyCustomerRepository = new PortalDbRepository<SurveyCustomer>(portalDbContext);
PortalDbRepository<SurveyQuestion> surveyQuestionRepository = new PortalDbRepository<SurveyQuestion>(portalDbContext);
PortalDbRepository<SurveysGeneralAnswer> surveysGeneralAnswerRepository = new PortalDbRepository<SurveysGeneralAnswer>(portalDbContext);
PortalDbRepository<SurveysPossibleAnswer> surveyPossibleAnswerRepository = new PortalDbRepository<SurveysPossibleAnswer>(portalDbContext);
Manager portalDbManager = new Manager(accesPortalDbRepository);
/////////////===================>>>>>>>>>>>>>>>>>>>
SurveyCustomerDbManager SurveyCustomerDbManager = new SurveyCustomerDbManager(surveyCustomerRepository, portalDbManager);
SurveyQuestionManager SurveyQuestionManager = new SurveyQuestionManager(surveyQuestionRepository, portalDbManager);
SurveyGeneralAnswerManager SurveyGeneralAnswerManager = new SurveyGeneralAnswerManager(surveysGeneralAnswerRepository, portalDbManager);
SurveyPossibleAnswerManager SurveyPossibleAnswerManager = new SurveyPossibleAnswerManager(surveyPossibleAnswerRepository, portalDbManager);
//////////////////////////////////////////////////
CosmeticExpressDbContext cosmeticExpressDbContext = new CosmeticExpressDbContext();
CosmeticExpressDbRepository<Access> accesCosmeticExpressDbRepository = new CosmeticExpressDbRepository<Access>(cosmeticExpressDbContext);
CosmeticExpressDbRepository<User> userRepository = new CosmeticExpressDbRepository<User>(cosmeticExpressDbContext);
CosmeticExpressDbRepository<Schedule> scheduleRepository = new CosmeticExpressDbRepository<Schedule>(cosmeticExpressDbContext);
CosmeticExpressDbRepository<Office> officeRepository = new CosmeticExpressDbRepository<Office>(cosmeticExpressDbContext);
CosmeticExpressDbRepository<VWCompleteSurgery> VWCompleteSurgeryRepository = new CosmeticExpressDbRepository<VWCompleteSurgery>(cosmeticExpressDbContext);
CosmeticExpressDbRepository<Entity.CosmeticExpress.Patient> CosmeticExpressPatientRepository = new CosmeticExpressDbRepository<Entity.CosmeticExpress.Patient>(cosmeticExpressDbContext);
Manager cosmeticExpressDbManager = new Manager(accesCosmeticExpressDbRepository);
UserManager userManager = new UserManager(userRepository, cosmeticExpressDbManager);
ScheduleManager scheduleManager = new ScheduleManager(scheduleRepository, cosmeticExpressDbManager);
OfficeManager officeManager = new OfficeManager(officeRepository, cosmeticExpressDbManager);
VWCompleteSurgeryManager vwCompleteSurgeryManager = new VWCompleteSurgeryManager(VWCompleteSurgeryRepository, cosmeticExpressDbManager);
CosmeticExpressPatientManager CosmeticExpressPatientManager = new CosmeticExpressPatientManager(CosmeticExpressPatientRepository, cosmeticExpressDbManager);
//////////////////////////////////////////////////
ApplicationDbContext applicationDbContext = new ApplicationDbContext();
ApplicationDbRepository<Access> accesApplicationDbRepository = new ApplicationDbRepository<Access>(applicationDbContext);
ApplicationDbRepository<Review> reviewRepository = new ApplicationDbRepository<Review>(applicationDbContext);
ApplicationDbRepository<Doctor> doctorRepository = new ApplicationDbRepository<Doctor>(applicationDbContext);
ApplicationDbRepository<Lead> leadRepository = new ApplicationDbRepository<Lead>(applicationDbContext);
ApplicationDbRepository<Expert> expertRepository = new ApplicationDbRepository<Expert>(applicationDbContext);
ApplicationDbRepository<Center> centerRepository = new ApplicationDbRepository<Center>(applicationDbContext);
ApplicationDbRepository<Entity.ReviewManagerEntities.Patient> ApplicationPatientRepository = new ApplicationDbRepository<Entity.ReviewManagerEntities.Patient>(applicationDbContext);
Manager applicationDbManager = new Manager(accesApplicationDbRepository);
ReviewManager reviewManager = new ReviewManager(reviewRepository, applicationDbManager);
///////////////////=============================>>>>>>>>>>>>>>>
DoctorManager doctorManager = new DoctorManager(doctorRepository, applicationDbManager);
LeadManager leadManager = new LeadManager(leadRepository, applicationDbManager);
ExpertManager expertManager = new ExpertManager(expertRepository, applicationDbManager);
CenterManager centerManager = new CenterManager(centerRepository, applicationDbManager);
ApplicationPatientManager ApplicationPatientManager = new ApplicationPatientManager(ApplicationPatientRepository, cosmeticExpressDbManager);
var SurveyQuestionCollection = SurveyQuestionManager.Get().ToArray();
var SurveyCustomerCollection = SurveyCustomerDbManager.Get().ToArray();
var SurveyPossibleAnswerCollection = SurveyPossibleAnswerManager.Get().ToArray();
var SurveyGeneralAnswerCollection = SurveyGeneralAnswerManager.Get().ToArray();
ICollection<VWCompleteSurgery> vwCompleteSurgeriesCollection = vwCompleteSurgeryManager.Get().ToArray();
var doctors = doctorManager.Get().Select(d => new{ d.Id, d.FullName, d.Reviews.Count }).ToArray();
var sources = reviewManager.Get().GroupBy(r => r.Source).ToArray().Select(group => new {Source = group.Key, Count = group.Count()});
ICollection<Review> ReviewCollection = new List<Review>();
foreach (var sgAnswer in SurveyGeneralAnswerCollection)
{
if (!reviewManager.Get().Any(review => review.ExternalId == sgAnswer.Id && review.Source == "Portal") && sgAnswer.SurveyTemplateId == 2)
{
//Schedule Schedule = scheduleManager.Get(sched =>
//sched.PatientID == sgAnswer.SurveyCustomer.ExternalId
//&& sched.ServiceID == 5
//&& sched.dtStart.AddMonths(3) >= sgAnswer.SurveyDate).FirstOrDefault();
VWCompleteSurgery surgery = vwCompleteSurgeriesCollection.Where(surg => surg.PatientID == sgAnswer.SurveyCustomer.ExternalId && surg.dtStart.AddMonths(3) >= sgAnswer.SurveyDate).FirstOrDefault();
if (surgery != null)
{
Review review = new Review();
review.Source = "Portal";
review.ExternalId = sgAnswer.Id;
review.Rating = 0;
review.CreatedOn = surgery.dtStart;
//FROM CEXPRESS/Patient/Patient
Entity.CosmeticExpress.Patient CosmeticExpressPatient = CosmeticExpressPatientManager.Get(patient => patient.PatientID == surgery.PatientID).FirstOrDefault();
var existingApplicationPatient = ApplicationPatientManager.Get(patient => patient.ExternalId == CosmeticExpressPatient.PatientID && patient.Source == "CosmeticExpress").FirstOrDefault();
if (existingApplicationPatient != null)
{
review.PatientId = existingApplicationPatient.Id;
}
else
{
Entity.ReviewManagerEntities.Patient Patient = new Entity.ReviewManagerEntities.Patient()
{
ExternalId = CosmeticExpressPatient.PatientID,
FirstName = CosmeticExpressPatient.FirstName,
LastName = CosmeticExpressPatient.LastName,
MiddleName = CosmeticExpressPatient.MiddleName,
//.........这里部分代码省略.........