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

     

     

     

     

     

  • 相关阅读:
    关于产品的一些想法
    js中this的问题
    C# webkit 内核浏览器 访问https 网站 提示 Problem with the SSL CA cert (path? access rights?)
    SSL握手中win xp和SNI的那点事
    VMware安装GHOST版XP不成功的解决
    Inno Setup入门(十二)——Pascal脚本(1)
    VS打包软件部署------ClickOnce应用安装 (各版本.net引导文件安装,再发布文档离线安装下载地址)
    利用VS自带的命令行工具查看和生产PublicKeyToken
    获取批处理文件所在路径
    Nginx Windows详细安装部署教程
  • 原文地址:https://www.cnblogs.com/duwamish/p/1342263.html
Copyright © 2011-2022 走看看