예제 #1
0
        private object beginDeserialization(string answer)
        {
            XMLConverter    xc = new XMLConverter();
            JSONConverter   jc = new JSONConverter();
            BinaryConverter bc = new BinaryConverter();

            switch (answer)
            {
            case "xmlc":
                return(xc.readClient(filePath));

            case "xmlp":
                return(xc.readProduct(filePath));

            case "xmlt":
                return(xc.readTransaction(filePath));

            case "xmllc":
                return(xc.readClientsList(filePath));

            case "xmloct":
                return(xc.readTransactionsObservableCollection(filePath));

            case "xmldp":
                return(xc.readProductsDictionary(filePath));

            case "jsonc":
                return(jc.readClient(filePath));

            case "jsonp":
                return(jc.readProduct(filePath));

            case "jsont":
                return(jc.readTransaction(filePath));

            case "jsonlc":
                return(jc.readClientsList(filePath));

            case "jsonoct":
                return(jc.readTransactionsObservableCollection(filePath));

            case "jsondp":
                return(jc.readProductsDictionary(filePath));

            case "binc":
                return(bc.readClient(filePath));

            case "binp":
                return(bc.readProduct(filePath));

            case "bint":
                return(bc.readTransaction(filePath));

            case "binlc":
                return(bc.readClientsList(filePath));

            case "binoct":
                return(bc.readTransactionsObservableCollection(filePath));

            case "bindp":
                return(bc.readProductsDictionary(filePath));

            default:
                return(null);
            }
            ;
        }
예제 #2
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;
            }
            ;
        }