Пример #1
0
        static void Main(string[] args)
        {
            DataAccess.ConnectionString = "data source=192.168.58.57;initial catalog=ptf;persist security info=False;............;packet size=4096;";
            //DataAccess.ConnectionString = "data source=192.168.58.27;initial catalog=ptf;persist security info=False;user id=sa;pwd=Singapore123;packet size=4096;";

            string fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ServerData.xml");

            if (File.Exists(fileName))
            {
                DataAccess.SaveLocations(DataAccess.LoadLocationsFromFile(fileName));
                File.Delete(fileName);
            }

            SiteCodeObject server = new SiteCodeObject();
            var            list   = DataAccess.LoadLocationsFromLocations().ToList();

            server.SetLocations(list);
            server.SetCountries(DataAccess.LoadCountries());
            var svcHost = new ServiceHost(server);

            svcHost.Open();
            Console.Write("Click to exit");
            Console.ReadLine();
            try
            {
                DataAccess.SaveLocations(server.GetLocations());
            }
            catch (SqlException)
            {
                DataAccess.SaveLocationsToFile(server.GetLocations(), fileName);
            }
        }
Пример #2
0
        public void sitecode_merge_locations_test_2()
        {
            DataAccess.ConnectionString = "data source=192.168.58.57;initial catalog=ptf;persist security info=False;user id=sa;pwd=sa;packet size=4096;";
            var lookupLocations = DataAccess.LoadLocationsFromLocations().ToList();

            SiteCodeObject server = new SiteCodeObject();

            server.SetLocations(lookupLocations);

            foreach (var site in new string[] {
                "160018P1348D2",
                "170018P1348D2",
                "180018P1348D2",
                "190018P1348D2",
                "210018P1348D2",
                "220018P1348D2",
                "230018P1348D2",
                "240018P1348D2",
                "241018P1348D2",
                "242018P1348D2",
                "243118P1348D2",
                "244118P1348D2",
                "244218P1348D2",
                "244318P1348D2",
                "244418P1348D2",
                "244518P1348D2",
                "244618P1348D2",
                "244718P1348D2",
                "244818P1348D2",
                "244918P1348D2",
                "244998P1348D2",
                "244888P1348D2",
                "254778P1348D2",
                "254818P1348D2",
                "264918P1348D2",
                "274998P1348D2",
                "284888P1348D2",
                "294778P1348D2",
            })
            {
                var result = server.GetLocation(site);
                Trace.WriteLine(site + "\t" + result);
            }

            DataAccess.SaveLocations(server.GetLocations());
        }
Пример #3
0
        public void sitecode_merge_locations_test()
        {
            DataAccess.ConnectionString = "data source=192.168.58.57;initial catalog=ptf;persist security info=False;user id=sa;pwd=sa;packet size=4096;";
            var lookupLocations = DataAccess.LoadLocationsFromLocations();

            var voucherPartLocations = DataAccess.LoadLocationsFromVoucherPart();

            var locations = DataAccess.JoinLocations(voucherPartLocations, lookupLocations);

            DataAccess.SaveLocationsToFile(locations, "C:\\test\\locations.xml");

            SiteCodeObject server = new SiteCodeObject();

            server.SetLocations(locations);

            for (int i = 0; i < 100; i++)
            {
                foreach (var site in new string[] {
                    "100018P1348D2",
                    "100018P1504D2",
                    "100018P1752D2",
                    "100018P1858D2",
                    "100018P1Half300D2",
                    "100018P1Half901D2",
                    "100018P2300D2",
                    "100018P232D2",
                    "100018P2484D2",
                    "100018P2504D2",
                    "100018P2858D1",
                    "100018P2858D2",
                    "100018P2901D2"
                })
                {
                    var result = server.GetLocation(site);
                    Trace.WriteLine(site + "\t" + result);
                }
            }

            DataAccess.SaveLocations(server.GetLocations());
        }