Example #1
0
File: UI.cs Project: apxlee/SAP
 public BuilderActor(int actorId, string userId, string displayName,
     bool isDefault, bool isSelected, ActorGroupType actorGroupType, WorkflowState workflowState)
 {
     this.ActorId = actorId;
     this.UserId = userId;
     this.DisplayName = displayName;
     this.IsDefault = isDefault;
     this.IsSelected = isSelected;
     this.ActorGroupType = actorGroupType;
     this.WorkflowState = workflowState;
 }
Example #2
0
File: UI.cs Project: apxlee/SAP
 public BuilderGroup(int groupId, string groupName, string description, bool isLargeGroup,
     bool isSelected, bool isDisabled, List<BuilderActor> availableActors, ActorGroupType actorGroupType)
 {
     this.GroupId = groupId;
     this.GroupName = groupName;
     this.Description = description;
     this.IsLargeGroup = isLargeGroup;
     this.IsSelected = isSelected;
     this.IsDisabled = isDisabled;
     this.AvailableActors = availableActors;
     this.ActorGroupType = actorGroupType;
 }
Example #3
0
        public static int GetActorIdByUserId(ActorGroupType actorGroupType, string userId)
        {
            //Console.WriteLine("GetAtorIdByUSerId: " + userId);
            using (var db = new SNAPDatabaseDataContext())
            {
                int actorId = 0;
                try
                {
                    var query = from sa in db.SNAP_Actors
                                join sag in db.SNAP_Actor_Groups on sa.actor_groupId equals sag.pkId
                                where sa.userId == userId && sag.actorGroupType == (byte) actorGroupType
                                select sa.pkId;
                    if (query.Count() > 0)
                    {
                        return (int)query.First();
                    }
                    else
                    {
                        ADUserDetail usrDetail = Apollo.AIM.SNAP.CA.DirectoryServices.GetUserByLoginName(userId);
                        if (usrDetail != null)
                        {
                            var actorGroupId = db.SNAP_Actor_Groups.Single(g => g.actorGroupType == (byte)actorGroupType).pkId;
                            InsertActor(userId, db, usrDetail, actorGroupId);
                            return GetActorIdByUserId(actorGroupType, userId);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("AccessRequest - GetAtorIdByUserId, Message:" + ex.Message + ", StackTrace: " + ex.StackTrace);
                    Logger.Fatal("AccessRequest - GetAtorIdByUserId, Message:" + ex.Message + ", StackTrace: " + ex.StackTrace);
                }

                return actorId;
            }
        }