Exemplo n.º 1
0
        public void GetMembersForGroup_UnitTest()
        {
            GroupStorageAccess g = new GroupStorageAccess();

            //var grpList = g.GetMembersForGroup(1);

            Assert.AreEqual(1, 1);
        }
Exemplo n.º 2
0
 public GroupService()
 {
     _GroupStorageAccess  = new GroupStorageAccess();
     _GroupRepository     = new GroupRepository();
     _MemberStorageAccess = new MemberStorageAccess();
     _LocationService     = new LocationService();
     _MemberRepository    = new MemberRepository();
 }
Exemplo n.º 3
0
        public List <string> WardNames(string ShapeFileID, string SubGroupIdentificationKey)
        {
            GroupStorageAccess _GroupStorageAccess = new GroupStorageAccess();
            var groupListwithGroupNames            = _GroupStorageAccess.GetAllGroupsWithGroupNames().OrderBy(x => x.Key);

            ShapeFileGISutility service = new ShapeFileGISutility();
            var wardnames = service.GetAllWardNames(ShapeFileID, SubGroupIdentificationKey);

            return(wardnames);
        }
Exemplo n.º 4
0
        public async Task <GroupList> GetListOfGroups(string SearchKey)
        {
            string[] SearchArray = SearchKey.Split(';');
            var      returnV     = new GroupList {
                List = new List <Group>()
            };
            string liveUserID = WebOperationContext.Current.IncomingRequest.Headers["LiveUserID"];

            //TODO: Cache Get the user id from cache once its implemented instead of going to storage
            bool isValidLiveId = await _MemberRepository.ValidateUser(liveUserID);

            if (!isValidLiveId)
            {
                utility.ResultsManager.AddResultInfo(returnV, ResultTypeEnum.AuthError,
                                                     "You are not authorized to access this method");
                return(returnV);
            }


            if (_GroupStorageAccess == null)
            {
                _GroupStorageAccess = new GroupStorageAccess();
            }
            List <entities.Group> entityGrps = null;

            if (SearchKey.ToLower() != "all")
            {
                foreach (string s in SearchArray)
                {
                    entityGrps = _GroupStorageAccess.GetGroupsForNameMatch(s.Replace("Name#", ""));
                    if (entityGrps != null && entityGrps.Count > 0)
                    {
                        foreach (entities.Group grp in entityGrps)
                        {
                            returnV.List.Add(Caster.MakeContractGroupLite(grp));
                        }
                    }
                }
            }
            else
            {
                entityGrps = _GroupStorageAccess.GetAllGroups();
                if (entityGrps != null && entityGrps.Count > 0)
                {
                    foreach (entities.Group grp in entityGrps)
                    {
                        returnV.List.Add(Caster.MakeContractGroupLite(grp));
                    }
                }
            }
            return(returnV);
        }
Exemplo n.º 5
0
 public ReportService()
 {
     _LocationRepository    = new LocationRepository();
     _GroupRepository       = new GroupRepository();
     _MemberRepository      = new MemberRepository();
     _MemberService         = new MemberService();
     _GroupService          = new GroupService();
     _GeoService            = new GeoUpdate();
     _LiveSessionRepository = new LiveSessionRepository();
     //Storage Classes
     _GroupStorageAccess          = new GroupStorageAccess();
     _MemberStorageAccess         = new MemberStorageAccess();
     _ReportRepository            = new ReportRepository();
     _SessionHistoryStorageAccess = new SessionHistoryStorageAccess();
 }
Exemplo n.º 6
0
        public void EditGroup(Group grp, string partitionKey = null, string rowkey = null, bool isCreate = false)
        {
            LastUpdateDate = DateTime.UtcNow;

            var entityGrp = new entities.Group();

            entityGrp.GroupID       = Convert.ToInt16(grp.GroupID);
            entityGrp.GroupName     = grp.GroupName;
            entityGrp.EnrollmentKey = grp.EnrollmentKey;
            entityGrp.Email         = grp.Email;
            entityGrp.PhoneNumber   = grp.PhoneNumber;
            entityGrp.Location      = grp.GroupLocation;
            entityGrp.GroupType     = Convert.ToInt32(grp.Type);
            entityGrp.IsActive      = grp.IsActive;

            entityGrp.EnrollmentType            = Convert.ToInt32(grp.EnrollmentType);
            entityGrp.RowKey                    = grp.GroupID;
            entityGrp.PartitionKey              = grp.GroupLocation;
            entityGrp.ParentGroupID             = grp.ParentGroupID;
            entityGrp.NotifySubgroups           = grp.NotifySubgroups;
            entityGrp.SubGroupIdentificationKey = grp.SubGroupIdentificationKey;
            entityGrp.ShapeFileID               = grp.ShapeFileID;
            entityGrp.GeoLocation               = grp.GeoLocation;
            entityGrp.ShowIncidents             = grp.ShowIncidents;

            var _GroupStorageAccess = new GroupStorageAccess();

            _GroupStorageAccess.UpdateGroup(entityGrp);

            var entityAdmin = new entities.AdminUser();

            entityAdmin.AdminID              = Convert.ToInt16(grp.GroupID);
            entityAdmin.Email                = grp.Email;
            entityAdmin.GroupIDCSV           = grp.GroupID;
            entityAdmin.Name                 = grp.GroupName;
            entityAdmin.MobileNumber         = grp.PhoneNumber;
            entityAdmin.LiveUserID           = grp.LiveInfo.LiveID;
            entityAdmin.AllowGroupManagement = grp.AllowGroupManagement;
            entityAdmin.PartitionKey         = isCreate ? grp.GroupLocation : partitionKey;
            entityAdmin.RowKey               = isCreate ? Guid.NewGuid().ToString() : rowkey;

            var _MemberStorageAccess = new MemberStorageAccess();

            _MemberStorageAccess.SaveGroupAdmin(entityAdmin);
        }
Exemplo n.º 7
0
        public List <GroupDTO> GetAllGroupWithAdmins()
        {
            _GroupStorageAccess = new GroupStorageAccess();
            List <entities.Group> entityGrps = null;

            entityGrps = _GroupStorageAccess.GetAllGroups(null);
            List <entities.AdminUser> grpAdmin = _GroupStorageAccess.GetAllGroupAdmins();

            var result = new List <GroupDTO>();

            if (entityGrps != null && entityGrps.Count > 0 && grpAdmin != null && grpAdmin.Count > 0)
            {
                result = (from grp in entityGrps
                          join admin in grpAdmin on grp.GroupID equals admin.AdminID into groupadmins
                          from grpadmins in groupadmins.DefaultIfEmpty()
                          select new GroupDTO
                {
                    GroupID = grp.GroupID,
                    GroupName = grp.GroupName,
                    EnrollmentKey = grp.EnrollmentKey,
                    EnrollmentType = (Enrollment)grp.EnrollmentType,
                    Email = grp.Email,
                    PhoneNumber = grp.PhoneNumber,
                    Location = grp.Location,
                    GroupType = (GroupType)grp.GroupType,
                    IsActive = grp.IsActive,
                    GroupKey = grp.SubGroupIdentificationKey,
                    GeoLocation = grp.GeoLocation,
                    NotifySubgroups = grp.NotifySubgroups,
                    ParentGroupID = grp.ParentGroupID,
                    ParentGroupName = GetParentgroupName(entityGrps, grp),
                    ShapeFileID = grp.ShapeFileID,
                    ShowIncidents = grp.ShowIncidents,
                    LiveID = grpadmins != null ? grpadmins.LiveUserID : String.Empty,
                    RowKey = grpadmins != null ? grpadmins.RowKey : string.Empty,
                    PartitionKey = grpadmins != null ? grpadmins.PartitionKey : string.Empty,
                    AllowGroupManagement = grpadmins != null ? grpadmins.AllowGroupManagement : false
                }).ToList();
            }
            return(result);
        }
Exemplo n.º 8
0
        //no change
        /// <summary>
        ///     Gets Amdin profile if the provide Live Unique user ID matches
        /// </summary>
        /// <param name="LUID">Live Unique User ID obtained by decrypting the JWT</param>
        /// <returns></returns>
        public Admin GetAdminProfile(string LUID)
        {
            var oResult = new Admin();

            if (string.IsNullOrEmpty(LUID))
            {
                utility.ResultsManager.AddResultInfo(oResult, ResultTypeEnum.Error, "The LiveMail provided was empty.");
                return(oResult);
            }

            if (_GroupStorageAccess == null)
            {
                _GroupStorageAccess = new GroupStorageAccess();
            }

            entities.AdminUser oAdmin = _GroupStorageAccess.GetAdminUser(LUID);

            if (oAdmin == null)
            {
                utility.ResultsManager.AddResultInfo(oResult, ResultTypeEnum.Error,
                                                     "The LiveMail did not yeild an admin.");
                return(oResult);
            }
            if (oAdmin.GroupIDCSV.Trim().Trim(',') == string.Empty)
            {
                oResult = Caster.MakeContractAdmin(oAdmin);
                utility.ResultsManager.AddResultInfo(oResult, ResultTypeEnum.Error,
                                                     "The admin is not associated to any groups.");
                return(oResult);
            }
            oResult = Caster.MakeContractAdmin(oAdmin);
            string[]       gArr  = oResult.GroupIDCSV.Split(',');
            entities.Group grp   = null;
            int            grpID = 0;
            Group          cGrop = null;

            oResult.Groups = new List <Group>();
            foreach (string s in gArr)
            {
                if (!string.IsNullOrEmpty(s) && Int32.TryParse(s, out grpID) && grpID > 0)
                {
                    grp = _GroupStorageAccess.GetGroupByID(grpID);

                    if (grp != null && grp.GroupID > 0)
                    {
                        cGrop = Caster.MakeContractGroupLite(grp);
                        if (cGrop != null && !string.IsNullOrEmpty(cGrop.GroupName) &&
                            !string.IsNullOrEmpty(cGrop.GroupID))
                        {
                            oResult.Groups.Add(cGrop);
                        }
                        else
                        {
                            utility.ResultsManager.AddResultInfo(oResult, ResultTypeEnum.Information,
                                                                 "The Group ID: " + s + " failed parsing");
                        }
                    }
                    else
                    {
                        utility.ResultsManager.AddResultInfo(oResult, ResultTypeEnum.Information,
                                                             "The Group ID: " + s + " is not available");
                    }
                }
            }

            return(oResult);
        }