Ejemplo n.º 1
0
        public void AddFunctionTest()
        {
            #region arrange (新增成功)

            FunctionVO functionVO = new FunctionVO()
            {
                Url = "Role/RoleManagement", Title = "角色管理", Description = "瀏覽角色管理畫面", IsMenu = true, Parent = 0
            };

            string reMessage = "";

            _functionBO.Stub(o => o.AddFunction(Arg <FunctionVO> .Is.Anything)).Return(reMessage);

            #endregion

            #region act

            var result = _target.AddFunction(functionVO);

            #endregion

            #region assert

            Assert.IsTrue(string.IsNullOrEmpty(result));

            #endregion
        }
Ejemplo n.º 2
0
 public ActionResult Add(PermissionModel model)
 {
     if (ModelState.IsValid)
     {
         model.CreatedBy = CurrentUser.LoginName;
         model.UpdatedBy = CurrentUser.LoginName;
         _funService.AddFunction(model);
         return(Json(AjaxResult.Success()));
     }
     else
     {
         var erros = GetModelErrors();
         return(Json(AjaxResult.Fail(erros)));
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 添加某项用途
        /// </summary>
        /// <param name="groupID"></param>
        /// <returns></returns>
        public static bool AddFunction(Function fl)
        {
            //SqlParameter[] Parameters = new SqlParameter[4];

            //Parameters[0] = new SqlParameter("@FunctionName", SqlDbType.NVarChar);
            //Parameters[1] = new SqlParameter("@UrlPath", SqlDbType.VarChar);
            //Parameters[2] = new SqlParameter("@Description", SqlDbType.NVarChar);
            //Parameters[3] = new SqlParameter("@orderFlag", SqlDbType.TinyInt);



            //Parameters[0].Value = fl.functionName;
            //Parameters[1].Value = fl.urlPath;
            //Parameters[2].Value = fl.description;
            //Parameters[3].Value = fl.orderFlag;


            //int result = SqlHelper.ExecuteNonQuery(SqlHelper.SqlCon_QJVRMS, CommandType.StoredProcedure, "Function_AddFunction", Parameters);
            //return result == 1;
            FunctionService fs = new FunctionService();

            return(fs.AddFunction(fl.FunctionName, fl.UrlPath, fl.Description, fl.OrderFlag, fl.ParentFunctionId));
        }