本文整理匯總了C#中WebService.venuesEntities.AddTotbl_sys_user方法的典型用法代碼示例。如果您正苦於以下問題:C# venuesEntities.AddTotbl_sys_user方法的具體用法?C# venuesEntities.AddTotbl_sys_user怎麽用?C# venuesEntities.AddTotbl_sys_user使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WebService.venuesEntities
的用法示例。
在下文中一共展示了venuesEntities.AddTotbl_sys_user方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SaveUser
/// <summary>
/// 保存用戶
/// </summary>
/// <param name="curUserId"></param>
/// <param name="loginName"></param>
/// <param name="userName"></param>
/// <param name="userTypeId"></param>
/// <returns></returns>
public static string SaveUser(int curUserId, string loginName, string userName, int userTypeId, string loginUserInfo)
{
string returnStr = "";
string logInfo = "";
Boolean ishasUser = false;
try
{
using (venuesEntities db = new venuesEntities())
{
string strSql = string.Format("SELECT u.User_LoginName FROM tbl_sys_user as u where u.User_LoginName='{0}'", loginName);
ObjectQuery<DbDataRecord> results = db.CreateQuery<DbDataRecord>(strSql);
foreach (var ks in results)
{
ishasUser = true;
}
if (!ishasUser)
{
tbl_sys_user ue = new tbl_sys_user();
ue.User_LoginName = loginName;
ue.User_Name = userName;
ue.User_TypeId = userTypeId;
ue.User_Password =GeneralFuction.MD5Encrypt(KeyManager.Default_Pwd);
db.AddTotbl_sys_user(ue);
logInfo = "User_LoginName=" + loginName + ",User_Name=" + userName + ",User_TypeId=" + userTypeId + ",User_Password = " + KeyManager.Default_Pwd;
if (db.SaveChanges() != 0)
{
int newUserId = GetNewUserID();
if (newUserId != 0)
{
string sysUserMenus = "";
//如果用戶類型為場所管理員,默認菜單為
//係統用戶:係統管理,場所管理,資源管理,遊客管理,模板管理,頁麵審核,新聞管理,手冊設置,手冊發布
sysUserMenus = ""+KeyManager.MENUS.Menu_SystemManager+","+KeyManager.MENUS.Menu_SystemUsersManager+","+KeyManager.MENUS.Menu_Authority+","+KeyManager.MENUS.Menu_LogsManager+","+
KeyManager.MENUS.Menu_VenusManager+","+KeyManager.MENUS.Menu_ResourceManager+","+KeyManager.MENUS.Menu_VisitorManager+","+KeyManager.MENUS.Menu_ModulesManager+","+
KeyManager.MENUS.Menu_PageAuditManager+","+KeyManager.MENUS.Menu_NewsManager+","+KeyManager.MENUS.Menu_HandBookSetManager+","+KeyManager.MENUS.Menu_HandBookPublishManager;
AuthorityManager.AddAuthority(newUserId);
AuthorityManager.EditAuthorityByUserId(curUserId, newUserId, sysUserMenus, KeyManager.UserTypeId_SystemUser, loginUserInfo);
}
returnStr = "成功!";
}
else
returnStr = "不成功!";
}
else
{
returnStr = "不成功,已有登錄名為“"+loginName+"”的用戶。";
}
}
}
catch (Exception e)
{
LogManager.addLog(KeyManager.LogTypeId_Error, KeyManager.MENUS.Menu_SystemUsersManager, "新增用戶," + logInfo + ",錯誤信息:" + e.Message, loginUserInfo);
}
LogManager.addLog(KeyManager.LogTypeId_Option, KeyManager.MENUS.Menu_SystemUsersManager, "新增用戶," + logInfo, loginUserInfo);
return returnStr;
}