-
Notifications
You must be signed in to change notification settings - Fork 0
/
ERPXT.cs
241 lines (235 loc) · 10.5 KB
/
ERPXT.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
using System;
using System.Threading.Tasks;
using ERPXTpl.Model;
using ERPXTpl.Service;
using Microsoft.Extensions.Caching.Memory;
namespace ERPXTpl
{
public class ERPXT
{
public static string ClientID = string.Empty;
public static string SecretKey = string.Empty;
public static MemoryCache cache = new MemoryCache(new MemoryCacheOptions());
public ERPXT(string clientID, string secretKey)
{
ClientID = clientID;
SecretKey = secretKey;
cache.Set(CacheData.Expires, new DateTime());
}
public async Task<Result> GetBankAccount()
{
BankAccountService bankAccountService = new BankAccountService();
return await bankAccountService.GetBankAccount();
}
public async Task<Result> GetBankAccount(long bankAccountId)
{
BankAccountService bankAccountService = new BankAccountService();
return await bankAccountService.GetBankAccount(bankAccountId);
}
public async Task<Result> AddBankAccount(BankAccount bankAccount)
{
BankAccountService bankAccountService = new BankAccountService();
return await bankAccountService.AddBankAccount(bankAccount);
}
public async Task<Result> ModifyBankAccount(BankAccount bankAccount)
{
BankAccountService bankAccountService = new BankAccountService();
return await bankAccountService.ModifyBankAccount(bankAccount);
}
public async Task<Result> DeleteBankAccount(long bankAccountId)
{
BankAccountService bankAccountService = new BankAccountService();
return await bankAccountService.DeleteBankAccount(bankAccountId);
}
public async Task<Result> GetCustomer()
{
CustomerService customerService = new CustomerService();
return await customerService.GetCustomers();
}
public async Task<Result> GetCustomer(long customerId)
{
CustomerService customerService = new CustomerService();
return await customerService.GetCustomerById(customerId);
}
public async Task<Result> GetCustomer(string TIN)
{
CustomerService customerService = new CustomerService();
return await customerService.GetCustomerByTIN(TIN);
}
public async Task<Result> GetCustomerByEmail(string email)
{
CustomerService customerService = new CustomerService();
return await customerService.GetCustomersByEmail(email);
}
public async Task<Result> AddCustomer(Customer customer)
{
CustomerService customerService = new CustomerService();
return await customerService.AddCustomer(customer);
}
public async Task<Result> ModifyCustomer(Customer customer)
{
CustomerService customerService = new CustomerService();
return await customerService.ModifyCustomer(customer);
}
public async Task<Result> DeleteCustomer(long customerId)
{
CustomerService customerService = new CustomerService();
return await customerService.DeleteCustomer(customerId);
}
public async Task<Result> GetVatRates()
{
DictionaryDataService dictionaryDataService = new DictionaryDataService();
return await dictionaryDataService.GetVatRates();
}
public async Task<Result> GetCountries()
{
DictionaryDataService dictionaryDataService = new DictionaryDataService();
return await dictionaryDataService.GetCountries();
}
public async Task<Result> GetPaymentMethod()
{
PaymentMethodService paymentMethodService = new PaymentMethodService();
return await paymentMethodService.GetPaymentMethod();
}
public async Task<Result> GetPaymentMethod(long paymentMethodId)
{
PaymentMethodService paymentMethodService = new PaymentMethodService();
return await paymentMethodService.GetPaymentMethod(paymentMethodId);
}
public async Task<Result> AddPaymentMethod(PaymentMethod paymentMethod)
{
PaymentMethodService paymentMethodService = new PaymentMethodService();
return await paymentMethodService.AddPaymentMethod(paymentMethod);
}
public async Task<Result> ModifyPaymentMethod(PaymentMethod paymentMethod)
{
PaymentMethodService paymentMethodService = new PaymentMethodService();
return await paymentMethodService.ModifyPaymentMethod(paymentMethod);
}
public async Task<Result> DeletePaymentMethod(long paymentMethodId)
{
PaymentMethodService paymentMethodService = new PaymentMethodService();
return await paymentMethodService.DeletePaymentMethod(paymentMethodId);
}
public async Task<Result> GetPrintTemplates()
{
PrintService printService = new PrintService();
return await printService.GetPrintTemplates();
}
public async Task<Result> GetInvoicePrintByCustomer(long invoiceId)
{
PrintService printService = new PrintService();
return await printService.GetInvoicePrintByCustomer(invoiceId);
}
public async Task<Result> GetProformaPrintByCustomer(long invoiceId)
{
PrintService printService = new PrintService();
return await printService.GetProformaPrintByCustomer(invoiceId);
}
public async Task<Result> GetInvoiceCustomPrint(long invoiceId, long printTemplateId)
{
PrintService printService = new PrintService();
return await printService.GetInvoiceCustomPrint(invoiceId, printTemplateId);
}
public async Task<Result> GetProformaCustomPrint(long invoiceId, long printTemplateId)
{
PrintService printService = new PrintService();
return await printService.GetProformaCustomPrint(invoiceId, printTemplateId);
}
public async Task<Result> SavePrintToFile(string base64Print, string pathToSave)
{
PrintService printService = new PrintService();
return await printService.SavePrintToFile(base64Print, pathToSave);
}
public async Task<Result> GetProduct()
{
ProductService productService = new ProductService();
return await productService.GetProduct();
}
public async Task<Result> GetProduct(long productId)
{
ProductService productService = new ProductService();
return await productService.GetProduct(productId);
}
public async Task<Result> AddProduct(Product product)
{
ProductService productService = new ProductService();
return await productService.AddProduct(product);
}
public async Task<Result> ModifyProduct(Product product)
{
ProductService productService = new ProductService();
return await productService.ModifyProduct(product);
}
public async Task<Result> DeleteProduct(long productId)
{
ProductService productService = new ProductService();
return await productService.DeleteProduct(productId);
}
public async Task<Result> GetProformaInvoice()
{
ProformaInvoiceService proformaInvoiceService = new ProformaInvoiceService();
return await proformaInvoiceService.GetProformaInvoice();
}
public async Task<Result> GetProformaInvoice(long invoiceId)
{
ProformaInvoiceService proformaInvoiceService = new ProformaInvoiceService();
return await proformaInvoiceService.GetProformaInvoice(invoiceId);
}
public async Task<Result> GetProformaInvoice(bool converted)
{
ProformaInvoiceService proformaInvoiceService = new ProformaInvoiceService();
return await proformaInvoiceService.GetProformasFiltered(converted);
}
public async Task<Result> AddProformaInvoice(ProformaInvoice proformaInvoice)
{
ProformaInvoiceService proformaInvoiceService = new ProformaInvoiceService();
return await proformaInvoiceService.AddProformaInvoice(proformaInvoice);
}
public async Task<Result> ModifyProformaInvoice(ProformaInvoice proformaInvoice)
{
ProformaInvoiceService proformaInvoiceService = new ProformaInvoiceService();
return await proformaInvoiceService.ModifyProformaInvoice(proformaInvoice);
}
public async Task<Result> DeleteProformaInvoice(long invoiceId)
{
ProformaInvoiceService proformaInvoiceService = new ProformaInvoiceService();
return await proformaInvoiceService.DeleteProformaInvoice(invoiceId);
}
public async Task<Result> GetSalesInvoice()
{
SalesInvoiceService salesInvoiceService = new SalesInvoiceService();
return await salesInvoiceService.GetSalesInvoice();
}
public async Task<Result> GetSalesInvoice(long invoiceId)
{
SalesInvoiceService salesInvoiceService = new SalesInvoiceService();
return await salesInvoiceService.GetSalesInvoice(invoiceId);
}
public async Task<Result> GetSalesInvoice(string invoiceNumber)
{
SalesInvoiceService salesInvoiceService = new SalesInvoiceService();
return await salesInvoiceService.GetSalesInvoice(invoiceNumber);
}
public async Task<Result> GetLastInvoices(int numberOfInvoices)
{
SalesInvoiceService salesInvoiceService = new SalesInvoiceService();
return await salesInvoiceService.GetLastInvoices(numberOfInvoices);
}
public async Task<Result> AddSalesInvoice(SalesInvoice salesInvoice)
{
SalesInvoiceService salesInvoiceService = new SalesInvoiceService();
return await salesInvoiceService.AddSalesInvoice(salesInvoice);
}
public async Task<Result> ModifySalesInvoice(SalesInvoice salesInvoice)
{
SalesInvoiceService salesInvoiceService = new SalesInvoiceService();
return await salesInvoiceService.ModifySalesInvoice(salesInvoice);
}
public async Task<Result> DeleteSalesInvoice(long invoiceId)
{
SalesInvoiceService salesInvoiceService = new SalesInvoiceService();
return await salesInvoiceService.DeleteSalesInvoice(invoiceId);
}
}
}