private static void TestSaveLoadXml(string dossier) { Console.WriteLine(salaries.SaveXml(dossier)); salaries.Clear(); Console.WriteLine(salaries.LoadXml(dossier)); Console.ReadLine(); }
static void Load(string type) { team.Clear(); switch (type) { case "Xml": team.LoadXml(); break; case "Bin": team.LoadBinary(); break; case "Json": team.LoadJson(); break; case "Txt": team.LoadTxt(); break; } foreach (var item in team) { if (item.GetType() == typeof(Commercial)) { Console.WriteLine("Matricule : {0}, Nom : {1}, Prenom : {2}, Chiffre d'affaire : {3}, Commission : {4}", item.Matricule, item.Nom, item.Prenom, ((Commercial)item).ChiffreAffaire, ((Commercial)item).Commission); } else { Console.WriteLine("Matricule : {0}, Nom : {1}, Prenom : {2}", item.Matricule, item.Nom, item.Prenom); } } Console.ReadLine(); }
public async void Query() { if (string.IsNullOrWhiteSpace(StudentID)) { Services.NotityService.Notify("请输入学号"); return; } if (string.IsNullOrWhiteSpace(Name)) { Services.NotityService.Notify("请输入姓名"); return; } IsLoading = true; try { var re = await Services.MyBjutService.QuerySalaries(_httpService, StudentID, Name); if (re == null || re.Count == 0) { Services.NotityService.Notify("没有查询到相关的信息"); Salaries.Clear(); Total = $"没有相关的信息"; return; } Salaries.Clear(); foreach (var item in re) { Salaries.Add(item); } var salary = Salaries.Aggregate(0d, (sum, m) => { return(sum + m.Salary); }); Total = $"参与零工 {Salaries.Count} 次,共收入 {salary } 元"; } catch (Exception e) { Services.NotityService.Notify(e.Message); return; } finally { IsLoading = false; } }