SiteModel.cs
5.31 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AIAHTML5.ADMIN.API.Entity;
namespace AIAHTML5.ADMIN.API.Models
{
public class SiteModel
{
public int Id { get; set; }
public int LicenseId { get; set; }
public string Ip { get; set; }
public string Title { get; set; }
public string SiteIpTo { get; set; }
public string MasterIpTo { get; set; }
public DateTime CreationDate { get; set; }
public DateTime ModifiedDate { get; set; }
public string InstituteName { get; set; }
public string City { get; set; }
public string Zip { get; set; }
public string Phone { get; set; }
public string Address1 { get; set; }
public string Address2 { get; set; }
public int? StateId { get; set; }
public int? CountryId { get; set; }
public string Department { get; set; }
public int SiteUserId { get; set; }
public string SiteUserFirstName { get; set; }
public string SiteUserEmailId { get; set; }
public bool? IsActive { get; set; }
public bool IsMaster { get; set; }
public bool? IsModesty { get; set; }
public string SiteEditionIds { get; set; }
public static SiteModel GetSiteById(AIADatabaseV5Entities dbContext, int SiteId)
{
LicenseModel LicenseObj = new LicenseModel();
SiteModel SiteModelObj = new SiteModel();
try
{
var result = dbContext.usp_GetSiteById(SiteId).ToList();
SiteModelObj.Id = result[0].Id;
SiteModelObj.Ip = result[0].SiteIp;
SiteModelObj.SiteIpTo = result[0].SiteIPTo;
SiteModelObj.MasterIpTo = result[0].SiteMasterIPTo;
SiteModelObj.InstituteName = result[0].InstituteName;
SiteModelObj.Department = result[0].Department;
SiteModelObj.City = result[0].City;
SiteModelObj.Phone = result[0].Phone;
SiteModelObj.Zip = result[0].Zip;
SiteModelObj.Address1 = result[0].Address1;
SiteModelObj.Address2 = result[0].Address2;
SiteModelObj.CountryId = result[0].CountryId;
SiteModelObj.StateId = result[0].StateId;
SiteModelObj.SiteUserId = result[0].UserId;
SiteModelObj.SiteUserEmailId = result[0].EmailId;
SiteModelObj.IsMaster = result[0].IsMaster;
SiteModelObj.IsActive = result[0].IsActive;
SiteModelObj.SiteUserFirstName = result[0].FirstName;
SiteModelObj.Title = result[0].Title;
SiteModelObj.CreationDate = DateTime.ParseExact(result[0].CreationDate, "MM/dd/yyyy", System.Globalization.CultureInfo.CurrentCulture);
SiteModelObj.ModifiedDate = DateTime.ParseExact(result[0].ModifiedDate, "MM/dd/yyyy", System.Globalization.CultureInfo.CurrentCulture);
}
catch (Exception ex) { }
return SiteModelObj;
}
public static List<Tuple<int, int, string>> GetSiteAccountEditions(AIADatabaseV5Entities dbContext, int SiteId, int LicenseId)
{
List<Tuple<int, int, string>> SiteAccountEditionList = new List<Tuple<int, int, string>>();
Tuple<int, int, string> SiteEditionObj;
try
{
var result = dbContext.usp_GetSiteAccountEditions(SiteId, LicenseId).ToList();
if (result.Count > 0)
{
foreach (var item in result)
{
SiteEditionObj = new Tuple<int, int, string>(item.LicenseEditionId, item.Id, item.Title);
SiteAccountEditionList.Add(SiteEditionObj);
}
}
}
catch (Exception ex) { }
return SiteAccountEditionList;
}
public static bool InsertUpdateSiteAccount(AIADatabaseV5Entities dbContext, SiteModel SiteEntity)
{
var spStatus = new System.Data.Objects.ObjectParameter("Status", 0);
try
{
dbContext.usp_InsertUpdateSiteAccount(SiteEntity.Id, SiteEntity.Ip, SiteEntity.Title,
SiteEntity.InstituteName, SiteEntity.Department, SiteEntity.Address1, SiteEntity.Address2,
SiteEntity.City, SiteEntity.Zip, SiteEntity.Phone, SiteEntity.StateId, SiteEntity.CountryId,
SiteEntity.IsMaster, SiteEntity.CreationDate, SiteEntity.ModifiedDate, SiteEntity.IsActive,
SiteEntity.SiteUserId, SiteEntity.SiteIpTo, SiteEntity.LicenseId, SiteEntity.SiteEditionIds, spStatus);
return (bool)spStatus.Value;
}
catch (Exception ex)
{
return false;
}
}
public static bool DeleteSiteAccount(AIADatabaseV5Entities dbContext, int SiteId, int LicenseId, int UserId)
{
var spStatus = new System.Data.Objects.ObjectParameter("Status", 0);
try
{
dbContext.usp_DeleteSiteAccount(SiteId, LicenseId, UserId, spStatus);
return (bool)spStatus.Value;
}
catch (Exception ex)
{
return false;
}
}
}
}