LicenseModel.cs
27.6 KB
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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
using System;
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Web;
using System.Net.Mail;
using AIAHTML5.ADMIN.API.Entity;
using AIAHTML5.ADMIN.API.Custom;
namespace AIAHTML5.ADMIN.API.Models
{
public class LicenseModel
{
public int LicenseId { get; set; }
public string AccountNumber { get; set; }
public byte AccountTypeId { get; set; }
public string AccountTypeName { get; set; }
public string LicenseeFirstName { get; set; }
public string LicenseeLastName { get; set; }
public string LicenseeName { get; set; }
public byte LicenseTypeId { get; set; }
public string LicenseTypeName { get; set; }
public string InstitutionName { get; set; }
public int? StateId { get; set; }
public int? CountryId { get; set; }
public string LicenseState { get; set; }
public string Address { get; set; }
public string Address1 { get; set; }
public string Address2 { get; set; }
public string City { get; set; }
public string Zip { get; set; }
public string Phone { get; set; }
public string LicenseCountry { get; set; }
public string EmailId { get; set; }
public int? NoOfImages { get; set; }
public string ClientAdmin { get; set; }
public string ProductKey { get; set; }
public int? CardNumber { get; set; }
public DateTime SubscriptionStartDate { get; set; }
public DateTime SubscriptionEndDate { get; set; }
public DateTime EntryDate { get; set; }
public DateTime RenewDate { get; set; }
public DateTime ModifyDate { get; set; }
public bool IsActive { get; set; }
public string LicStatus { get; set; }
public int? TotalLogins { get; set; }
public string EditionLogins { get; set; }
public decimal Price { get; set; }
public string LoginId { get; set; }
public string Password { get; set; }
public byte? SecurityQuestionId { get; set; }
public string Answer { get; set; }
public int CreatorId { get; set; }
public int TotalRenewals { get; set; }
public string MasterSiteUrl { get; set; }
public string SiteUrlTo { get; set; }
public string SiteUrlFrom { get; set; }
public byte? TestLicenseEditionId { get; set; }
public bool IsRenew { get; set; }
public static List<LicenseModel> GetLicenses(AIADatabaseV5Entities dbContext, string accountNumber, string licenseeFirstName,
string licenseeLastName, byte licenseTypeId, string institutionName, int stateId, int countryId, string emailId,
DateTime subscriptionStartDate, DateTime subscriptionEndDate, bool isActive, int pageNo, int pageLength, out int recordCount)
{
List<LicenseModel> LicenseList = new List<LicenseModel>();
LicenseModel LicenseObj = new LicenseModel();
var spRecordCount = new System.Data.Objects.ObjectParameter("recordCount", 0);
recordCount = 0;
try
{
var result = dbContext.usp_GetlicensesList(
(subscriptionStartDate > DateTime.MinValue ? subscriptionStartDate.ToShortDateString() : "01/01/01"),
(subscriptionEndDate > DateTime.MinValue ? subscriptionEndDate.ToShortDateString() : "01/01/01"),
(accountNumber == null ? "" : accountNumber), (licenseeFirstName == null ? "" : licenseeFirstName),
(licenseeLastName == null ? "" : licenseeLastName), licenseTypeId, (institutionName == null ? "" : institutionName),
(emailId == null ? "" : emailId), stateId, countryId, isActive, pageNo, pageLength, spRecordCount).ToList();
if (result.Count > 0)
{
foreach (var item in result)
{
LicenseObj = new LicenseModel();
LicenseObj.LicenseId = item.LicenseId;
LicenseObj.AccountNumber = item.AccountNumber;
LicenseObj.AccountTypeName = item.AccountType;
LicenseObj.LicenseeName = item.LicenseeName;
LicenseObj.LicenseState = item.LicenseState;
LicenseObj.LicenseCountry = item.LicenseCountry;
LicenseObj.Address = item.ContactAddress;
LicenseObj.InstitutionName = item.InstitutionName;
LicenseObj.LicenseTypeName = item.LicenseType;
LicenseObj.EmailId = item.EmailId;
LicenseObj.NoOfImages = item.NoofImages;
LicenseObj.ClientAdmin = item.ClientAdmin;
LicenseObj.CardNumber = item.CardNumber;
LicenseObj.ProductKey = item.ProductKey;
LicenseObj.SubscriptionStartDate = DateTime.ParseExact(item.StartDate, "MM/dd/yyyy", System.Globalization.CultureInfo.CurrentCulture);
LicenseObj.SubscriptionEndDate = DateTime.ParseExact(item.EndDate, "MM/dd/yyyy", System.Globalization.CultureInfo.CurrentCulture);
LicenseObj.EntryDate = DateTime.ParseExact(item.EntryDate, "MM/dd/yyyy", System.Globalization.CultureInfo.CurrentCulture);
LicenseObj.RenewDate = DateTime.ParseExact((item.RenewDate == "" ? "01/01/0001" : item.RenewDate), "MM/dd/yyyy", System.Globalization.CultureInfo.CurrentCulture);
LicenseObj.ModifyDate = DateTime.ParseExact((item.ModifyDate == "" ? "01/01/0001" : item.ModifyDate), "MM/dd/yyyy", System.Globalization.CultureInfo.CurrentCulture);
LicenseObj.IsActive = (item.LicenseStatus == "Active" ? true : false);
LicenseObj.LicStatus = item.LicenseStatus;
LicenseList.Add(LicenseObj);
}
recordCount = (int)spRecordCount.Value;
}
}
catch (Exception ex) { }
return LicenseList;
}
public static List<Tuple<int, string>> GetLicenseAccounts(AIADatabaseV5Entities dbContext, int LicenseType)
{
List<Tuple<int, string>> LicenseAccountList = new List<Tuple<int, string>>();
Tuple<int, string> LicenseAccountObj;
try
{
var result = dbContext.usp_GetAccountNumber(LicenseType).ToList();
if (result.Count > 0)
{
foreach (var item in result)
{
LicenseAccountObj = new Tuple<int, string>(item.Id, item.AccountNumber);
LicenseAccountList.Add(LicenseAccountObj);
}
}
}
catch (Exception ex) { }
return LicenseAccountList;
}
public static LicenseModel GetLicenseById(AIADatabaseV5Entities dbContext, int LicenseId)
{
LicenseModel LicenseObj = new LicenseModel();
try
{
var result = dbContext.usp_GetLicenseById(LicenseId).ToList();
if (result.Count > 0)
{
LicenseObj.LicenseId = result[0].Id;
LicenseObj.LicenseTypeId = result[0].LicenseTypeId;
LicenseObj.AccountNumber = result[0].AccountNumber;
LicenseObj.AccountTypeId = result[0].AccountTypeId;
LicenseObj.LicenseeFirstName = result[0].LicenseeFirstName;
LicenseObj.LicenseeLastName = result[0].LicenseeLastName;
LicenseObj.EditionLogins = result[0].EditionLogins;
LicenseObj.TotalLogins = result[0].TotalLogins;
LicenseObj.Address1 = result[0].Address1;
LicenseObj.Address2 = result[0].Address2;
LicenseObj.City = result[0].City;
LicenseObj.CountryId = result[0].CountryId;
LicenseObj.StateId = result[0].StateId;
LicenseObj.InstitutionName = result[0].InstitutionName;
LicenseObj.EmailId = result[0].EmailId;
LicenseObj.Zip = result[0].Zip;
LicenseObj.Phone = result[0].Phone;
LicenseObj.TotalLogins = result[0].TotalLogins;
LicenseObj.ProductKey = result[0].ProductId;
LicenseObj.Price = result[0].Price.Value;
LicenseObj.NoOfImages = result[0].NoOfImages;
LicenseObj.MasterSiteUrl = result[0].SiteUrl;
LicenseObj.SiteUrlTo = result[0].SitToUrl;
LicenseObj.SiteUrlFrom = result[0].SiteMasterUrl;
LicenseObj.LoginId = result[0].Login;
LicenseObj.Password = result[0].Password;
LicenseObj.SecurityQuestionId = (byte?)result[0].SecurityQuestionId;
LicenseObj.Answer = result[0].Answer;
LicenseObj.IsActive = result[0].IsActive;
LicenseObj.TotalRenewals = result[0].TotalRenewals;
LicenseObj.SubscriptionStartDate = (result[0].SubscriptionStartDate == null ? DateTime.MinValue : result[0].SubscriptionStartDate.Value);
LicenseObj.SubscriptionEndDate = (result[0].SubscriptionEndDate == null ? DateTime.MinValue : result[0].SubscriptionEndDate.Value);
LicenseObj.RenewDate = DateTime.Now.Date;// (result[0].RenewalDate == null ? DateTime.Now.Date : result[0].RenewalDate.Value);
}
}
catch (Exception ex) { }
return LicenseObj;
}
public static List<SiteModel> GetLicenseSites(AIADatabaseV5Entities dbContext, string AccountNo, int pageNo, int pageLength, out int recordCount)
{
List<SiteModel> LicenseSiteList = new List<SiteModel>();
SiteModel SiteModelObj = new SiteModel();
var spRecordCount = new System.Data.Objects.ObjectParameter("recordCount", 0);
recordCount = 0;
try
{
var result = dbContext.usp_GetSiteAccountSites(AccountNo, pageNo, pageLength, spRecordCount).ToList();
if (result.Count > 0)
{
foreach (var item in result)
{
SiteModelObj = new SiteModel();
SiteModelObj.Id = item.Id;
SiteModelObj.Ip = item.SiteIp;
SiteModelObj.SiteIpTo = item.SiteIPTo;
SiteModelObj.MasterIpTo = item.SiteMasterIPTo;
SiteModelObj.InstituteName = item.InstituteName;
SiteModelObj.Department = item.Department;
SiteModelObj.SiteUserId = item.UserId;
SiteModelObj.SiteUserEmailId = item.EmailId;
SiteModelObj.SiteUserFirstName = item.FirstName;
SiteModelObj.Title = item.Title;
SiteModelObj.CreationDate = DateTime.ParseExact(item.CreationDate, "MM/dd/yyyy", System.Globalization.CultureInfo.CurrentCulture);
if (!string.IsNullOrEmpty(item.ModifiedDate))
{
SiteModelObj.ModifiedDate = DateTime.ParseExact(item.ModifiedDate, "MM/dd/yyyy", System.Globalization.CultureInfo.CurrentCulture);
}
LicenseSiteList.Add(SiteModelObj);
}
}
recordCount = (int)spRecordCount.Value;
}
catch (Exception ex) { }
return LicenseSiteList;
}
public static List<Tuple<int, bool, string>> GetLicenseModestySettings(AIADatabaseV5Entities dbContext, int LicenseId, int BuildingLevelId)
{
List<Tuple<int, bool, string>> LicenseModestyList = new List<Tuple<int, bool, string>>();
Tuple<int, bool, string> LicenseModestyObj;
int i = 0;
try
{
var result = dbContext.usp_GetLicenseModestySettings(LicenseId, BuildingLevelId).ToList();
if (result.Count > 0)
{
foreach (var item in result)
{
LicenseModestyObj = new Tuple<int, bool, string>(item.LicenseEditionId, (bool)item.IsModesty, item.Title);
LicenseModestyList.Add(LicenseModestyObj);
i++;
if (i >= 100) break;
}
}
}
catch (Exception ex) { }
return LicenseModestyList;
}
public static bool InsertLicense(AIADatabaseV5Entities dbContext, LicenseModel licenseModel)
{
bool status = false;
try
{
switch (licenseModel.LicenseTypeId)
{
case 1:
var result = dbContext.usp_InsertNewLicenseAccount(licenseModel.AccountNumber, licenseModel.LicenseeFirstName, licenseModel.LicenseeLastName,
licenseModel.LicenseTypeId, licenseModel.AccountTypeId, licenseModel.InstitutionName, licenseModel.Address1, licenseModel.Address2,
licenseModel.City, licenseModel.Zip, licenseModel.StateId, licenseModel.CountryId, licenseModel.Phone, licenseModel.EmailId,
licenseModel.TotalLogins, licenseModel.SubscriptionStartDate.ToString("MM/dd/yyyy"), licenseModel.SubscriptionEndDate.ToString("MM/dd/yyyy"),
licenseModel.MasterSiteUrl, licenseModel.EditionLogins, licenseModel.Price, licenseModel.ProductKey, licenseModel.SiteUrlTo,
licenseModel.SiteUrlFrom, licenseModel.NoOfImages);
if (result.Count() > 0)
{
status = true;
}
break;
case 2:
result = dbContext.usp_InsertSingleLicenseAccount(licenseModel.AccountNumber, licenseModel.LicenseeFirstName, licenseModel.LicenseeLastName, licenseModel.AccountTypeId,
licenseModel.InstitutionName, licenseModel.Address1, licenseModel.Address2, licenseModel.City, licenseModel.Zip,
licenseModel.StateId, licenseModel.CountryId, licenseModel.Phone, licenseModel.EmailId, licenseModel.TotalLogins,
licenseModel.SubscriptionStartDate.ToString("MM/dd/yyyy"), licenseModel.SubscriptionEndDate.ToString("MM/dd/yyyy"),
licenseModel.EditionLogins, licenseModel.Price, licenseModel.ProductKey, licenseModel.LoginId, licenseModel.Password,
licenseModel.SecurityQuestionId, licenseModel.Answer, licenseModel.CreatorId, licenseModel.NoOfImages);
if (result.Count() > 0)
{
status = true;
}
break;
case 3:
result = dbContext.usp_InsertNewLicenseAccount(licenseModel.AccountNumber, licenseModel.LicenseeFirstName, licenseModel.LicenseeLastName,
licenseModel.LicenseTypeId, licenseModel.AccountTypeId, licenseModel.InstitutionName, licenseModel.Address1, licenseModel.Address2,
licenseModel.City, licenseModel.Zip, licenseModel.StateId, licenseModel.CountryId, licenseModel.Phone, licenseModel.EmailId,
licenseModel.TotalLogins, licenseModel.SubscriptionStartDate.ToString("MM/dd/yyyy"), licenseModel.SubscriptionEndDate.ToString("MM/dd/yyyy"),
licenseModel.MasterSiteUrl, licenseModel.EditionLogins, licenseModel.Price, licenseModel.ProductKey, licenseModel.SiteUrlTo,
licenseModel.SiteUrlFrom, licenseModel.NoOfImages);
if (result.Count() > 0)
{
status = true;
}
break;
case 4:
var result1 = dbContext.usp_InsertResellerLicenseAccount(licenseModel.LicenseeFirstName, licenseModel.LicenseeLastName, licenseModel.LicenseTypeId,
licenseModel.AccountTypeId, licenseModel.InstitutionName, licenseModel.Address1, licenseModel.Address2,
licenseModel.City, licenseModel.Zip, licenseModel.StateId, licenseModel.CountryId, licenseModel.Phone, licenseModel.EmailId,
licenseModel.TotalLogins, licenseModel.SubscriptionStartDate.ToString("MM/dd/yyyy"), licenseModel.SubscriptionEndDate.ToString("MM/dd/yyyy"),
licenseModel.EditionLogins, licenseModel.Price, licenseModel.CreatorId, licenseModel.ProductKey, licenseModel.NoOfImages);
using (MailMessage Email = new MailMessage(System.Configuration.ConfigurationManager.AppSettings["SenderEmailAddress"].ToString(),
licenseModel.EmailId))
{
Email.Subject = "Reseller License - Account Details";
string EmailTemplatePath = HttpContext.Current.Server.MapPath("~/Custom/EmailTemplate.html");
string CsvFilePath = HttpContext.Current.Server.MapPath("~/Content/LoginDetails.csv");
status = true;
EmailUtility EmailUtil = new EmailUtility();
System.Text.StringBuilder csv = new System.Text.StringBuilder();
csv.Append(string.Format("{0}, {1}, {2}", "AccountNumber", "UserId", "Password"));
csv.AppendLine();
int NumberOfLicenses = 0;
foreach (var item in result1)
{
if (item.SPStatus == "ok")
{
csv.Append(string.Format("{0}, {1}, {2}", item.AccountNumber, item.LoginId, item.Password));
csv.AppendLine();
NumberOfLicenses++;
}
}
Email.Body = System.IO.File.ReadAllText(EmailTemplatePath).Replace("#Name", licenseModel.LicenseeFirstName).Replace("#Count", NumberOfLicenses.ToString());
Email.IsBodyHtml = true;
System.IO.File.WriteAllText(CsvFilePath, csv.ToString());
Email.Attachments.Add(new Attachment(CsvFilePath));
EmailUtil.SendMail(Email);
}
break;
case 5:
result = dbContext.usp_InsertTestLicenseAccount(licenseModel.AccountNumber, licenseModel.LicenseeFirstName, licenseModel.LicenseeLastName,
licenseModel.LoginId, licenseModel.Password, licenseModel.EmailId, licenseModel.AccountTypeId, licenseModel.TestLicenseEditionId,
licenseModel.Address1, licenseModel.City, licenseModel.Zip, licenseModel.StateId, licenseModel.CountryId, licenseModel.Phone,
licenseModel.SubscriptionStartDate.ToString("MM/dd/yyyy"), licenseModel.SubscriptionEndDate.ToString("MM/dd/yyyy"),
licenseModel.CreatorId, licenseModel.NoOfImages);
if (result.Count() > 0)
{
status = true;
}
break;
}
return status;
}
catch (Exception ex)
{
return false;
}
}
public static bool UpdateLicense(AIADatabaseV5Entities dbContext, LicenseModel licenseModel)
{
bool status = false;
try
{
var result = dbContext.usp_UpdateLicenseAccount(licenseModel.LicenseId, licenseModel.LicenseeFirstName, licenseModel.LicenseeLastName,
licenseModel.LicenseTypeId, licenseModel.AccountTypeId, licenseModel.InstitutionName, licenseModel.Address1, licenseModel.Address2,
licenseModel.City, licenseModel.Zip, licenseModel.StateId, licenseModel.CountryId, licenseModel.Phone, licenseModel.EmailId,
(byte)(licenseModel.IsActive == false ? 0 : 1), licenseModel.TotalLogins, (byte)(licenseModel.IsRenew == false ? 0 : 1),
licenseModel.SubscriptionStartDate.ToString("MM/dd/yyyy"), licenseModel.SubscriptionEndDate.ToString("MM/dd/yyyy"),
licenseModel.RenewDate.ToString("MM/dd/yyyy"), licenseModel.MasterSiteUrl, licenseModel.EditionLogins, licenseModel.Price,
licenseModel.ProductKey, licenseModel.SiteUrlTo, licenseModel.SiteUrlFrom, licenseModel.NoOfImages);
if (result.Count() > 0)
{
status = true;
}
return status;
}
catch (Exception ex)
{
return false;
}
}
public static bool DeleteLicense(AIADatabaseV5Entities dbContext, int LicenseId)
{
try
{
var spStatus = dbContext.usp_DeleteLicense(LicenseId);
if (spStatus.Count() > 0)
{
return true;
}
else
{
return false;
}
}
catch (Exception ex)
{
return false;
}
}
public static bool UpdateLicenseBasicSettings(AIADatabaseV5Entities dbContext, LicenseModel licenseModel)
{
var spStatus = new System.Data.Objects.ObjectParameter("Status", 0);
try
{
var result = dbContext.usp_UpdateLicenseBasicSettings(licenseModel.LicenseId, licenseModel.LicenseeFirstName, licenseModel.LicenseeLastName,
licenseModel.InstitutionName, licenseModel.Address1, licenseModel.Address2, licenseModel.City, licenseModel.Zip,
licenseModel.StateId, licenseModel.CountryId, licenseModel.Phone, licenseModel.EmailId, spStatus);
return (bool)spStatus.Value;
}
catch (Exception ex)
{
return false;
}
}
public static bool UpdateLicenseModestySettings(AIADatabaseV5Entities dbContext, List<Tuple<int, int, bool,bool>> LicenseModestyList)
{
var spStatus = new System.Data.Objects.ObjectParameter("Status", 0);
try
{
foreach (var item in LicenseModestyList)
{
dbContext.usp_UpdateLicenseModestySettings(item.Item1, item.Item2, item.Item3, item.Item4, spStatus);
if (!(bool)spStatus.Value) break;
}
return (bool)spStatus.Value;
}
catch (Exception ex)
{
return false;
}
}
public static List<Tuple<int, bool, string>> GetLicenseModulesStatus(AIADatabaseV5Entities dbContext, int LicenseId)
{
List<Tuple<int, bool, string>> LicenseModulesStatusList = new List<Tuple<int, bool, string>>();
Tuple<int, bool, string> LicenseModuleStatusObj;
try
{
var result = dbContext.usp_GetModuleStatusByLicenseId(LicenseId).ToList();
if (result.Count > 0)
{
foreach (var item in result)
{
LicenseModuleStatusObj = new Tuple<int, bool, string>(item.Id, (bool)item.Status, item.Title);
LicenseModulesStatusList.Add(LicenseModuleStatusObj);
}
}
}
catch (Exception ex) { }
return LicenseModulesStatusList;
}
public static bool UpdateLicenseModulesStatus(AIADatabaseV5Entities dbContext, Tuple<int, string,bool,string> LicenseModuleStatus)
{
var spStatus = new System.Data.Objects.ObjectParameter("Status", 0);
try
{
dbContext.usp_UpdateLicenseModuleStatus(LicenseModuleStatus.Item1, LicenseModuleStatus.Item2, LicenseModuleStatus.Item3, LicenseModuleStatus.Item4, spStatus);
return (bool)spStatus.Value;
}
catch (Exception ex)
{
return false;
}
}
public static List<GetCoursesToLicense_Result> GetLicenseAodCourse(AIADatabaseV5Entities dbContext, int LicenseId)
{
List<GetCoursesToLicense_Result> result = new List<GetCoursesToLicense_Result>();
try
{
result = dbContext.GetCoursesToLicense(LicenseId).ToList();
}
catch (Exception ex) { }
return result;
}
public static bool CheckAccountNumber(AIADatabaseV5Entities dbContext, string AccountNo)
{
var spStatus = new System.Data.Objects.ObjectParameter("Status", 0);
try
{
dbContext.usp_CheckAccountNoExists(AccountNo, spStatus);
return (bool)spStatus.Value;
}
catch (Exception ex)
{
return false;
}
}
public static List<Tuple<int, string, string>> GetLicenseSiteAdmin(AIADatabaseV5Entities dbContext, string AccountNo)
{
List<Tuple<int, string, string>> LicenseSiteAdminList = new List<Tuple<int, string, string>>();
Tuple<int, string, string> SiteAdmin;
try
{
var result = dbContext.usp_GetSiteAccountAdmin(AccountNo).ToList();
if (result.Count > 0)
{
foreach (var item in result)
{
SiteAdmin = new Tuple<int, string, string>(item.Id, item.FirstName + " " + item.LastName, item.EmailId);
LicenseSiteAdminList.Add(SiteAdmin);
}
}
}
catch (Exception ex) { }
return LicenseSiteAdminList;
}
}
public class LicenseTypeModel
{
public int Id { get; set; }
public string Title { get; set; }
public bool IsActive { get; set; }
public static List<LicenseTypeModel> GetLicenseTypes(AIADatabaseV5Entities dbContext)
{
List<LicenseTypeModel> LicenseTypeList = new List<LicenseTypeModel>();
LicenseTypeModel LicenseTypeModelObj = new LicenseTypeModel();
try
{
var result = dbContext.usp_GetLicenseTypes().ToList();
if (result.Count > 0)
{
foreach (var item in result)
{
LicenseTypeModelObj = new LicenseTypeModel();
LicenseTypeModelObj.Id = item.Id;
LicenseTypeModelObj.Title = item.Title;
LicenseTypeModelObj.IsActive = item.IsActive;
LicenseTypeList.Add(LicenseTypeModelObj);
}
}
}
catch (Exception ex) { }
return LicenseTypeList;
}
}
}