示例#1
0
        private static void ucitajRacune(string operatorName)
        {
            try
            {
                string putanja = Environment.CurrentDirectory + "\\" + operatorName + "Racuni.xml";

                List <OperatorskiRacun> listaRacuna = new List <OperatorskiRacun>();
                XmlSerializer           xs          = new XmlSerializer(typeof(List <OperatorskiRacun>));
                StreamReader            sr          = new StreamReader(putanja);
                listaRacuna = (List <OperatorskiRacun>)xs.Deserialize(sr);
                sr.Close();
                foreach (OperatorskiRacun r in listaRacuna)
                {
                    OperatorskiRacun clean = Sifrovanje.desifrujOperatorskiRacun(r);
                    OperatorDB.BazaRacuna.Add(clean.BrojRacuna, clean);
                }
            }
            catch
            {
            }
        }
示例#2
0
        public bool AddRacun(Racun r)
        {
            Racun desifrovanRacun = Sifrovanje.desifrujRacun(r);

            if (OperatorDB.BazaKorisnika.ContainsKey(desifrovanRacun.BrojRacuna))
            {
                return(false);
            }
            string           randomRacun = Guid.NewGuid().ToString();
            OperatorskiRacun or          = new OperatorskiRacun(desifrovanRacun.Username, randomRacun, "0");

            OperatorDB.BazaRacuna.Add(or.BrojRacuna, or);
            Client <IGatewayConnection> client       = new Client <IGatewayConnection>("mbgateway", Konstante.GATEWAY_IP, Konstante.GATEWAY_PORT.ToString(), "GatewayConnection");
            IGatewayConnection          gatewayProxy = client.GetProxy();
            User korisnik = gatewayProxy.OperatorToBankGetClient(BitConverter.ToString(Sifrovanje.sifrujCBC(desifrovanRacun.Username, Konstante.ENCRYPTION_KEY)));

            OperatorDB.BazaKorisnika.Add(korisnik.Username, korisnik);
            upisiKorisnike(OperatorDB.operatorName);
            upisiRacune(OperatorDB.operatorName);
            Console.WriteLine("Uspesno kreiran racun {0} za klijenta {1}", randomRacun, desifrovanRacun.Username);
            return(true);
        }
示例#3
0
        public void upisiRacune(string operatorname)
        {
            lock (locker)
            {
                string putanja = Environment.CurrentDirectory + "\\" + operatorname + "Racuni.xml";

                List <OperatorskiRacun> listaRacuna = new List <OperatorskiRacun>();
                //prepisati iz recnika u ovu listu
                foreach (OperatorskiRacun r in OperatorDB.BazaRacuna.Values)
                {
                    OperatorskiRacun sifrovan = new OperatorskiRacun();
                    sifrovan = Sifrovanje.sifrujOperatorskiRacun(r);

                    listaRacuna.Add(sifrovan);
                }

                XmlSerializer ser = new XmlSerializer(typeof(List <OperatorskiRacun>));

                StreamWriter sw = new StreamWriter(putanja);
                ser.Serialize(sw, listaRacuna);

                sw.Close();
            }
        }