示例#1
0
 private static void TestSaveLoadXml(string dossier)
 {
     Console.WriteLine(salaries.SaveXml(dossier));
     salaries.Clear();
     Console.WriteLine(salaries.LoadXml(dossier));
     Console.ReadLine();
 }
示例#2
0
文件: Program.cs 项目: sarahcsn/CDI
        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();
        }
示例#3
0
        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;
            }
        }