├── GamePlatformDemo.Entities
├── GamePlatformDemo.Entities.csproj
├── Program.cs
├── Abstract
│ └── IEntity.cs
└── Concrete
│ ├── CampaignCoupon.cs
│ ├── Sale.cs
│ ├── GameEdition.cs
│ └── Member.cs
├── GamePlatformDemo.DataAccess
├── Abstract
│ ├── IMemberCheckService.cs
│ └── IEntityRepository.cs
├── Program.cs
├── Concrete
│ ├── MemberCheckManager.cs
│ ├── CampaignCouponDal.cs
│ └── MemberDal.cs
├── Connected Services
│ └── MernisServiceReference
│ │ ├── ConnectedService.json
│ │ └── Reference.cs
├── GamePlatformDemo.DataAccess.csproj
└── Adapters
│ └── MernisServiceAdapter.cs
├── GamePlatformDemo.Business
├── GamePlatformDemo.Business.csproj
├── Abstract
│ ├── ISignUp.cs
│ ├── ICouponService.cs
│ └── ISaleService.cs
├── Concrete
│ ├── AccountManager.cs
│ ├── CampaignCouponManager.cs
│ └── SaleManager.cs
└── Program.cs
├── README.md
├── GamePlatformDemo.sln
├── .gitattributes
└── .gitignore
/GamePlatformDemo.Entities/GamePlatformDemo.Entities.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | netcoreapp3.1
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/GamePlatformDemo.Entities/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using GamePlatformDemo.Entities.Concrete;
4 |
5 | namespace GamePlatformDemo.Entities
6 | {
7 | class Program
8 | {
9 | static void Main(string[] args)
10 | {
11 |
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/GamePlatformDemo.DataAccess/Abstract/IMemberCheckService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using GamePlatformDemo.Entities.Concrete;
5 |
6 | namespace GamePlatformDemo.DataAccess.Abstract
7 | {
8 | public interface IMemberCheckService
9 | {
10 | bool CheckIsRealPerson(Member member);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/GamePlatformDemo.DataAccess/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using GamePlatformDemo.DataAccess.Concrete;
4 | using GamePlatformDemo.Entities.Concrete;
5 |
6 | namespace GamePlatformDemo.DataAccess
7 | {
8 | class Program
9 | {
10 | static void Main(string[] args)
11 | {
12 |
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/GamePlatformDemo.Entities/Abstract/IEntity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace GamePlatformDemo.Entities.Abstract
6 | {
7 | // Bu dosya interface yapısı yardımıyla varlıklar arası bir arayüz oluşturmaktadır ve ortak özelliklerin implemente edilmesini sağlamaktadır.
8 | public interface IEntity
9 | {
10 | public int Id { get; set; }
11 | public string Name { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/GamePlatformDemo.Business/GamePlatformDemo.Business.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | netcoreapp3.1
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/GamePlatformDemo.DataAccess/Concrete/MemberCheckManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using GamePlatformDemo.DataAccess.Abstract;
5 | using GamePlatformDemo.Entities.Concrete;
6 | using MernisServiceReference;
7 |
8 | namespace GamePlatformDemo.DataAccess.Concrete
9 | {
10 | public class MemberCheckManager:IMemberCheckService
11 | {
12 | public bool CheckIsRealPerson(Member member)
13 | {
14 | return true;
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/GamePlatformDemo.Business/Abstract/ISignUp.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using GamePlatformDemo.Entities.Concrete;
5 |
6 | namespace GamePlatformDemo.Business.Abstract
7 | {
8 | public interface IAccountManagement
9 | {
10 | // AccountManager'da gerçekleşecek olan hesap işlemleri burada tanımlanmıştır.
11 | void SignUp(Member member);
12 | void DeleteAccount(int id);
13 | void UpdateAccount(int id,Member member);
14 | void ListAccounts();
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/GamePlatformDemo.Business/Abstract/ICouponService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using GamePlatformDemo.Entities.Concrete;
5 |
6 | namespace GamePlatformDemo.Business.Abstract
7 | {
8 | public interface ICouponService
9 | {
10 | // CampaignCouponManager içerisindeki metodlar burada tanımlanmıştır.
11 | void DefineNewCoupon(CampaignCoupon coupon);
12 | void UpdateCoupon(int id, CampaignCoupon coupon);
13 | void DeleteCoupon(int id);
14 | void ListCoupons();
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/GamePlatformDemo.Business/Abstract/ISaleService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using GamePlatformDemo.Entities.Concrete;
5 |
6 | namespace GamePlatformDemo.Business.Abstract
7 | {
8 | public interface ISaleService
9 | {
10 | // SalesManager içerisinde satış kısmında kullanılacak olan fonksiyonlar burada tanımlanmıştır.
11 | public int Discount(CampaignCoupon coupon);
12 | void BuyGame(GameEdition edition, Member customer,int discount);
13 | void Refund(Sale sale);
14 | void ListSales();
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/GamePlatformDemo.Entities/Concrete/CampaignCoupon.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using GamePlatformDemo.Entities.Abstract;
5 |
6 | namespace GamePlatformDemo.Entities.Concrete
7 | {
8 | // Bu dosya kampanyaya ait bilgileri tutmaktadır.
9 | public class CampaignCoupon:IEntity
10 | {
11 | public int Id { get; set; } // Deal Id : Kampanya numarası
12 | public string Name { get; set; } // Deal Name : Kuponun adı
13 |
14 | public int Discount { get; set; } // Deal discount : İndirim oranı % (yüzdesi)
15 |
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/GamePlatformDemo.Entities/Concrete/Sale.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using GamePlatformDemo.Entities.Abstract;
5 |
6 | namespace GamePlatformDemo.Entities.Concrete
7 | {
8 | public class Sale:IEntity
9 | {
10 | public int Id { get; set; } // Satış Id'si
11 |
12 | public string Name { get; set; } // Kime satıldığını Mr./Mrs. Arpacıoğlu olarak döndüreceğiz
13 |
14 | public int GameEditionId { get; set; } // Game Edition Id 1. Basic, 2.Premium, 3.Legendary
15 | public int CustomerId { get; set; } // Customer Id: Müşteri Id'si
16 |
17 | public double Price { get; set; } // Satış fiyatı
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/GamePlatformDemo.DataAccess/Abstract/IEntityRepository.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq.Expressions;
4 | using System.Text;
5 | using GamePlatformDemo.Entities.Abstract;
6 |
7 | namespace GamePlatformDemo.DataAccess.Abstract
8 | {
9 | public interface IEntityRepository where T : IEntity, new()
10 |
11 | // Burada T'nin bir IEntity olduğunu ve yenilenebilir bir yapıda referans bir tip olduğu kısıtlamasını getiriyoruz.
12 | // Olası yanlış eklemelere karşı defensive programming.
13 |
14 | {
15 | T GetById(int id);
16 | void GetAll();
17 | void Add(T entity);
18 | void Update(int id,T entity);
19 | void Delete(int id);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/GamePlatformDemo.Entities/Concrete/GameEdition.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using GamePlatformDemo.Entities.Abstract;
5 |
6 | namespace GamePlatformDemo.Entities.Concrete
7 | {
8 | // Bu dosya oyun detaylarına ait bilgileri tutmaktadır.
9 | public class GameEdition:IEntity
10 | {
11 | public int Id { get; set; } // Edition Id : 3 adet oyun versiyonu vardır. Bunlar içi
12 | public string Name { get; set; } // Edition Name : Basic, Premium ve Legendary olmak üzere üç adet edition vardır.
13 |
14 | public double Price { get; set; } // Edition Price : Yukarıda belirtilen farklı planlar için farklı ödemeler gerçekleştirilecektir.
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/GamePlatformDemo.DataAccess/Connected Services/MernisServiceReference/ConnectedService.json:
--------------------------------------------------------------------------------
1 | {
2 | "ProviderId": "Microsoft.VisualStudio.ConnectedService.Wcf",
3 | "Version": "15.0.40203.910",
4 | "GettingStartedDocument": {
5 | "Uri": "https://go.microsoft.com/fwlink/?linkid=858517"
6 | },
7 | "ExtendedData": {
8 | "inputs": [
9 | "https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx?wsdl"
10 | ],
11 | "collectionTypes": [
12 | "System.Array",
13 | "System.Collections.Generic.Dictionary`2"
14 | ],
15 | "namespaceMappings": [
16 | "*, MernisServiceReference"
17 | ],
18 | "references": [
19 | "C:\\Users\\YiğitArpacıoğlu\\Desktop\\YİĞİT\\YAZILIM\\GamePlatformDemo\\GamePlatformDemo.DataAccess\\bin\\Debug\\netcoreapp3.1\\GamePlatformDemo.Entities.dll"
20 | ],
21 | "targetFramework": "netcoreapp3.1",
22 | "typeReuseMode": "All"
23 | }
24 | }
--------------------------------------------------------------------------------
/GamePlatformDemo.DataAccess/GamePlatformDemo.DataAccess.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | netcoreapp3.1
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/GamePlatformDemo.Entities/Concrete/Member.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using GamePlatformDemo.Entities.Abstract;
5 |
6 | namespace GamePlatformDemo.Entities.Concrete
7 | {
8 | // Bu dosya müşteriye ait bilgileri tutmaktadır.
9 | public class Member:IEntity
10 | {
11 | public int Id { get; set; } // Customer Id : Müşteri için oyun firması tarafından verilen müşteri numarası
12 | public string Name { get; set; } // First name of Customer : Müşteri adı
13 |
14 |
15 | public string Lastname { get; set; } // Last name of Customer : Müşteri soyadı
16 |
17 |
18 | public long TC { get; set; } // ID number of Customer : Müşteri TC Kimlik numarası
19 | public DateTime DateOfBirth { get; set; } // Birth Date of Customer : Müşteri doğum tarihi
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/GamePlatformDemo.DataAccess/Adapters/MernisServiceAdapter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Threading.Tasks;
5 | using GamePlatformDemo.DataAccess.Abstract;
6 | using GamePlatformDemo.Entities.Concrete;
7 | using MernisServiceReference;
8 |
9 | namespace GamePlatformDemo.DataAccess.Adapters
10 | {
11 | public class MernisServiceAdapter:IMemberCheckService
12 | {
13 | public bool CheckIsRealPerson(Member member)
14 | {
15 | return TaskAsync(member).Result;
16 | }
17 |
18 | public static async Task TaskAsync(Member member)
19 | {
20 | KPSPublicSoapClient client =
21 | new KPSPublicSoapClient(KPSPublicSoapClient.EndpointConfiguration.KPSPublicSoap12);
22 | var status = await (client.TCKimlikNoDogrulaAsync(member.TC, member.Name.ToUpper(),
23 | member.Lastname.ToUpper(), member.DateOfBirth.Year));
24 | return status.Body.TCKimlikNoDogrulaResult;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/GamePlatformDemo.Business/Concrete/AccountManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using GamePlatformDemo.Business.Abstract;
5 | using GamePlatformDemo.DataAccess.Concrete;
6 | using GamePlatformDemo.Entities.Concrete;
7 |
8 | namespace GamePlatformDemo.Business.Concrete
9 | {
10 | public class AccountManager:IAccountManagement
11 | {
12 | private MemberDal _memberDal;
13 |
14 | public AccountManager(MemberDal memberDal)
15 | {
16 | _memberDal = memberDal;
17 | }
18 | public void SignUp(Member member)
19 | {
20 | _memberDal.Add(member);
21 | }
22 |
23 | public void UpdateAccount(int id,Member member)
24 | {
25 | _memberDal.Update(id, member);
26 | }
27 |
28 | public void ListAccounts()
29 | {
30 | _memberDal.GetAll();
31 | }
32 |
33 | public void DeleteAccount(int id)
34 | {
35 | _memberDal.Delete(id);
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/GamePlatformDemo.Business/Concrete/CampaignCouponManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using GamePlatformDemo.Business.Abstract;
5 | using GamePlatformDemo.DataAccess.Concrete;
6 | using GamePlatformDemo.Entities.Concrete;
7 |
8 | namespace GamePlatformDemo.Business.Concrete
9 | {
10 | public class CampaignCouponManager:ICouponService
11 | {
12 | private CampaignCouponDal _campaignCouponDal;
13 |
14 | public CampaignCouponManager(CampaignCouponDal campaignCouponDal)
15 | {
16 | _campaignCouponDal = campaignCouponDal;
17 | }
18 |
19 | public void DefineNewCoupon(CampaignCoupon coupon)
20 | {
21 | _campaignCouponDal.Add(coupon);
22 | }
23 |
24 | public void UpdateCoupon(int id, CampaignCoupon coupon)
25 | {
26 | _campaignCouponDal.Update(id,coupon);
27 | }
28 |
29 | public void DeleteCoupon(int id)
30 | {
31 | _campaignCouponDal.Delete(id);
32 | }
33 |
34 | public void ListCoupons()
35 | {
36 | _campaignCouponDal.GetAll();
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # GamePlatformDemo
2 | Kod içerisinde de elimden geldiği kadar yorum eklemeye çalıştım.
3 |
4 | Uygulamada bir oyun için çeşitli planlar bulunmaktadır. (Ben 3 tane ekledim dilerseniz Business katmanındaki Program.cs içerisinde ekleyebilirsiniz.)
5 | Tanımlanan farklı kuponlarla seçilen plana göre indirim uygulanmaktadır.
6 | Kullanıcalar oyun platformuna ücretsiz hesap açabilmektedirler (members).
7 | Satın alımlar sonucunda alım yapan üyeler müşteri listesine eklenmektedir.(customers)
8 | Not: İki liste de Member türündedir.
9 |
10 | Tanımlanan kuponlar da ayrı bir listede tutulmaktadır.(coupons)
11 | Satışlar ayrı bir listede tutulmaktadır.(salesList)
12 |
13 | Mimari 3 katmandan oluşmaktadır:
14 | # 1. GamePlatformDemo.Entities
15 | Burada property tutan sınıflarım bulunmaktadır.
16 | Ortak özellikleri IEntity şeklinde bir interface aracılığıyla kazandırmaktayım.
17 | # 2. GamePlatformDemo.DataAccess
18 | Normal projeler içerisinde de Visual Studio ve Database arasındaki bağlantıları bu katmanda gerçekleştiğinden, ben de listelerimin kullanımını bu alanda sağlamaya çalıştım.
19 | Ayrıca bir validasyon aracı olan Mernis'i de projeye bu alanda yerleştirdim.
20 | # 3. GamePlatformDemo.Business
21 | Business katmanında ise, nihai hedefim olan satın alım, indirim, hesap hareketleri gibi aktiviteleri bu katmanda sağladım.
22 |
23 | Detaylar için projeye göz atmanız daha iyi olacaktır.
24 |
--------------------------------------------------------------------------------
/GamePlatformDemo.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30804.86
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GamePlatformDemo.Entities", "GamePlatformDemo.Entities\GamePlatformDemo.Entities.csproj", "{D05E9631-5985-441B-BC26-599617BBB453}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GamePlatformDemo.DataAccess", "GamePlatformDemo.DataAccess\GamePlatformDemo.DataAccess.csproj", "{A9BEDFFF-FDBB-4087-B30B-6B321AA0E517}"
9 | EndProject
10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GamePlatformDemo.Business", "GamePlatformDemo.Business\GamePlatformDemo.Business.csproj", "{73943829-C4AD-474E-8A27-D52EC5147755}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Release|Any CPU = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {D05E9631-5985-441B-BC26-599617BBB453}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {D05E9631-5985-441B-BC26-599617BBB453}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {D05E9631-5985-441B-BC26-599617BBB453}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {D05E9631-5985-441B-BC26-599617BBB453}.Release|Any CPU.Build.0 = Release|Any CPU
22 | {A9BEDFFF-FDBB-4087-B30B-6B321AA0E517}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {A9BEDFFF-FDBB-4087-B30B-6B321AA0E517}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {A9BEDFFF-FDBB-4087-B30B-6B321AA0E517}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {A9BEDFFF-FDBB-4087-B30B-6B321AA0E517}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {73943829-C4AD-474E-8A27-D52EC5147755}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {73943829-C4AD-474E-8A27-D52EC5147755}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {73943829-C4AD-474E-8A27-D52EC5147755}.Release|Any CPU.ActiveCfg = Release|Any CPU
29 | {73943829-C4AD-474E-8A27-D52EC5147755}.Release|Any CPU.Build.0 = Release|Any CPU
30 | EndGlobalSection
31 | GlobalSection(SolutionProperties) = preSolution
32 | HideSolutionNode = FALSE
33 | EndGlobalSection
34 | GlobalSection(ExtensibilityGlobals) = postSolution
35 | SolutionGuid = {14704F22-9321-43CD-A351-A3C498956E79}
36 | EndGlobalSection
37 | EndGlobal
38 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/GamePlatformDemo.DataAccess/Concrete/CampaignCouponDal.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Net.Sockets;
5 | using System.Text;
6 | using System.Threading;
7 | using GamePlatformDemo.DataAccess.Abstract;
8 | using GamePlatformDemo.Entities.Concrete;
9 |
10 | namespace GamePlatformDemo.DataAccess.Concrete
11 | {
12 | public class CampaignCouponDal : IEntityRepository
13 | {
14 | private List _coupons; // Verilerin tutulması için bir liste oluşturulmuştur. Database ile olan
15 | // bağlantıyı DataAccess kısmında kurduğumuz için, ben de listeleri database
16 | // gibi burada kullandım.
17 |
18 | public CampaignCouponDal(List coupons)
19 | {
20 | _coupons = coupons;
21 | }
22 | public CampaignCoupon GetById(int id)
23 | {
24 | return _coupons[id - 1]; // return değeri kullanım sırasında ekrana yazdıralarak kontrol edilebilir.
25 | // Id sırası 1 den başladığı için -1 işlemi yapılmıştır.
26 |
27 | }
28 |
29 | public void GetAll()
30 | {
31 | Console.WriteLine("\nExisting coupons in system:\n");
32 | Console.WriteLine("\n------------------------------\n");
33 | foreach (var coupon in _coupons)
34 | {
35 | Console.WriteLine(coupon.Id + ". %" + coupon.Discount+" " + coupon.Name + "\n\t");
36 | // Kampanya listesini GetAll() metodu yardımıyla, "1. Kampanya İsmi
37 | // Açıklama: ..." şeklinde print ediyor olacağız
38 | }
39 | Console.WriteLine("\n------------------------------\n");
40 | }
41 |
42 | public void Add(CampaignCoupon coupon)
43 | {
44 | _coupons.Add(coupon); // Ekleme işlemi
45 | Console.WriteLine("New coupon has been defined\n");
46 | }
47 |
48 | public void Update(int id, CampaignCoupon coupon)
49 | {
50 |
51 | _coupons[id - 1] = coupon;
52 | Console.WriteLine(_coupons[id - 1].Name+" has been updated\n");
53 | // Listeden kullanıcı tarafından güncellenmesi istenen değerin id'sini kullanarak
54 | // mevcut değerin yerine yeni bir kullanıcı tanımlayıp, yeni özellikler girerek güncellenecektir.
55 | }
56 |
57 | public void Delete(int id)
58 | {
59 | Console.WriteLine(_coupons[id-1].Name +" has been deleted from system\n");
60 | _coupons.Remove(_coupons[id - 1]); // Listeden kullanıcı tarafından silinmesi istenen değerin id'sini kullanarak
61 | // mevcut değerin yerine yeni bir kullanıcı tanımlayıp, yeni özellikler girerek silinecektir.
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/GamePlatformDemo.DataAccess/Concrete/MemberDal.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using GamePlatformDemo.DataAccess.Abstract;
4 | using GamePlatformDemo.Entities.Concrete;
5 |
6 | namespace GamePlatformDemo.DataAccess.Concrete
7 | {
8 | public class MemberDal:IEntityRepository
9 | {
10 | private List _members; // Verilerin tutulması için bir liste oluşturulmuştur. Database ile olan
11 | // bağlantıyı DataAccess kısmında kurduğumuz için, ben de listeleri database
12 | // gibi burada kullandım.
13 | private IMemberCheckService _memberCheckService;
14 | public MemberDal(List members, IMemberCheckService memberCheckService)
15 | {
16 | _members = members; // Constructor yardımıyla main'de oluşturacağımız liste yardımıyla oyuncuları bir listede tutacağız.
17 | // İleride bunu database yardımıyla sağlıyor olacağız.
18 | _memberCheckService = memberCheckService;
19 |
20 | }
21 | public Member GetById(int id)
22 | {
23 | return _members[id - 1]; // Verilen ID numarası ile arama yapılıyor.
24 | }
25 |
26 | public void GetAll()
27 | {
28 | Console.WriteLine("\nExisting members in database:\n");
29 | Console.WriteLine("\n---------------------------- \n");
30 | foreach (var player in _members)
31 | {
32 | Console.WriteLine(player.Id+". "+ player.Name+" "+player.Lastname+" Birth Year: "+player.DateOfBirth.Year);
33 | // Oyuncu listesini GetAll() metodu yardımıyla, "1. Yiğit Arpacıoğlu Birth Year: 1995" şeklinde print ediyor olacağız
34 | }
35 | Console.WriteLine("\n------------------------------\n");
36 | }
37 |
38 | public void Add(Member member)
39 | {
40 | if (_memberCheckService.CheckIsRealPerson(member) == true)
41 | {
42 | _members.Add(member); // Ekleme işlemi
43 | Console.WriteLine("\nWelcome to our community " + member.Name + "\n");
44 | }
45 | else
46 | {
47 | throw new Exception("This person does NOT exist in MERNIS");
48 | }
49 | }
50 |
51 | public void Update(int id, Member member)
52 | {
53 | Console.WriteLine("\nYour account has been updated " + member.Name + "\n");
54 | _members[id - 1] = member; // Listeden kullanıcı tarafından güncellenmesi istenen değerin id'sini kullanarak
55 | // mevcut değerin yerine yeni bir kullanıcı tanımlayıp, yeni özellikler girerek güncellenecektir.
56 | }
57 |
58 | public void Delete(int id)
59 | {
60 | Console.WriteLine("\nWe are upset to hear that you are leaving "+_members[id - 1].Name+"\n");
61 | _members.Remove(_members[id-1]); // Listeden kullanıcı tarafından silinmesi istenen değerin id'sini kullanarak
62 | // mevcut değerin yerine yeni bir kullanıcı tanımlayıp, yeni özellikler girerek silinecektir.
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/GamePlatformDemo.Business/Concrete/SaleManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Net.Http;
4 | using System.Text;
5 | using GamePlatformDemo.Business.Abstract;
6 | using GamePlatformDemo.DataAccess.Concrete;
7 | using GamePlatformDemo.Entities.Concrete;
8 |
9 | namespace GamePlatformDemo.Business.Concrete
10 | {
11 | public class SaleManager:ISaleService // Interface aracılığıyla gerekli fonksiyonlar aşağıda implemente edilmiştir.
12 | {
13 | private List _salesList; // Yine satışların sembolik olarak kaydının tutulması adına liste oluşturuldu.
14 | private List _customerList; // Ayrıca ücretsiz hesap açan üyeliklerin(members) satın alım yapması durumunda
15 | private MemberDal _memberDal; // müşteri listesine ekleme yapıldı.
16 |
17 | private int sales=1; // Local kullanımda tricky yöntem için gerekli bir değişken.
18 |
19 | public SaleManager(List salesList, List customerList, MemberDal memberDal)
20 | {
21 | _salesList = salesList; // constructor vasıtasıyla kullanım sırasında alınacak olan listelerin eşitlenme aşaması
22 | _customerList = customerList;
23 | _memberDal = memberDal;
24 | }
25 |
26 | public void BuyGame(GameEdition edition, Member customer, int discount=0) // Satın alım metodu
27 | {
28 |
29 | edition.Price -= edition.Price * discount / 100; // Olası bir kupona karşı indirim hesaplaması
30 | _salesList.Add(new Sale
31 | {
32 | Name = edition.Name,
33 | GameEditionId = edition.Id,
34 | CustomerId = customer.Id,
35 | Id = sales,
36 | Price = edition.Price // Satın alımın satış geçmişi listesine eklenmesi
37 | });
38 | sales++; //Yukarıda belirtilen sales değişkeni yeni satış Id'sini belirlemektedir.
39 | Console.WriteLine("\n"+customer.Name + ", bought " + edition.Name + " edition for " + edition.Price+ " TL\n");
40 | if (!_customerList.Contains(customer))
41 | {
42 | _customerList.Add(customer); // Satış yapıldığı için formatında oluşturulan Customers listesine müşteri kaydedildi
43 | // Fakat müşteri liste içerisinde mevcut ise kaydedilmiyor.
44 | }
45 | }
46 |
47 | public void Refund(Sale sale)
48 | {
49 | Console.WriteLine("\n"+"Sale with Id: " + sale.Id + " has been refunded to customer(ID="+sale.CustomerId+")"+ "\n");
50 | _salesList.Remove(_salesList[sale.Id-1]); // İade durumunda satış listeden çıkarılıyor.
51 | }
52 |
53 | public void ListSales()
54 | {
55 | foreach (var sale in _salesList)
56 | {
57 | Console.WriteLine(sale.Id+". "+"Customer: "+_customerList[sale.Id-1]+""+sale.GameEditionId);
58 | }
59 | }
60 |
61 | public int Discount(CampaignCoupon coupon)
62 | {
63 | Console.WriteLine("\n"+coupon.Name+" coupon has been approved\n");
64 | return coupon.Discount; // Uygulanan kupona göre indirim oranı int değeri olarak, oyun satın
65 | // alımı sırasında BuyGame metodunda kullanılmak üzere geri döndürülüyor.
66 | }
67 |
68 | // Net kullanımını Business modülü içerisindeki main programında bulabilirsiniz.
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/GamePlatformDemo.Business/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel.Design.Serialization;
4 | using GamePlatformDemo.Business.Concrete;
5 | using GamePlatformDemo.DataAccess.Abstract;
6 | using GamePlatformDemo.DataAccess.Adapters;
7 | using GamePlatformDemo.DataAccess.Concrete;
8 | using GamePlatformDemo.Entities.Concrete;
9 |
10 | namespace GamePlatformDemo.Business
11 | {
12 | class Program
13 | {
14 | static void Main(string[] args)
15 | {
16 | List members = new List(); // Standart üyelikler için liste oluşturuldu.
17 | MernisServiceAdapter adapter = new MernisServiceAdapter();
18 | MemberDal memberDal = new MemberDal(members, adapter); // Listelere ulaşımda gerekli olan MemberDal instance'ı oluşturuldu.
19 | AccountManager accountManager = new AccountManager(memberDal); // Hesap yönetimi için gerekli olan nihai araç, accountManager'a
20 |
21 |
22 |
23 | accountManager.SignUp(new Member() // Listeye başlangıç ataması için bir adet üye atandı.
24 | {
25 | DateOfBirth = new DateTime(1995, 3, 12),
26 | Id = 1,
27 | Name = "Yiğit",
28 | Lastname = "Arpacıoğlu",
29 | TC = 1111111111 // Hata alınmaması adına gerçek kullanıcı bilgileri girilmelidir.
30 | });
31 |
32 | accountManager.ListAccounts();
33 |
34 |
35 | // ait bir instance oluşturuldu.
36 |
37 | //accountManager.SignUp(new Member()
38 | //{
39 | // DateOfBirth = new DateTime(1994, 2, 23),
40 | // Id = 2,
41 | // Name = "AAAA",
42 | // Lastname = "BBBBBB",
43 | // TC = 12345678912
44 | //});
45 |
46 | //accountManager.SignUp(new Member()
47 | //{
48 | // DateOfBirth = new DateTime(1995, 9, 11),
49 | // Id = 3,
50 | // Name = "CCCCCC",
51 | // Lastname = "DDDDDDD",
52 | // TC = 98765432198
53 | //}); // Yeni üyeler eklenebilir. Fakat hatalı üyelerin MERNIS'e takılabileceği göz önünde bulundurulmalıdır.
54 |
55 | accountManager.UpdateAccount(1, new Member()
56 | {
57 | DateOfBirth = new DateTime(1995, 3, 12),
58 | Id = 1,
59 | Name = "Yiğit",
60 | Lastname = "Arpacıoğlu",
61 | TC = 11111111111111 // Hata alınmaması adına gerçek kullanıcı bilgileri girilmelidir.
62 | }); ; // güncelleme işlemi yapıldı.
63 |
64 | // accountManager.DeleteAccount(3); // hesap silindi.
65 |
66 | accountManager.ListAccounts();
67 |
68 | List coupons = new List()
69 | {
70 | new CampaignCoupon()
71 | {
72 | Id = 1,
73 | Discount = 35,
74 | Name = "Spring Deal"
75 | },
76 | new CampaignCoupon()
77 | {
78 | Id = 2,
79 | Discount = 15,
80 | Name = "Halloween Deal"
81 | },
82 | new CampaignCoupon()
83 | {
84 | Id = 3,
85 | Discount = 70,
86 | Name = "New eve coupon"
87 | }
88 | }; // Kampanyalar oluşturuldu.
89 |
90 | CampaignCouponDal campaignCouponDal = new CampaignCouponDal(coupons);
91 | CampaignCouponManager campaignCouponManager = new CampaignCouponManager(campaignCouponDal);
92 |
93 | campaignCouponManager.DefineNewCoupon(new CampaignCoupon()
94 | {
95 | Id = 4,
96 | Discount = 10,
97 | Name = "New membership discount(Valid for 15 days)"
98 | });
99 | campaignCouponManager.DeleteCoupon(4);
100 | campaignCouponManager.ListCoupons();
101 | List gameEdition = new List()
102 | {
103 | new GameEdition()
104 | {
105 | Id = 1,
106 | Name = "Basic",
107 | Price = 80,
108 | },
109 | new GameEdition()
110 | {
111 | Id = 2,
112 | Name = "Premium",
113 | Price = 125,
114 | },
115 | new GameEdition()
116 | {
117 | Id = 3,
118 | Name = "Legendary",
119 | Price = 155,
120 | }
121 | }; // oyun sürümleri tanımlandı.
122 |
123 |
124 | List salesList = new List(); // yeni bir satış listesi oluşturuldu
125 | List customers = new List(); // Satın alım yapan üyelikler için müşteri listesi tanımlandı.
126 | SaleManager saleManager = new SaleManager(salesList, customers, memberDal) { };
127 | saleManager.ListSales(); // tüm elemanlar listelendi.
128 | int discount = saleManager.Discount(coupons[1]); // Discount fonksiyonu ile kupon seçimi yapıldı.
129 | // Liste elemanı ile seçim yapıldığı için sıralamanın 0'dan başladığı düşünülmelidir.
130 | saleManager.BuyGame(gameEdition[0], members[0], discount); // Yine liste elemanları ile satın alım gerçekleştirildi.
131 | saleManager.Refund(salesList[0]); // Satın alınan ürün geri iade edildi.tea
132 |
133 |
134 |
135 |
136 | }
137 | }
138 | }
139 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Build results
17 | [Dd]ebug/
18 | [Dd]ebugPublic/
19 | [Rr]elease/
20 | [Rr]eleases/
21 | x64/
22 | x86/
23 | [Aa][Rr][Mm]/
24 | [Aa][Rr][Mm]64/
25 | bld/
26 | [Bb]in/
27 | [Oo]bj/
28 | [Ll]og/
29 |
30 | # Visual Studio 2015/2017 cache/options directory
31 | .vs/
32 | # Uncomment if you have tasks that create the project's static files in wwwroot
33 | #wwwroot/
34 |
35 | # Visual Studio 2017 auto generated files
36 | Generated\ Files/
37 |
38 | # MSTest test Results
39 | [Tt]est[Rr]esult*/
40 | [Bb]uild[Ll]og.*
41 |
42 | # NUNIT
43 | *.VisualState.xml
44 | TestResult.xml
45 |
46 | # Build Results of an ATL Project
47 | [Dd]ebugPS/
48 | [Rr]eleasePS/
49 | dlldata.c
50 |
51 | # Benchmark Results
52 | BenchmarkDotNet.Artifacts/
53 |
54 | # .NET Core
55 | project.lock.json
56 | project.fragment.lock.json
57 | artifacts/
58 |
59 | # StyleCop
60 | StyleCopReport.xml
61 |
62 | # Files built by Visual Studio
63 | *_i.c
64 | *_p.c
65 | *_h.h
66 | *.ilk
67 | *.meta
68 | *.obj
69 | *.iobj
70 | *.pch
71 | *.pdb
72 | *.ipdb
73 | *.pgc
74 | *.pgd
75 | *.rsp
76 | *.sbr
77 | *.tlb
78 | *.tli
79 | *.tlh
80 | *.tmp
81 | *.tmp_proj
82 | *_wpftmp.csproj
83 | *.log
84 | *.vspscc
85 | *.vssscc
86 | .builds
87 | *.pidb
88 | *.svclog
89 | *.scc
90 |
91 | # Chutzpah Test files
92 | _Chutzpah*
93 |
94 | # Visual C++ cache files
95 | ipch/
96 | *.aps
97 | *.ncb
98 | *.opendb
99 | *.opensdf
100 | *.sdf
101 | *.cachefile
102 | *.VC.db
103 | *.VC.VC.opendb
104 |
105 | # Visual Studio profiler
106 | *.psess
107 | *.vsp
108 | *.vspx
109 | *.sap
110 |
111 | # Visual Studio Trace Files
112 | *.e2e
113 |
114 | # TFS 2012 Local Workspace
115 | $tf/
116 |
117 | # Guidance Automation Toolkit
118 | *.gpState
119 |
120 | # ReSharper is a .NET coding add-in
121 | _ReSharper*/
122 | *.[Rr]e[Ss]harper
123 | *.DotSettings.user
124 |
125 | # JustCode is a .NET coding add-in
126 | .JustCode
127 |
128 | # TeamCity is a build add-in
129 | _TeamCity*
130 |
131 | # DotCover is a Code Coverage Tool
132 | *.dotCover
133 |
134 | # AxoCover is a Code Coverage Tool
135 | .axoCover/*
136 | !.axoCover/settings.json
137 |
138 | # Visual Studio code coverage results
139 | *.coverage
140 | *.coveragexml
141 |
142 | # NCrunch
143 | _NCrunch_*
144 | .*crunch*.local.xml
145 | nCrunchTemp_*
146 |
147 | # MightyMoose
148 | *.mm.*
149 | AutoTest.Net/
150 |
151 | # Web workbench (sass)
152 | .sass-cache/
153 |
154 | # Installshield output folder
155 | [Ee]xpress/
156 |
157 | # DocProject is a documentation generator add-in
158 | DocProject/buildhelp/
159 | DocProject/Help/*.HxT
160 | DocProject/Help/*.HxC
161 | DocProject/Help/*.hhc
162 | DocProject/Help/*.hhk
163 | DocProject/Help/*.hhp
164 | DocProject/Help/Html2
165 | DocProject/Help/html
166 |
167 | # Click-Once directory
168 | publish/
169 |
170 | # Publish Web Output
171 | *.[Pp]ublish.xml
172 | *.azurePubxml
173 | # Note: Comment the next line if you want to checkin your web deploy settings,
174 | # but database connection strings (with potential passwords) will be unencrypted
175 | *.pubxml
176 | *.publishproj
177 |
178 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
179 | # checkin your Azure Web App publish settings, but sensitive information contained
180 | # in these scripts will be unencrypted
181 | PublishScripts/
182 |
183 | # NuGet Packages
184 | *.nupkg
185 | # The packages folder can be ignored because of Package Restore
186 | **/[Pp]ackages/*
187 | # except build/, which is used as an MSBuild target.
188 | !**/[Pp]ackages/build/
189 | # Uncomment if necessary however generally it will be regenerated when needed
190 | #!**/[Pp]ackages/repositories.config
191 | # NuGet v3's project.json files produces more ignorable files
192 | *.nuget.props
193 | *.nuget.targets
194 |
195 | # Microsoft Azure Build Output
196 | csx/
197 | *.build.csdef
198 |
199 | # Microsoft Azure Emulator
200 | ecf/
201 | rcf/
202 |
203 | # Windows Store app package directories and files
204 | AppPackages/
205 | BundleArtifacts/
206 | Package.StoreAssociation.xml
207 | _pkginfo.txt
208 | *.appx
209 |
210 | # Visual Studio cache files
211 | # files ending in .cache can be ignored
212 | *.[Cc]ache
213 | # but keep track of directories ending in .cache
214 | !?*.[Cc]ache/
215 |
216 | # Others
217 | ClientBin/
218 | ~$*
219 | *~
220 | *.dbmdl
221 | *.dbproj.schemaview
222 | *.jfm
223 | *.pfx
224 | *.publishsettings
225 | orleans.codegen.cs
226 |
227 | # Including strong name files can present a security risk
228 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
229 | #*.snk
230 |
231 | # Since there are multiple workflows, uncomment next line to ignore bower_components
232 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
233 | #bower_components/
234 |
235 | # RIA/Silverlight projects
236 | Generated_Code/
237 |
238 | # Backup & report files from converting an old project file
239 | # to a newer Visual Studio version. Backup files are not needed,
240 | # because we have git ;-)
241 | _UpgradeReport_Files/
242 | Backup*/
243 | UpgradeLog*.XML
244 | UpgradeLog*.htm
245 | ServiceFabricBackup/
246 | *.rptproj.bak
247 |
248 | # SQL Server files
249 | *.mdf
250 | *.ldf
251 | *.ndf
252 |
253 | # Business Intelligence projects
254 | *.rdl.data
255 | *.bim.layout
256 | *.bim_*.settings
257 | *.rptproj.rsuser
258 | *- Backup*.rdl
259 |
260 | # Microsoft Fakes
261 | FakesAssemblies/
262 |
263 | # GhostDoc plugin setting file
264 | *.GhostDoc.xml
265 |
266 | # Node.js Tools for Visual Studio
267 | .ntvs_analysis.dat
268 | node_modules/
269 |
270 | # Visual Studio 6 build log
271 | *.plg
272 |
273 | # Visual Studio 6 workspace options file
274 | *.opt
275 |
276 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
277 | *.vbw
278 |
279 | # Visual Studio LightSwitch build output
280 | **/*.HTMLClient/GeneratedArtifacts
281 | **/*.DesktopClient/GeneratedArtifacts
282 | **/*.DesktopClient/ModelManifest.xml
283 | **/*.Server/GeneratedArtifacts
284 | **/*.Server/ModelManifest.xml
285 | _Pvt_Extensions
286 |
287 | # Paket dependency manager
288 | .paket/paket.exe
289 | paket-files/
290 |
291 | # FAKE - F# Make
292 | .fake/
293 |
294 | # JetBrains Rider
295 | .idea/
296 | *.sln.iml
297 |
298 | # CodeRush personal settings
299 | .cr/personal
300 |
301 | # Python Tools for Visual Studio (PTVS)
302 | __pycache__/
303 | *.pyc
304 |
305 | # Cake - Uncomment if you are using it
306 | # tools/**
307 | # !tools/packages.config
308 |
309 | # Tabs Studio
310 | *.tss
311 |
312 | # Telerik's JustMock configuration file
313 | *.jmconfig
314 |
315 | # BizTalk build output
316 | *.btp.cs
317 | *.btm.cs
318 | *.odx.cs
319 | *.xsd.cs
320 |
321 | # OpenCover UI analysis results
322 | OpenCover/
323 |
324 | # Azure Stream Analytics local run output
325 | ASALocalRun/
326 |
327 | # MSBuild Binary and Structured Log
328 | *.binlog
329 |
330 | # NVidia Nsight GPU debugger configuration file
331 | *.nvuser
332 |
333 | # MFractors (Xamarin productivity tool) working folder
334 | .mfractor/
335 |
336 | # Local History for Visual Studio
337 | .localhistory/
338 |
339 | # BeatPulse healthcheck temp database
340 | healthchecksdb
--------------------------------------------------------------------------------
/GamePlatformDemo.DataAccess/Connected Services/MernisServiceReference/Reference.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | //
5 | // Changes to this file may cause incorrect behavior and will be lost if
6 | // the code is regenerated.
7 | //
8 | //------------------------------------------------------------------------------
9 |
10 | namespace MernisServiceReference
11 | {
12 |
13 |
14 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
15 | [System.ServiceModel.ServiceContractAttribute(Namespace="http://tckimlik.nvi.gov.tr/WS", ConfigurationName="MernisServiceReference.KPSPublicSoap")]
16 | public interface KPSPublicSoap
17 | {
18 |
19 | [System.ServiceModel.OperationContractAttribute(Action="http://tckimlik.nvi.gov.tr/WS/TCKimlikNoDogrula", ReplyAction="*")]
20 | System.Threading.Tasks.Task TCKimlikNoDogrulaAsync(MernisServiceReference.TCKimlikNoDogrulaRequest request);
21 | }
22 |
23 | [System.Diagnostics.DebuggerStepThroughAttribute()]
24 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
25 | [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
26 | [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
27 | public partial class TCKimlikNoDogrulaRequest
28 | {
29 |
30 | [System.ServiceModel.MessageBodyMemberAttribute(Name="TCKimlikNoDogrula", Namespace="http://tckimlik.nvi.gov.tr/WS", Order=0)]
31 | public MernisServiceReference.TCKimlikNoDogrulaRequestBody Body;
32 |
33 | public TCKimlikNoDogrulaRequest()
34 | {
35 | }
36 |
37 | public TCKimlikNoDogrulaRequest(MernisServiceReference.TCKimlikNoDogrulaRequestBody Body)
38 | {
39 | this.Body = Body;
40 | }
41 | }
42 |
43 | [System.Diagnostics.DebuggerStepThroughAttribute()]
44 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
45 | [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
46 | [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tckimlik.nvi.gov.tr/WS")]
47 | public partial class TCKimlikNoDogrulaRequestBody
48 | {
49 |
50 | [System.Runtime.Serialization.DataMemberAttribute(Order=0)]
51 | public long TCKimlikNo;
52 |
53 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=1)]
54 | public string Ad;
55 |
56 | [System.Runtime.Serialization.DataMemberAttribute(EmitDefaultValue=false, Order=2)]
57 | public string Soyad;
58 |
59 | [System.Runtime.Serialization.DataMemberAttribute(Order=3)]
60 | public int DogumYili;
61 |
62 | public TCKimlikNoDogrulaRequestBody()
63 | {
64 | }
65 |
66 | public TCKimlikNoDogrulaRequestBody(long TCKimlikNo, string Ad, string Soyad, int DogumYili)
67 | {
68 | this.TCKimlikNo = TCKimlikNo;
69 | this.Ad = Ad;
70 | this.Soyad = Soyad;
71 | this.DogumYili = DogumYili;
72 | }
73 | }
74 |
75 | [System.Diagnostics.DebuggerStepThroughAttribute()]
76 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
77 | [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
78 | [System.ServiceModel.MessageContractAttribute(IsWrapped=false)]
79 | public partial class TCKimlikNoDogrulaResponse
80 | {
81 |
82 | [System.ServiceModel.MessageBodyMemberAttribute(Name="TCKimlikNoDogrulaResponse", Namespace="http://tckimlik.nvi.gov.tr/WS", Order=0)]
83 | public MernisServiceReference.TCKimlikNoDogrulaResponseBody Body;
84 |
85 | public TCKimlikNoDogrulaResponse()
86 | {
87 | }
88 |
89 | public TCKimlikNoDogrulaResponse(MernisServiceReference.TCKimlikNoDogrulaResponseBody Body)
90 | {
91 | this.Body = Body;
92 | }
93 | }
94 |
95 | [System.Diagnostics.DebuggerStepThroughAttribute()]
96 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
97 | [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
98 | [System.Runtime.Serialization.DataContractAttribute(Namespace="http://tckimlik.nvi.gov.tr/WS")]
99 | public partial class TCKimlikNoDogrulaResponseBody
100 | {
101 |
102 | [System.Runtime.Serialization.DataMemberAttribute(Order=0)]
103 | public bool TCKimlikNoDogrulaResult;
104 |
105 | public TCKimlikNoDogrulaResponseBody()
106 | {
107 | }
108 |
109 | public TCKimlikNoDogrulaResponseBody(bool TCKimlikNoDogrulaResult)
110 | {
111 | this.TCKimlikNoDogrulaResult = TCKimlikNoDogrulaResult;
112 | }
113 | }
114 |
115 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
116 | public interface KPSPublicSoapChannel : MernisServiceReference.KPSPublicSoap, System.ServiceModel.IClientChannel
117 | {
118 | }
119 |
120 | [System.Diagnostics.DebuggerStepThroughAttribute()]
121 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Tools.ServiceModel.Svcutil", "2.0.2")]
122 | public partial class KPSPublicSoapClient : System.ServiceModel.ClientBase, MernisServiceReference.KPSPublicSoap
123 | {
124 |
125 | ///
126 | /// Implement this partial method to configure the service endpoint.
127 | ///
128 | /// The endpoint to configure
129 | /// The client credentials
130 | static partial void ConfigureEndpoint(System.ServiceModel.Description.ServiceEndpoint serviceEndpoint, System.ServiceModel.Description.ClientCredentials clientCredentials);
131 |
132 | public KPSPublicSoapClient(EndpointConfiguration endpointConfiguration) :
133 | base(KPSPublicSoapClient.GetBindingForEndpoint(endpointConfiguration), KPSPublicSoapClient.GetEndpointAddress(endpointConfiguration))
134 | {
135 | this.Endpoint.Name = endpointConfiguration.ToString();
136 | ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
137 | }
138 |
139 | public KPSPublicSoapClient(EndpointConfiguration endpointConfiguration, string remoteAddress) :
140 | base(KPSPublicSoapClient.GetBindingForEndpoint(endpointConfiguration), new System.ServiceModel.EndpointAddress(remoteAddress))
141 | {
142 | this.Endpoint.Name = endpointConfiguration.ToString();
143 | ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
144 | }
145 |
146 | public KPSPublicSoapClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) :
147 | base(KPSPublicSoapClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress)
148 | {
149 | this.Endpoint.Name = endpointConfiguration.ToString();
150 | ConfigureEndpoint(this.Endpoint, this.ClientCredentials);
151 | }
152 |
153 | public KPSPublicSoapClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
154 | base(binding, remoteAddress)
155 | {
156 | }
157 |
158 | [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
159 | System.Threading.Tasks.Task MernisServiceReference.KPSPublicSoap.TCKimlikNoDogrulaAsync(MernisServiceReference.TCKimlikNoDogrulaRequest request)
160 | {
161 | return base.Channel.TCKimlikNoDogrulaAsync(request);
162 | }
163 |
164 | public System.Threading.Tasks.Task TCKimlikNoDogrulaAsync(long TCKimlikNo, string Ad, string Soyad, int DogumYili)
165 | {
166 | MernisServiceReference.TCKimlikNoDogrulaRequest inValue = new MernisServiceReference.TCKimlikNoDogrulaRequest();
167 | inValue.Body = new MernisServiceReference.TCKimlikNoDogrulaRequestBody();
168 | inValue.Body.TCKimlikNo = TCKimlikNo;
169 | inValue.Body.Ad = Ad;
170 | inValue.Body.Soyad = Soyad;
171 | inValue.Body.DogumYili = DogumYili;
172 | return ((MernisServiceReference.KPSPublicSoap)(this)).TCKimlikNoDogrulaAsync(inValue);
173 | }
174 |
175 | public virtual System.Threading.Tasks.Task OpenAsync()
176 | {
177 | return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(null, null), new System.Action(((System.ServiceModel.ICommunicationObject)(this)).EndOpen));
178 | }
179 |
180 | public virtual System.Threading.Tasks.Task CloseAsync()
181 | {
182 | return System.Threading.Tasks.Task.Factory.FromAsync(((System.ServiceModel.ICommunicationObject)(this)).BeginClose(null, null), new System.Action(((System.ServiceModel.ICommunicationObject)(this)).EndClose));
183 | }
184 |
185 | private static System.ServiceModel.Channels.Binding GetBindingForEndpoint(EndpointConfiguration endpointConfiguration)
186 | {
187 | if ((endpointConfiguration == EndpointConfiguration.KPSPublicSoap))
188 | {
189 | System.ServiceModel.BasicHttpBinding result = new System.ServiceModel.BasicHttpBinding();
190 | result.MaxBufferSize = int.MaxValue;
191 | result.ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max;
192 | result.MaxReceivedMessageSize = int.MaxValue;
193 | result.AllowCookies = true;
194 | result.Security.Mode = System.ServiceModel.BasicHttpSecurityMode.Transport;
195 | return result;
196 | }
197 | if ((endpointConfiguration == EndpointConfiguration.KPSPublicSoap12))
198 | {
199 | System.ServiceModel.Channels.CustomBinding result = new System.ServiceModel.Channels.CustomBinding();
200 | System.ServiceModel.Channels.TextMessageEncodingBindingElement textBindingElement = new System.ServiceModel.Channels.TextMessageEncodingBindingElement();
201 | textBindingElement.MessageVersion = System.ServiceModel.Channels.MessageVersion.CreateVersion(System.ServiceModel.EnvelopeVersion.Soap12, System.ServiceModel.Channels.AddressingVersion.None);
202 | result.Elements.Add(textBindingElement);
203 | System.ServiceModel.Channels.HttpsTransportBindingElement httpsBindingElement = new System.ServiceModel.Channels.HttpsTransportBindingElement();
204 | httpsBindingElement.AllowCookies = true;
205 | httpsBindingElement.MaxBufferSize = int.MaxValue;
206 | httpsBindingElement.MaxReceivedMessageSize = int.MaxValue;
207 | result.Elements.Add(httpsBindingElement);
208 | return result;
209 | }
210 | throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration));
211 | }
212 |
213 | private static System.ServiceModel.EndpointAddress GetEndpointAddress(EndpointConfiguration endpointConfiguration)
214 | {
215 | if ((endpointConfiguration == EndpointConfiguration.KPSPublicSoap))
216 | {
217 | return new System.ServiceModel.EndpointAddress("https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx");
218 | }
219 | if ((endpointConfiguration == EndpointConfiguration.KPSPublicSoap12))
220 | {
221 | return new System.ServiceModel.EndpointAddress("https://tckimlik.nvi.gov.tr/Service/KPSPublic.asmx");
222 | }
223 | throw new System.InvalidOperationException(string.Format("Could not find endpoint with name \'{0}\'.", endpointConfiguration));
224 | }
225 |
226 | public enum EndpointConfiguration
227 | {
228 |
229 | KPSPublicSoap,
230 |
231 | KPSPublicSoap12,
232 | }
233 | }
234 | }
235 |
--------------------------------------------------------------------------------