using System.Collections.Generic;
using System.Data.Entity;
using System.Linq.Dynamic;
using System.Linq.Expressions;
using System.Threading.Tasks;
public class CureOfProgramResponses
public int id {get; set;}
public string name {get; set;}
public bool isMixed {get; set;}
public int qty {get; set;}
public int Session {get; set;}
public int OrderNo {get; set;}
public static void Main()
var paket1 = new CureOfProgramResponses();
var paket2 = new CureOfProgramResponses();
var paket3 = new CureOfProgramResponses();
var paket4 = new CureOfProgramResponses();
List<CureOfProgramResponses> cureOfProgramResponses = new List<CureOfProgramResponses>();
cureOfProgramResponses.Add(paket1);
cureOfProgramResponses.Add(paket2);
cureOfProgramResponses.Add(paket3);
cureOfProgramResponses.Add(paket4);
DateTime createdDate = DateTime.Now;
DateTime appointmentDate = new DateTime(createdDate.Year, createdDate.Month, createdDate.Day, 12, 0, 0);
List<CureOfProgramResponses> mixedCures = cureOfProgramResponses.Where(w=>w.isMixed==true).OrderBy(o=> o.OrderNo).ToList();
int mixedTotalAppointmentCount = mixedCures.Sum(s=>s.qty);
var mixedCureCount = mixedCures.Count();
Console.WriteLine("ilk randevuyu bugüne veriyoruz. Sonra seans süresine göre gün ekliyoruz.");
while(mixedTotalAppointmentCount > 0)
for(int i = 0; i< mixedCureCount; i++)
if(mixedCures[i].qty != 0)
Console.WriteLine(mixedCures[i].name +" Mix mi: Evet, " + "Süresi: " + mixedCures[i].Session +"gün / Randevu Tarihi: "+ appointmentDate + " sonuna " +mixedCures[i].Session+" gün eklenecek");
mixedTotalAppointmentCount-=1;
appointmentDate = appointmentDate.AddDays(mixedCures[i].Session);
List<CureOfProgramResponses> unMixedCures = cureOfProgramResponses.Where(w=>w.isMixed==false).OrderBy(o=> o.OrderNo).ToList();
int UnMixedTotalAppointmentCount = unMixedCures.Sum(s=>s.qty);
var UnMixedAppCount = unMixedCures.Count();
while(UnMixedTotalAppointmentCount > 0)
for(int i = 0; i< UnMixedAppCount; i++)
if(unMixedCures[i].qty != 0)
Console.WriteLine(unMixedCures[i].name +" Mix mi: Hayır, " + "Süresi: " + unMixedCures[i].Session +"gün / Randevu Tarihi: "+ appointmentDate+ " sonuna " +unMixedCures[i].Session+" gün eklenecek");
UnMixedTotalAppointmentCount-=1;
appointmentDate = appointmentDate.AddDays(unMixedCures[i].Session);