public static void ProductionProcess() { ServicePointManager.DefaultConnectionLimit = 50; expiredUsers = new List<UserInfo>(); waitForConfirmed = new List<UserInfo>(); confirmedUsers = new List<UserInfo>(); users = new List<UserInfo>(); //read bud.txt file to users if (!Directory.Exists("\\Result")) { Directory.CreateDirectory(".\\Result"); } ReadFileToUsers(users); //cycle users to requestjson BudNetRequest budnetRequest; string result = ""; for (var i = 0; i < users.Count; i++) { var tempResult = ""; budnetRequest = new BudNetRequest(users[i]); try { tempResult = budnetRequest.RequestJson(); } catch (Exception e) { if (e is ExperiedException) expiredUsers.Add(users[i]); else //include AnalizingException UnknowLoginException and other real unknown error. Program.WriteLog(e.Message, users[i]); } result += tempResult; Console.Write(tempResult); } ChangePassword(); result += InspectChangedUser(waitForConfirmed); result = AnalizeCommaTextToHtml(result); if (confirmedUsers.Count > 0) { WriteNewBudNetUserFile(); var support = new SupportRequest(confirmedUsers); try { support.LogOnAndAdd(); } catch (Exception e) { WriteLog(e.Message); } } WriteTodayFile(result); Console.WriteLine("Input Any Key to Exit"); Console.ReadKey(); }
public static string InspectChangedUser(List<UserInfo> waitToConfirm) { BudNetRequest budnetRequest; string result = ""; for (var i = 0; i < waitToConfirm.Count; i++) { var tempResult = ""; budnetRequest = new BudNetRequest(waitToConfirm[i]); try { tempResult = budnetRequest.RequestJson(); for (int j = 0; j < users.Count; j++) { if (waitToConfirm[i].username == users[j].username) { users[j] = waitToConfirm[i]; confirmedUsers.Add(users[j]); } } } catch (ExperiedException) { Program.WriteLog(" changed password failed.", waitToConfirm[i]); } catch (Exception e) { Program.WriteLog(e.Message, users[i]); } result += tempResult; Console.Write(tempResult); } return result; }