Пример #1
0
        public int Insert(UserVM form)
        {
            //string sql = "insert into Sys_User (UserName) values (@0)";
            //SqlParameter[] parameter = new SqlParameter[] {
            //    new SqlParameter("@0", SqlDbType.VarChar, 50)
            //};
            //parameter[0].Value = user.UserName;

            //return this.userRepository.ExecuteSqlCommand(ContextDB.managerDBContext, sql, parameter);
            //return this.userRepository.Insert(ContextDB.managerDBContext, user);

            //SqlParameter[] parameters = {
            //          new SqlParameter("@UserName", user.UserName),
            //          new SqlParameter("@Ret", SqlDbType.Int)
            //};
            //parameters[1].Direction = ParameterDirection.Output;

            //var result = ContextDB.managerDBContext.Database.ExecuteSqlCommand("exec proc_userInsert @UserName, @Ret out", parameters);
            //int ret = (int)parameters[1].Value;

            //            SqlParameter[] p =
            //{
            //                SqlHelper.MakeInParam("@UserId",SqlDbType.VarChar,20,UserId),
            //                SqlHelper.MakeInParam("@Pwd",SqlDbType.VarChar,50,Pwd)
            //            };

            Sys_User model = new Sys_User();

            Ext.CopyFrom(model, form);
            model.UpdateDate = DateTime.Now;
            model.Password   = MD5Encrypt.Encrypt(model.Password);

            return(this._userRepository.Insert(ContextDB.managerDBContext, model));
        }
Пример #2
0
        public int Insert(ModuleVM form)
        {
            if (string.IsNullOrEmpty(form.Name))
            {
                throw new BaseException(SuperConstants.AJAX_RETURN_STATE_ERROR, "模块名称为空");
            }
            if (form.ParentId == 0)
            {
                throw new BaseException(SuperConstants.AJAX_RETURN_STATE_ERROR, "上级模块为空");
            }
            if (string.IsNullOrEmpty(form.LinkUrl))
            {
                throw new BaseException(SuperConstants.AJAX_RETURN_STATE_ERROR, "链接地址为空");
            }
            if (form.Code == 0)
            {
                throw new BaseException(SuperConstants.AJAX_RETURN_STATE_ERROR, "模块编号为空");
            }

            Sys_Module module = new Sys_Module();

            Ext.CopyFrom(module, form);
            module.IsMenu     = true;
            module.UpdateDate = DateTime.Now;

            return(this._moduleRepository.Insert(ContextDB.managerDBContext, module));
        }
Пример #3
0
        public int Insert(UserGroupVM form)
        {
            Sys_UserGroup model = new Sys_UserGroup();

            Ext.CopyFrom(model, form);
            model.UpdateDate = DateTime.Now;

            return(this._userGroupRepository.Insert(ContextDB.managerDBContext, model));
        }
Пример #4
0
        public int Insert(UserRoleVM form)
        {
            Sys_Role model = new Sys_Role();

            Ext.CopyFrom(model, form);
            model.UpdateDate = DateTime.Now;

            return(this._roleRepository.Insert(ContextDB.managerDBContext, model));
        }
Пример #5
0
        public int Insert(PermissionVM form)
        {
            Sys_Permission module = new Sys_Permission();

            Ext.CopyFrom(module, form);
            module.UpdateDate = DateTime.Now;

            return(this._permissionRepository.Insert(ContextDB.managerDBContext, module));
        }