当前位置: 首页>>代码示例>>C#>>正文


C# venuesEntities.AddTotbl_sys_user方法代码示例

本文整理汇总了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;
        }
开发者ID:zyyecho,项目名称:venues,代码行数:68,代码来源:UserManager.cs


注:本文中的WebService.venuesEntities.AddTotbl_sys_user方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。