Exemplo n.º 1
0
        public JsonResult QueryList(int pageIndex, int pageSize)
        {
            UserArgs userArgs = new UserArgs();
            var      list     = unitVM.QueryList(pageIndex, pageSize, true, userArgs);

            return(Json(list, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
 /// <summary>
 /// 用户改变
 /// </summary>
 /// <param name="e"></param>
 public void ExecuteUsersChangeEvent(UserArgs e)
 {
     if (UserChanged != null)
     {
         UserChanged(null, e);
     }
 }
Exemplo n.º 3
0
        public static int Main(string[] args)
        {
            var arguments = UserArgs.ParseAndValidate(args);

            if (arguments == null)
            {
                return(1);
            }

            try
            {
                var stopwatch = new Stopwatch();
                stopwatch.Start();

                var processor = Gzip.Processor(arguments);
                processor.Process();

                stopwatch.Stop();
                Console.WriteLine($"Done. Elapsed {stopwatch.ElapsedMilliseconds} milliseconds");
            }
            catch (PlatformNotSupportedException ex)
            {
                Console.WriteLine($"Platform not supported, StackTrace:{ex.StackTrace}");
                return(1);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return(1);
            }

            return(0);
        }
Exemplo n.º 4
0
        [ProducesResponseType(409)] // User with same ID or email already exists
        public async Task <IActionResult> PostAsync(string userId, [FromBody] UserArgs args)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (_userIndex.TryGetInternalId(userId, out var _))
            {
                return(StatusCode(409, new { Message = $"A user with ID '{userId}' already exists" }));
            }

            if (_userIndex.IsEmailInUse(args.Email))
            {
                return(StatusCode(409, new { Message = $"A user with email address '{args.Email}' already exists" }));
            }

            var user = new UserEventArgs
            {
                UserId    = userId,
                Email     = args.Email,
                FirstName = args.FirstName,
                LastName  = args.LastName,
            };
            var id = _entityIndex.NextId(ResourceTypes.User);

            await EntityManager.CreateEntityAsync(_eventStore, user, ResourceTypes.User, id, User.Identity.GetUserIdentity());

            return(Created($"{Request.Scheme}://{Request.Host}/api/Users/{userId}", userId));
        }
Exemplo n.º 5
0
 private void RtcControl_UserJoinedMeeting(object sender, UserArgs e)
 {
     //the new peer session available event is fired
     //a peer joins your conference room or when you join the conference room
     //and are not alone in the conference room
     ProcessParticipants(e.Participants);
 }
Exemplo n.º 6
0
 /// <inheritdoc/>
 public void OnEvent(UserArgs arg)
 {
     if (arg.eventType != UserArgs.UserEventType.Save)
     {
         return;
     }
     UpdateUserData();
 }
Exemplo n.º 7
0
    private void writeNewUser(string userId, string name, string email, int score)
    {
        DatabaseReference mDatabaseRef = FirebaseDatabase.DefaultInstance.RootReference;
        UserArgs          user         = new UserArgs(name, email, score);
        string            json         = JsonUtility.ToJson(user);

        mDatabaseRef.Child("users").Child(userId).SetRawJsonValueAsync(json);
    }
Exemplo n.º 8
0
 public static IProcessor Processor(UserArgs userArgs, int?concurrency = null)
 {
     concurrency ??= Environment.ProcessorCount;
     return(userArgs.CompressionMode switch
     {
         CompressionMode.Compress => CreateCompressor(userArgs, concurrency.Value),
         CompressionMode.Decompress => CreateDecompressor(userArgs, concurrency.Value),
         _ => throw new ArgumentException($"Not supported mode '{userArgs.CompressionMode}'")
     });
Exemplo n.º 9
0
        //为登陆用户添加Id
        public void Register(object sender, UserArgs args)
        {
            var user = users.Where(p => p.helper.tcpClient.Client.RemoteEndPoint.ToString().Equals(args.IP)).FirstOrDefault();

            if (user != null)
            {
                user.UserId = args.Id;
            }
        }
Exemplo n.º 10
0
        private void RtcControl_UserLeftMeeting(object sender, UserArgs e)
        {
            var viewerControl = currParticipants.First(participant => participant.Session == e.Session).Viewer;

            RemoveAdorner(rtcControl, e.Session);
            videoList.Children.RemoveAt(currParticipants.First(participant => participant.Session == e.Session).ElementPosition);
            currParticipants.RemoveAll(x => x.Session == e.Session);

            viewerControl = null;
        }
Exemplo n.º 11
0
        public Page <T_UNIT> QueryList(int pageIndex, int pageSize, bool isAsc, UserArgs args)
        {
            Page <T_UNIT> result = new Page <T_UNIT>();

            result.Count = context.T_PERSON.Count();
            List <T_UNIT> list = context.T_UNIT.OrderByDescending(x => x.S_ID).Skip(((pageIndex - 1) * pageSize)).Take(pageSize).Select(s => s).ToList();

            result._PageList = list;
            return(result);
        }
Exemplo n.º 12
0
        private void RtcControl_IJoinedMeeting(object sender, UserArgs e)
        {
            model.AppTitle = Const.title + " - In Meeting " + e.MeetingID;
            ShowMessage("Welcome to Meeting : " + e.MeetingID, System.Windows.Media.Brushes.DarkSlateBlue, true);

            AttachLoadingAdorner(rtcControl, e.UserName, e.Session);

            //start viewing sessions other than e.Session whcih is my session

            ProcessParticipants(e.Participants);
        }
Exemplo n.º 13
0
        private void RtcControl_IJoinedMeeting(object sender, UserArgs e)
        {
            ShowMessage("Welcome to Meeting : " + e.MeetingID, System.Windows.Media.Brushes.DarkSlateBlue, true);

            myAdorner = AttachLoadingAdorner(rtcControl, e.UserName);

            //if you do not want to start the participant video right away remove this ..
            rtcControl.StartVideo();

            //start viewing sessions other than e.Session which is my session
            ProcessParticipants(e.Participants, e.Session, e.Sharing);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Получить список всех пользователей системы
        /// </summary>
        /// <returns></returns>
        public async Task <PagedResult <UserDto> > GetListUsers(UserArgs userArgs)
        {
            await _crmDbContext.User.LoadAsync();

            var predicat = PredicateBuilder.New <User>(true);

            if (userArgs.DateBegin != null)
            {
                predicat.And(user => user.CreateDate.Value >= userArgs.DateBegin);
            }
            if (userArgs.DateEnd != null)
            {
                predicat.And(user => user.CreateDate <= userArgs.DateEnd);
            }
            if (!string.IsNullOrWhiteSpace(userArgs.Email))
            {
                predicat.And(user => user.Email.Contains(userArgs.Email));
            }
            if (userArgs.IsDeleted == true)
            {
                predicat.And(user => user.IsDeleted == true);
            }
            if (userArgs.IsDeleted == false)
            {
                predicat.And(user => user.IsDeleted == false);
            }
            if (!string.IsNullOrWhiteSpace(userArgs.Login))
            {
                predicat.And(user => user.Account.Contains(userArgs.Login));
            }
            if (!string.IsNullOrWhiteSpace(userArgs.FullName))
            {
                predicat.And(user =>
                             $"{user.Surname} {user.Name} {user.Middlename}".Contains(userArgs.FullName));
            }
            var result = _crmDbContext.User.Where(predicat).GetPaged(userArgs.Page, userArgs.PageSize, convert =>
            {
                return(convert.Select(s => new UserDto
                {
                    Id = s.Id,
                    Account = s.Account,
                    FullName = $"{s.Surname} {s.Name} {s.Middlename}",
                    ShortName = $"{s.Surname} {s.Name.Substring(0, 1)}.{s.Middlename.Substring(0, 1)}.",
                    Email = s.Email,
                    Phone = s.Phone,
                    TypeUser = s.TypeUser == null ? string.Empty : s.TypeUser.Name
                }));
            });

            return(result);
        }
Exemplo n.º 15
0
        public static void UserAdd()
        {
            UserArgs args = (UserArgs)PSCDialog.DataShare;
            User     user = ((UserArgs)PSCDialog.DataShare).User;
            CustomMembershipProvider customMembership = new CustomMembershipProvider();

            user.Password = customMembership.TransformPassword(user.Password);
            bool validate = customMembership.ValidateUserNameAndEmail(user);

            if (user.Name.Trim() == "" || validate == false)
            {
                return;
            }
            UserList.AddDB(user);
            // roles of user
            UserInRoleCollection userInRoleCollection = new UserInRoleCollection();
            UserInRole           userInRole           = null;
            string subdomain = SessionHelper.GetSession(SessionKey.SubDomain);

            if (!(subdomain == Guid.Empty.ToString())) // thuoc it nhat 1 subdomain
            {
                UserInSubDomainCollection userInSubDomainCollection = new UserInSubDomainCollection();
                UserInSubDomain           userInSubDomain           = new UserInSubDomain();
                userInSubDomain.UserId      = user.Id;
                userInSubDomain.SubDomainId = new Guid(subdomain);
                userInSubDomainCollection.AddDB(userInSubDomain);
                // administrators
                if (args.IsAdministrator)
                {
                    Role roleAdministrator = RoleCollection.GetRoleCollection()
                                             .Single(r => r.Name == System.Configuration.ConfigurationManager.AppSettings["GroupAdmin"]);
                    userInRole        = new UserInRole();
                    userInRole.RoleId = roleAdministrator.Id;
                    userInRole.UserId = user.Id;
                    userInRoleCollection.AddDB(userInRole);
                }
            }
            else // subdomain : all
            {
                // administrators
                if (args.IsAdministrator)
                {
                    Role roleAdministrator = RoleCollection.GetRoleCollection().Single(r => r.Name == System.Configuration.ConfigurationManager.AppSettings["GroupAdmin"]);
                    userInRole        = new UserInRole();
                    userInRole.RoleId = roleAdministrator.Id;
                    userInRole.UserId = user.Id;
                    userInRoleCollection.AddDB(userInRole);
                }
            }
            DataStatic["DisplayUserList"] = null;
        }
Exemplo n.º 16
0
        public async Task <UserResponse> GetUser(UserArgs userArgs)
        {
            var uri = new Uri(_baseAddress + "users/Get");

            var message = new HttpRequestMessage(HttpMethod.Post, uri)
            {
                Content = new StringContent(JsonConvert.SerializeObject(userArgs), Encoding.UTF8, "application/json")
            };

            var response = await GetResponse <UserResponse>(message);

            GetHeaders();

            return(response);
        }
Exemplo n.º 17
0
        private async Task <UserResponse> GetUser(string userName, string password)
        {
            try
            {
                var userArgs = new UserArgs(userName, password);

                var user = await _apiClient.GetUser(userArgs);

                return(user);
            }
            catch (System.Exception)
            {
                return(new UserResponse("0"));
            }
        }
Exemplo n.º 18
0
        private void IconfRTC_ILeftMeeting(object sender, UserArgs e)
        {
            btnLeaveMeeting.Visible = false;
            pnlJoin.Enabled         = true;
            pnlLayout.Hide();
            this.Text = "iConfRTC Winform Demo App";

            // Remove all viewer controls from panelLayout

            foreach (var item in currParticipants)
            {
                item.RTCControl.Dispose();
                pnlLayout.Controls.Remove(item.PanelLayout);
                item.PanelLayout.Dispose();
            }

            currParticipants.Clear();
        }
        public async Task UpdateUserHttpError()
        {
            var handler = new MockMessageHandler()
            {
                StatusCode = HttpStatusCode.InternalServerError,
            };
            var userManager  = this.CreateFirebaseUserManager(handler);
            var customClaims = new Dictionary <string, object>()
            {
                { "admin", true },
            };
            var args = new UserArgs()
            {
                Uid          = "user1",
                CustomClaims = customClaims,
            };

            await Assert.ThrowsAsync <FirebaseException>(async() => await userManager.UpdateUserAsync(args));
        }
Exemplo n.º 20
0
        private void RtcControl_ILeftMeeting(object sender, UserArgs e)
        {
            foreach (var item in currParticipants)
            {
                videoList.Children.RemoveAt(item.ElementPosition);
                //viewerControl = null;
            }

            currParticipants.Clear();
            var layer = AdornerLayer.GetAdornerLayer(rtcControl);

            layer.Remove(myAdorner);

            rtcControl.Visibility  = System.Windows.Visibility.Hidden;
            gridLanding.Visibility = System.Windows.Visibility.Visible;
            gridHead.Visibility    = System.Windows.Visibility.Visible;

            ShowMessage("You left the Meeting : " + e.MeetingID);
        }
Exemplo n.º 21
0
        public static void UserUpdate()
        {
            UserArgs args = PSCDialog.DataShare as PSCPortal.Security.UserArgs;
            CustomMembershipProvider customMembership = new CustomMembershipProvider();
            bool validate = customMembership.ValidateEmail(args.User);

            if (validate == false)
            {
                return;
            }
            args.User.Update();
            string               groupAdmin           = System.Configuration.ConfigurationManager.AppSettings["GroupAdmin"];
            RoleCollection       rolesOfUser          = RoleCollection.GetRoleCollection(args.User.Name);
            Role                 roleAdmin            = rolesOfUser.SingleOrDefault(r => r.Name == groupAdmin);
            UserInRoleCollection userInRoleCollection = new UserInRoleCollection();
            UserInRole           userInRole           = null;

            if (args.IsAdministrator)
            {
                // if user exist role administrator
                if (roleAdmin == null)
                {
                    userInRole = new UserInRole();
                    Role radmin = RoleCollection.GetRoleCollection().Single(r => r.Name == groupAdmin);
                    userInRole.RoleId = radmin.Id;
                    userInRole.UserId = args.User.Id;
                    userInRoleCollection.AddDB(userInRole);
                }
            }
            else
            {
                if (roleAdmin != null)
                {
                    userInRole        = new UserInRole();
                    userInRole.RoleId = roleAdmin.Id;
                    userInRole.UserId = args.User.Id;
                    userInRoleCollection.Add(userInRole);
                    userInRoleCollection.RemoveDB(userInRole);
                }
            }
            DataStatic["DisplayUserList"] = null;
            DataStatic["UserList"]        = null;
        }
        public void UpdateUserNoUid()
        {
            var handler = new MockMessageHandler()
            {
                Response = @"{""localId"": ""user1""}",
            };
            var userManager  = this.CreateFirebaseUserManager(handler);
            var customClaims = new Dictionary <string, object>()
            {
                { "key", "value" },
            };

            var args = new UserArgs()
            {
                CustomClaims = customClaims,
            };

            Assert.ThrowsAsync <ArgumentException>(async() => await userManager.UpdateUserAsync(args));
        }
        public async Task UpdateUserIncorrectResponseUid()
        {
            var handler = new MockMessageHandler()
            {
                Response = @"{""localId"": ""notuser1""}",
            };
            var userManager  = this.CreateFirebaseUserManager(handler);
            var customClaims = new Dictionary <string, object>()
            {
                { "admin", true },
            };

            var args = new UserArgs()
            {
                Uid          = "user1",
                CustomClaims = customClaims,
            };
            await Assert.ThrowsAsync <FirebaseException>(async() => await userManager.UpdateUserAsync(args));
        }
Exemplo n.º 24
0
        private void RtcControl_ILeftMeeting(object sender, UserArgs e)
        {
            foreach (var item in currParticipants)
            {
                var viewerControl = item.Viewer;

                videoList.Children.RemoveAt(item.ElementPosition);
                viewerControl = null;
            }

            currParticipants.Clear();

            rtcControl.Visibility  = System.Windows.Visibility.Hidden;
            gridLanding.Visibility = System.Windows.Visibility.Visible;
            gridHead.Visibility    = System.Windows.Visibility.Visible;
            model.AppTitle         = Const.title;
            RemoveAdorner(rtcControl, e.Session);
            ShowMessage("You left the Meeting : " + e.MeetingID);
        }
        public void LargeClaimsOverLimit()
        {
            var handler = new MockMessageHandler()
            {
                Response = @"{""localId"": ""user1""}",
            };
            var userManager = this.CreateFirebaseUserManager(handler);
            var largeClaims = new Dictionary <string, object>()
            {
                { "testClaim", new string('a', 1001) },
            };

            var args = new UserArgs()
            {
                Uid          = "user1",
                CustomClaims = largeClaims,
            };

            Assert.ThrowsAsync <ArgumentException>(async() => await userManager.UpdateUserAsync(args));
        }
Exemplo n.º 26
0
        private void IconfRTC_UserLeftMeeting(object sender, UserArgs e)
        {
            var participant = currParticipants.FirstOrDefault(x => x.Session == e.Session);

            if (participant != null)
            {
                var ctrlToRemove = participant.PanelLayout;

                //dispose of the RTC Control
                participant.RTCControl.Dispose();

                //remove the appropriate panel layout
                pnlLayout.Controls.Remove(ctrlToRemove);

                ctrlToRemove.Dispose();

                //a user has left the meeting .. remove the RTCControl that is showing its session
                currParticipants.RemoveAll(x => x.Session == e.Session);
            }
        }
Exemplo n.º 27
0
        private void IconfRTC_IJoinedMeeting(object sender, UserArgs e)
        {
            //I have joined a meeting
            iconfRTC.Visible = true;
            pnlJoin.Hide();
            pnlLayout.Show();
            ((OutlookPanelEx)pnlLayout.Controls[0]).HeaderText = iconfRTC.MyUserName;

            Text = @"iConfRTC Winform Demo App -" + e.UserName + @", Welcome to " + e.MeetingID;

            btnLeaveMeeting.Visible = true;

            ShowStatus("You joined " + e.MeetingID);

            //joined the meeting now lets start the video
            iconfRTC.StartVideo();

            //I need to add the video of the particpants to the layout control.
            ProcessParticipants(e.Participants, e.Session, e.Sharing);
        }
        public void ReservedClaims()
        {
            var handler = new MockMessageHandler()
            {
                Response = @"{""localId"": ""user1""}",
            };
            var userManager = this.CreateFirebaseUserManager(handler);

            foreach (var key in FirebaseTokenFactory.ReservedClaims)
            {
                var customClaims = new Dictionary <string, object>()
                {
                    { key, "value" },
                };

                var args = new UserArgs()
                {
                    Uid          = "user1",
                    CustomClaims = customClaims,
                };
                Assert.ThrowsAsync <ArgumentException>(async() => await userManager.UpdateUserAsync(args));
            }
        }
Exemplo n.º 29
0
        private void RtcControl_UserLeftMeeting(object sender, UserArgs e)
        {
            try
            {
                if (currParticipants == null || currParticipants.Count == 0)
                {
                    return;
                }

                var currParticipant = currParticipants.First(participant => participant.Session == e.Session);

                if ((currParticipant != null) &&
                    (videoList.Children[currParticipant.ElementPosition] != null))
                {
                    videoList.Children.RemoveAt(currParticipant.ElementPosition);
                }

                currParticipants.RemoveAll(x => x.Session == e.Session);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
        }
Exemplo n.º 30
0
 public Page <T_UNIT> QueryList(int pageIndex, int pageSize, bool isAsc, UserArgs args)
 {
     return(_UnitOperate.QueryList(pageIndex, pageSize, isAsc, args));
 }