コード例 #1
0
ファイル: UserDb.cs プロジェクト: alvinek/Medicine
        private void Flush()
        {
            DbFiles dbFiles = new DbFiles();

            File.Delete(dbFiles.UserDbFile);
            List <string> newFile = new List <string>();

            foreach (var user in users)
            {
                newFile.Add($"{user.Id},"
                            + $"{user.Name},"
                            + $"{user.UserNickname},"
                            + $"{user.Subname},"
                            + $"{user.Password}");
            }

            File.WriteAllLines(dbFiles.UserDbFile, newFile);
        }
コード例 #2
0
        private void Flush()
        {
            DbFiles dbFiles = new DbFiles();

            File.Delete(dbFiles.MainDbFile);

            List <string> newFile = new List <string>();

            foreach (var data in medicineDb)
            {
                newFile.Add($"{data.Id},"
                            + $"{data.MedicineName},"
                            + $"{data.MedicineQuantity},"
                            + $"{data.MedicineQuantityType},"
                            + $"{data.MedicineProducer},"
                            + $"{data.MedicineRefundPossible.ToString().ToLower()},"
                            + $"{data.MedicineRefundPercentage},"
                            + $"{data.MedicinePrice}");
            }

            File.WriteAllLines(dbFiles.MainDbFile, newFile);
        }