Guid createuser (string username, string password, string email, string comment, string passwordquestion, string passwordanswer, bool isapproved, 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. website user}, null, new guid [] {companyid}, out createstatus );
Using (transactionscope Ts = new transactionscope ())
{
Try
{
Guid companyId = membershipApi. createCompany (null, this. textBoxCompanyName. text, BH. companyTypes. website user, null, CompanyStatus. enabled, null, new EntityElement (BH. entityTypes. registered enterprise ));
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. website user}, 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 ();