Esempio n. 1
0
        void UserEmailEventMoudle_After(User sender, CreateUserEventArgs eventArgs)
        {
            EmailService emailService = new EmailService();

            //发送注册成功邮件
            emailService.SendAsyn(EmailBuilder.Instance().RegisterSuccess(eventArgs.Password, sender));
        }
            // Occurs whenever create user report has been provided and required to be committed.
            private void OnReportDataUploadRequired(object sender, CreateUserEventArgs e)
            {
                // Displays appropriate logs/application state/user instructions text to the user.
                this._consolesServices.OnCreateUser_UploadingReportDataBegan(sender, e);

                // Attempt to commit create user data
                Task createUserTask = this._userServices.CreateAsync(e.Username, e.FirstName, e.Surname, e.UserType);

                createUserTask.ContinueWith((t) =>
                {
                    switch (t.Status)
                    {
                    case TaskStatus.RanToCompletion:
                        // ... execute if user creation has been committed successfully
                        this.OnReportDataUploadSucceed(sender, e);
                        break;

                    case TaskStatus.Faulted:
                        // ... execute if user creation has fail to commit
                        this.OnReportDataUploadFailed(sender, e);
                        break;

                    case TaskStatus.Canceled:
                        // ... execute if user creation has been canceled to commit
                        this.OnReportDataUploadCanceled(sender, e);
                        break;
                    }
                }, TaskScheduler.FromCurrentSynchronizationContext());
            }
Esempio n. 3
0
        /// <summary>
        /// 创建用户的时候修改积分
        /// </summary>
        /// <param name="sender">创建用户角色</param>
        /// <param name="eventArgs">参数</param>
        void RegisterEventModule_After(User sender, CreateUserEventArgs eventArgs)
        {
            PointService pointService = new PointService();
            string       description  = string.Format(ResourceAccessor.GetString("PointRecord_Pattern_Register"), sender.UserName);

            pointService.GenerateByRole(sender.UserId, PointItemKeys.Instance().Register(), description);
        }
            // Occurs whenever user creation data get uploaded successfully
            private void OnReportDataUploadSucceed(object sender, CreateUserEventArgs e)
            {
                // Displays appropriate logs informing user that application successfully committed the data.
                this._consolesServices.OnCreateUser_ReportDataUploadSucceed(sender, e);

                // Enables/Disables appropriate controls.
                this._controlsEnabler.OnCreateUser_ReportDataUploadSucceed(sender, e);
            }
            // Occurs whenever create user data failed to get uploaded.
            private void OnReportDataUploadFailed(object sender, CreateUserEventArgs e)
            {
                // Displays appropriate logs informing user about failed data upload.
                this._consolesServices.OnCreateUser_ReportDataUploadFailed(sender, e);

                // Informs user about application failed to create user and as such being unable to continue.
                MessageBox.Show("Application failed to create user and add it into the users list and must be closed.", "Create User failed.", MessageBoxButtons.OK);

                // Close the application.
                this._form.Close();
            }
Esempio n. 6
0
        /// <summary>
        /// 初始化用户的应用
        /// </summary>
        /// <param name="sender">用户实体</param>
        /// <param name="eventArgs">事件参数</param>
        private void InitAppForUserEventMoudle_After(User sender, CreateUserEventArgs eventArgs)
        {
            if (sender == null)
            {
                return;
            }

            applicationService.InstallApplicationsOfPresentAreaOwner(PresentAreaKeysOfBuiltIn.UserSpace, sender.UserId);

            var presentArea = new PresentAreaService().Get(PresentAreaKeysOfBuiltIn.UserSpace);

            new ThemeService().ChangeThemeAppearanceUserCount(PresentAreaKeysOfBuiltIn.UserSpace, null, presentArea.DefaultThemeKey + "," + presentArea.DefaultAppearanceKey);
        }
Esempio n. 7
0
 void NoEmailNotice(User sender, CreateUserEventArgs eventArgs)
 {
     if (string.IsNullOrEmpty(sender.AccountEmail))
     {
         NoticeService noticeService = new NoticeService();
         Notice        notice        = Notice.New();
         notice.TemplateName    = "NoEmailNotice";
         notice.TypeId          = NoticeTypeIds.Instance().Hint();
         notice.LeadingActorUrl = SiteUrls.Instance().EditUserProfile(sender.UserName);
         notice.UserId          = sender.UserId;
         notice.Status          = NoticeStatus.Unhandled;
         noticeService.Create(notice);
     }
 }
            // Occurs whenever create user data canceled to get uploaded.
            private void OnReportDataUploadCanceled(object sender, CreateUserEventArgs e)
            {
                // Displays appropriate logs informing user that application canceled data upload
                this._consolesServices.OnCreateUser_ReportDataUploadCanceled(sender, e);
                this._consolesServices.OnBackToIdle(sender, e);

                // Clears the content of all of the main form text boxes displaying User/Satur5 etc. data.
                this._dataDisplayServices.ClearAllDataDisplayTextBoxes(sender, e);

                // Clears info boxes
                this._dataDisplayServices.ClearInfoBoxes(sender, e);

                // Enables/Disables appropriate controls.
                this._controlsEnabler.OnCreateUser_ReportDataUploadCanceled(sender, e);
            }
Esempio n. 9
0
 void WhenCreateUser(object sender, CreateUserEventArgs e)
 {
     try
     {
         var dock = new DockServer();
         using (var db = dock.CopySource)
         {
             var sql = "REPLACE INTO user(mt4 ,user_code) VALUES(@mt4_id, @user_code)";
             using (var cmd = new SQLiteCommand(sql, db))
             {
                 cmd.Parameters.AddWithValue("@mt4_id", e.MT4ID);
                 cmd.Parameters.AddWithValue("@user_code", e.Usercode);
                 cmd.ExecuteNonQuery();
             }
         }
     }
     catch (Exception exp)
     {
         Utils.CommonLog.Error("保存开户邀请码出错,MT4:{0},usercode:{1},{2},{3}",
                               e.MT4ID, e.Usercode, exp.Message, exp.StackTrace);
     }
 }
Esempio n. 10
0
 /// <summary>
 /// Raises the oncreateuser event.
 /// </summary>
 /// <param name="args">The <see cref="Rendition.CreateUserEventArgs"/> instance containing the event data.</param>
 internal void raiseOnCreateUser( CreateUserEventArgs args )
 {
     if( CreatingUser != null ) { CreatingUser( this, args ); };
 }