UserGroupModel.cs
4.16 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using AIAHTML5.ADMIN.API.Entity;
namespace AIAHTML5.ADMIN.API.Models
{
public class UserGroupModel
{
public int Id { get; set; }
public int LicenseId { get; set; }
public string Title { get; set; }
public DateTime? CreationDate { get; set; }
public DateTime? ModifiedDate { get; set; }
public bool? IsActive { get; set; }
public int? TotalUsers { get; set; }
public static List<UserGroupModel> GetLicenseUserGroups(AIADatabaseV5Entities dbContext, int LicenseId)
{
List<UserGroupModel> UserGroupList = new List<UserGroupModel>();
UserGroupModel UserGroupObj = new UserGroupModel();
try
{
var result = dbContext.usp_GetLicenseUserGroups(LicenseId).ToList();
foreach (var item in result)
{
UserGroupObj = new UserGroupModel();
UserGroupObj.Id = item.Id;
UserGroupObj.LicenseId = item.LicenseId;
UserGroupObj.Title = item.Title;
UserGroupObj.IsActive = item.IsActive;
UserGroupObj.ModifiedDate = item.ModifiedDate;
UserGroupObj.CreationDate = item.CreationDate;
UserGroupObj.TotalUsers = item.TotalUsers;
UserGroupList.Add(UserGroupObj);
}
}
catch (Exception ex) { }
return UserGroupList;
}
public static List<UserModel> GetLicenseUserGroupUsers(AIADatabaseV5Entities dbContext, int LicenseId, int UserGroupId)
{
List<UserModel> UserList = new List<UserModel>();
UserModel UserModelObj = new UserModel();
try
{
var result = dbContext.GetAllUserWithGroup(LicenseId, UserGroupId).ToList();
foreach (var item in result)
{
UserModelObj = new UserModel();
UserModelObj.Id = item.Id;
UserModelObj.FirstName = item.FirstName;
UserModelObj.LastName = item.LastName;
UserModelObj.LoginId = item.LoginId;
UserModelObj.EmailId = item.EmailId;
UserModelObj.ProductEdition = item.Title;
UserModelObj.InGroup = item.InGroup;
UserList.Add(UserModelObj);
}
}
catch (Exception ex) { }
return UserList;
}
public static bool InsertUpdateLicenseUserGroup(AIADatabaseV5Entities dbContext, UserGroupModel UserGroupEntity)
{
var spStatus = new System.Data.Objects.ObjectParameter("Status", 0);
try
{
dbContext.usp_InsertUpdateLicenseUserGroup(UserGroupEntity.Id, UserGroupEntity.LicenseId, UserGroupEntity.Title,
UserGroupEntity.CreationDate, UserGroupEntity.ModifiedDate, UserGroupEntity.IsActive, spStatus);
return (bool)spStatus.Value;
}
catch (Exception ex)
{
return false;
}
}
public static bool UpdateLicenseUserGroupUsers(AIADatabaseV5Entities dbContext, int UserGroupId, string UserIds)
{
var spStatus = new System.Data.Objects.ObjectParameter("Status", 0);
try
{
dbContext.usp_UpdateLicenseUserGroupUsers(UserGroupId, UserIds, spStatus);
return (bool)spStatus.Value;
}
catch (Exception ex)
{
return false;
}
}
public static bool DeleteLicenseUserGroup(AIADatabaseV5Entities dbContext, int UserGroupId)
{
var spStatus = new System.Data.Objects.ObjectParameter("Status", 0);
try
{
dbContext.usp_DeleteLicenseUserGroup(UserGroupId, spStatus);
return (bool)spStatus.Value;
}
catch (Exception ex)
{
return false;
}
}
}
}