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 GetLicenseUserGroups(AIADatabaseV5Entities dbContext, int? LicenseId, string sortColumn, string sortOrder, int pageNo, int pageLength, out int recordCount) { List UserGroupList = new List(); var spRecordCount = new System.Data.Objects.ObjectParameter("recordCount", 0); recordCount = 0; try { UserGroupList = dbContext.usp_GetLicenseUserGroups(LicenseId, sortColumn, sortOrder, pageNo, pageLength, spRecordCount).ToList(); recordCount = (int)spRecordCount.Value; } catch (Exception ex) { } return UserGroupList; } public static List GetLicenseUserGroupUsers(AIADatabaseV5Entities dbContext, int? LicenseId, int UserGroupId, bool AllUsers, string sortColumn, string sortOrder, int pageNo, int pageLength, out int recordCount) { List UserList = new List(); UserModel UserModelObj = new UserModel(); var spRecordCount = new System.Data.Objects.ObjectParameter("recordCount", 0); recordCount = 0; try { UserList = dbContext.usp_GetLicenseUserGroupUsers(LicenseId, UserGroupId, AllUsers, sortColumn, sortOrder,pageNo, pageLength, spRecordCount).ToList(); recordCount = (int)spRecordCount.Value; } 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; } } public static bool CheckDuplicateLicenseUserGroup(AIADatabaseV5Entities dbContext, int? LicenseId, string Title) { var spStatus = new System.Data.Objects.ObjectParameter("Status", 0); try { dbContext.usp_CheckDuplicateLicenseUserGroup(LicenseId, Title, spStatus); return (bool)spStatus.Value; } catch (Exception ex) { return false; } } } }