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

     

     

     

     

     

  • 相关阅读:
    负数之美
    css重设
    编码问题
    wed的各种前端打印方法(3)CSS
    表单
    学习前端心得
    去除input,a,按键链接时出现的虚线方法
    加载事件js代码
    深入C#数据类型
    查找
  • 原文地址:https://www.cnblogs.com/duwamish/p/1342263.html
Copyright © 2011-2022 走看看