zoukankan      html  css  js  c++  java
  • Membership的一些随笔

     Guid CreateUser(string username, string password, string email, string comment, string passwordQuestion, string passwordAnswer, bool isApproved, ProfileData profileData, IList<string> roles, IList<string> permissions, IList<Guid> companies, out MembershipCreateStatus status);

     


    membershipApi.CreateUser(this.TextBoxUserName.Text.Trim(), this.TextBoxPassword.Text.Trim(), this.TextBoxEmail.Text, this.TextBoxComment.Text, null, null, true, profile, new[] { BH.Roles.网站用户 }, null, new Guid[] { companyId }, out createStatus);

    using (TransactionScope ts = new TransactionScope())
       {
        try
        {
         Guid companyId = membershipApi.CreateCompany(null, this.TextBoxCompanyName.Text, BH.CompanyTypes.网站用户, null, CompanyStatus.Enabled, null, new EntityElement(BH.EntityTypes.注册企业));
         MembershipCreateStatus createStatus;
         GenericProfileData profile = new GenericProfileData()
         {
           Phone = this.TextBoxPhone.Text
         };
         membershipApi.CreateUser(this.TextBoxUserName.Text.Trim(), this.TextBoxPassword.Text.Trim(), this.TextBoxEmail.Text, this.TextBoxComment.Text, null, null, true, profile, new[] { BH.Roles.网站用户 }, null, new Guid[] { companyId }, out createStatus);
         ts.Complete();
        }
        catch (InvalidOperationException exp)
        {
         this.MessagePanel.ShowWarning(exp.Message);
         return;
        }
        catch (Exception exp)
        {
         this.MessagePanel.ShowError(exp);
         Logger.Instance(this).Error(exp);
         return;
        }
       }

     

     

     

     

    UserStatus userStatus = (UserStatus)Enum.Parse(typeof(UserStatus), this.RadioButtonByUserStatus.SelectedValue);

       int recordsCount;
       var userElements = MembershipApi.FindUsers(this.TextBoxQueryByAgencyName.Text, null, userTypes.ToArray(), this.TextBoxQueryByUserName.Text, userStatus, pageIndex, this.Pager.PageSize, out recordsCount);
       this.RepeaterUsers.DataSource = userElements;
       this.RepeaterUsers.DataBind();

       this.LabelRecordCount.Text = recordsCount.ToString();
       this.Pager.RecordCount = recordsCount;
       this.Pager.CurrentPageIndex = pageIndex + 1;
       this.Pager.DataBind();

     

     

     

     

     

  • 相关阅读:
    每种特定的迭代器如何使用
    常量迭代器
    容器迭代器
    三十分钟掌握STL
    高快省的排序算法
    FloatTest32 Example
    /浮点数的比较
    java第一天
    ACwing 898
    POJ 3268
  • 原文地址:https://www.cnblogs.com/duwamish/p/1342263.html
Copyright © 2011-2022 走看看