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();

     

     

     

     

     

  • 相关阅读:
    尽量采用as操作符而不是旧式C风格做强制类型转换
    尽量使用条件属性(Conditional Attribute)而不是#if/#endif预处理
    C#跟踪和调试程序-Debug类使用
    C#使用ConditionalAttribute特性来实现代码调试
    微软认知服务:QnA Maker使用示例
    PHP使用微软认知服务Face API
    微软认知服务识别名人和地标
    基于apache httpclient 调用Face++ API
    认知服务调用如何使用图片的DataURL
    Microsoft Azure Storage Exployer使用指南
  • 原文地址:https://www.cnblogs.com/duwamish/p/1342263.html
Copyright © 2011-2022 走看看