本文整理汇总了C#中CMModel.DBManager.AddNewAccount方法的典型用法代码示例。如果您正苦于以下问题:C# DBManager.AddNewAccount方法的具体用法?C# DBManager.AddNewAccount怎么用?C# DBManager.AddNewAccount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMModel.DBManager
的用法示例。
在下文中一共展示了DBManager.AddNewAccount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetOrAddAccountByAccountText
// Account
public AccountD GetOrAddAccountByAccountText(string accountText, HostType hostType)
{
DBManager db = new DBManager();
string accountTypeName = AccountTypeDB.FromTypeCodeToString(hostType);
AccountD account = db.GetAccountByUserNameAndAccountTypeName(accountText, accountTypeName);
if(account == null) // add new
{
AccountType type = db.GetAccountTypeByName(accountTypeName);
int accountID = db.AddNewAccount(accountText, "", type.Id);
account = db.GetAccountById(accountID);
}
account.HostType = hostType;
return account;
}
示例2: GetOrAddAccountByAccountText
// Account
public AccountDB GetOrAddAccountByAccountText(string accountText)
{
DBManager db = new DBManager();
HostType hostType = MyUtils.GetHostTypeFromAccount(accountText);
string accountTypeName = AccountTypeDB.FromTypeCodeToString(hostType);
AccountDB account = db.GetAccountByUserNameAndAccountTypeName(accountText, accountTypeName);
if(account.Id <= 0) // add new
{
AccountTypeDB type = db.GetAccountTypeByName(accountTypeName);
int accountID = db.AddNewAccount(accountText, "", type.Id);
account = db.GetAccountById(accountID);
account.HostType = hostType;
}
account.AccountTypeName = accountTypeName;
return account;
}
示例3: AddNewAccount
public int AddNewAccount(string username, string password, int accountTypeId)
{
DBManager db = new DBManager();
return db.AddNewAccount(username, password, accountTypeId);
}
示例4: CheckUpdateAccount
public int CheckUpdateAccount(int id, string user, string pass, int a_type)
{
DBManager db = new DBManager();
int contactCount = db.GetContactCountByAccountId(id);
if (contactCount == 0)
{
AccountDB acc = db.GetAccountByUserNameAndAccountTypeId(user, a_type);
int accId = acc.Id;
accId = accId > 0 ? accId : id;
return (db.UpdateAccountById(accId, user, pass, a_type) > 0 ? accId : -1);
}
else
{
AccountD account = db.GetAccountById(id);
if (account.UserName.Equals(user) && account.AccountTypeId == a_type)
{
return (db.UpdateAccountById(id, user, pass, a_type) > 0 ? id : -1);
}
else
{
AccountDB acc = db.GetAccountByUserNameAndAccountTypeId(user, a_type);
int accId = acc.Id;
if (accId > 0)
{
return (db.UpdateAccountById(accId, user, pass, a_type) > 0 ? accId : -1);
}
else
{
return db.AddNewAccount(user, pass, a_type);
}
}
}
}