Пример #1
0
        private void beginSerialization(string answer)
        {
            XMLConverter    xc = new XMLConverter();
            JSONConverter   jc = new JSONConverter();
            BinaryConverter bc = new BinaryConverter();

            switch (answer)
            {
            case "xmlc":
                xc.writeObject(dataRepo.GetSpecificClient(chooseIndex()), filePath);
                break;

            case "xmlp":
                xc.writeObject(dataRepo.GetSpecificProduct(chooseIndex()), filePath);
                break;

            case "xmlt":
                xc.writeObject(dataRepo.GetSpecificTransaction(chooseIndex()), filePath);
                break;

            case "xmllc":
                xc.writeClientsList(dataRepo.GetAllClients(), filePath);
                break;

            case "xmloct":
                xc.writeTransactionsObservableCollection(dataRepo.GetAllTransactions(), filePath);
                break;

            case "xmldp":
                xc.writeProductsDictionary(dataRepo.GetAllProducts(), filePath);
                break;

            case "jsonc":
                jc.writeObject(dataRepo.GetSpecificClient(chooseIndex()), filePath);
                break;

            case "jsonp":
                xc.writeObject(dataRepo.GetSpecificProduct(chooseIndex()), filePath);
                break;

            case "jsont":
                xc.writeObject(dataRepo.GetSpecificTransaction(chooseIndex()), filePath);
                break;

            case "jsonlc":
                jc.writeClientsList(dataRepo.GetAllClients(), filePath);
                break;

            case "jsonoct":
                jc.writeTransactionsObservableCollection(dataRepo.GetAllTransactions(), filePath);
                break;

            case "jsondp":
                jc.writeProductsDictionary(dataRepo.GetAllProducts(), filePath);
                break;

            case "binc":
                bc.writeObject(dataRepo.GetSpecificClient(chooseIndex()), filePath);
                break;

            case "binp":
                jc.writeObject(dataRepo.GetSpecificProduct(chooseIndex()), filePath);
                break;

            case "bint":
                jc.writeObject(dataRepo.GetSpecificTransaction(chooseIndex()), filePath);
                break;

            case "binlc":
                bc.writeClientsList(dataRepo.GetAllClients(), filePath);
                break;

            case "binoct":
                bc.writeTransactionsObservableCollection(dataRepo.GetAllTransactions(), filePath);
                break;

            case "bindp":
                bc.writeProductsDictionary(dataRepo.GetAllProducts(), filePath);
                break;

            default:
                break;
            }
            ;
        }