コード例 #1
0
ファイル: Program.cs プロジェクト: e-runga/SpareParts
        private static void CreateProfiles()
        {
            var client = new DataServiceClient.DataServiceClient();

            var profile1 = new ProfileDto
            {
                Id   = 0,
                Name = "Administrator"
            };

            var profile2 = new ProfileDto
            {
                Id   = 0,
                Name = "Operator"
            };

            var profile3 = new ProfileDto
            {
                Id   = 0,
                Name = "Customer"
            };

            client.SaveProfile(profile1);
            client.SaveProfile(profile2);
            client.SaveProfile(profile3);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: e-runga/SpareParts
        private static void CreateBrands()
        {
            var client = new DataServiceClient.DataServiceClient();
            var brands = new List <BrandDto>();

            brands.Add(new BrandDto {
                Name = "Ford"
            });
            brands.Add(new BrandDto {
                Name = "Toyot"
            });
            brands.Add(new BrandDto {
                Name = "Mazda"
            });
            brands.Add(new BrandDto {
                Name = "Volkswagen"
            });
            brands.Add(new BrandDto {
                Name = "Mercedes"
            });

            foreach (var item in brands)
            {
                var res = client.CreateBrand(item);
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: e-runga/SpareParts
        private static void CreateCategories()
        {
            var client     = new DataServiceClient.DataServiceClient();
            var categories = new List <CategoryDto>();

            categories.Add(new CategoryDto {
                Name = "Batteries"
            });
            categories.Add(new CategoryDto {
                Name = "Air Conditioning"
            });
            categories.Add(new CategoryDto {
                Name = "Brake disk"
            });
            categories.Add(new CategoryDto {
                Name = "Shock absorber"
            });
            categories.Add(new CategoryDto {
                Name = "Brake pad"
            });
            foreach (var item in categories)
            {
                var res = client.CreateCategory(item);
            }
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: e-runga/SpareParts
        private static void GetAllBrands()
        {
            var client = new DataServiceClient.DataServiceClient();
            var brands = client.GetAllBrands();

            foreach (var brand in brands)
            {
                Console.WriteLine("Brand: " + brand.Name);
            }
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: e-runga/SpareParts
        private static void FillYears()
        {
            var client = new DataServiceClient.DataServiceClient();

            for (short i = 1990; i < 2017; i++)
            {
                client.CreateYear(new YearDto {
                    Year = i
                });
            }
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: e-runga/SpareParts
        private static void GetAllProductTypes()
        {
            var client = new DataServiceClient.DataServiceClient();

            var productTypes = client.GetAllProductTypes();

            foreach (var item in productTypes)
            {
                Console.WriteLine("Product Type: " + item.Name);
            }

            Console.ReadLine();
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: e-runga/SpareParts
        private static void Authenticate()
        {
            var    client         = new DataServiceClient.DataServiceClient();
            string username       = "******";
            string passw          = "Kig@li1";
            var    encryptedPassw = Tools.Encryption.TripleDESHelper.Encrypt(passw);
            var    authenticate   = client.Authenticate(username, encryptedPassw);

            if (authenticate)
            {
                Console.WriteLine("Authenticated !");
            }
            else
            {
                Console.WriteLine("Authentication failed !!");
            }
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: e-runga/SpareParts
        private static void CreateState()
        {
            var client = new DataServiceClient.DataServiceClient();
            var states = new List <StateDto>();

            states.Add(new StateDto {
                Name = "New"
            });
            states.Add(new StateDto {
                Name = "Used"
            });

            foreach (var item in states)
            {
                var res = client.CreateState(item);
            }
        }
コード例 #9
0
ファイル: Program.cs プロジェクト: e-runga/SpareParts
        private static void CreateOperator()
        {
            var client = new DataServiceClient.DataServiceClient();

            var profile = client.GetProfileByName("Operator");
            var passw   = SpareParts.Tools.Encryption.TripleDESHelper.Encrypt("Op3rat0r");

            var user = new UserDto
            {
                Id        = 0,
                UserName  = "******",
                FirstName = "OP",
                LastName  = "1",
                Email     = "*****@*****.**",
                Mobile    = "+32444556677",
                Password  = passw,
                Profile   = profile
            };

            var newUser = client.CreateUser(user);
        }
コード例 #10
0
ファイル: Program.cs プロジェクト: e-runga/SpareParts
        private static void CreateUser()
        {
            var client = new DataServiceClient.DataServiceClient();

            var profile = client.GetProfileByName("Administrator");
            var passw   = SpareParts.Tools.Encryption.TripleDESHelper.Encrypt("Kig@li1");

            var user = new UserDto
            {
                Id        = 0,
                UserName  = "******",
                FirstName = "Patrick",
                LastName  = "Hatungimana",
                Email     = "*****@*****.**",
                Mobile    = "+32477454769",
                Password  = passw,
                Profile   = profile
            };

            var newUser = client.CreateUser(user);
        }
コード例 #11
0
ファイル: Program.cs プロジェクト: e-runga/SpareParts
        private static void CreateProductType()
        {
            var client       = new DataServiceClient.DataServiceClient();
            var productTypes = new List <ProductTypeDto>();

            productTypes.Add(new ProductTypeDto {
                Name = "Lift"
            });
            productTypes.Add(new ProductTypeDto {
                Name = "Automobile"
            });
            productTypes.Add(new ProductTypeDto {
                Name = "Trucks"
            });
            productTypes.Add(new ProductTypeDto {
                Name = "Generator"
            });

            foreach (var item in productTypes)
            {
                var res = client.CreateProductType(item);
            }
        }