Exemplo n.º 1
0
        public bool AppointClass(Teacher teacher, DateTime day, string time)
        {
            string mm = day.ToString("yyyy-MM-dd") + " " + time;

            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine(teacher.Name + ":" + mm + "  约课");
            Console.ResetColor();
            CBResponse <CBResponse_Value> response = AKSHttpHelper.AppointClass(teacher.TUID, coid, uid, mm);

            if (response != null && response.value != null && response.value.result)
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine(teacher.Name + ":" + mm + "\n" + Newtonsoft.Json.JsonConvert.SerializeObject(response) + "\n" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                Console.ResetColor();

                WriteSuccessDayToTxt(day);
                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
 public void PriorityTteacher(Teacher teacher)
 {
     foreach (DateTime day in GetFailDay())
     {
         Console.WriteLine(teacher.Name + ":" + day.ToString("yyyy-MM-dd"));
         CBResponse <Dictionary <DateTime, dynamic> > dictionary = AKSHttpHelper.GetTargetTimeAvaDuration(teacher.TUID, day.ToString("yyyy-MM-dd"), coid);
         if (dictionary != null && dictionary.value != null && dictionary.value.Count > 0)
         {
             foreach (dynamic item in dictionary.value.Values)
             {
                 int count = time.Where(s => s.Contains((string)item.hour)).Count();
                 if (count > 0)
                 {
                     bool b = AppointClass(teacher, day, (string)item.hour);
                     if (b)
                     {
                         break;
                     }
                 }
             }
         }
     }
 }