Ejemplo n.º 1
0
        /// <summary>
        /// 新增动作信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static OperationResult AddAction(ActionAddModel model, int CreateUserID)
        {
            List <SqlParameter> paras = new List <SqlParameter>()
            {
                new SqlParameter("@ActionName", SqlDbType.NVarChar, 50),
                new SqlParameter("@ControllerID", SqlDbType.Int),
                new SqlParameter("@Description", SqlDbType.NVarChar, 50),
                new SqlParameter("@CreateUserID", SqlDbType.Int)
            };

            paras[0].Value = model.ActionName.Trim();
            paras[1].Value = model.ControllerID;

            if (string.IsNullOrWhiteSpace(model.Description))
            {
                paras[2].Value = DBNull.Value;
            }
            else
            {
                paras[2].Value = model.Description;
            }
            paras[3].Value = CreateUserID;



            string sql    = @"INSERT  INTO dbo.Actions( ActionName, ControllerID,Description,CreateUserID )VALUES  ( @ActionName, @ControllerID,@Description,@CreateUserID )";
            bool   result = MSSQLHelper.ExecuteNonQuery(CommandType.Text, sql, paras.ToArray()) > 0;

            return(new OperationResult()
            {
                Success = result,
                Message = result ? PromptInformation.OperationSuccess : PromptInformation.DBError
            });
        }
Ejemplo n.º 2
0
 public ActionResult AddActionInfo(ActionAddModel model)
 {
     if (ModelState.IsValid)
     {
         var result = ActionBLL.AddAction(model, base.UserIDForLog);
         base.DoLog(Model.OperationTypeEnum.Add, result, "ActionName:" + model.ActionName);
         return(Json(result));
     }
     else
     {
         int areaID = model.AreaID;
         var aList  = AreaBLL.GetAreas();
         model.AreasSelectList = new SelectList(aList, "ID", "AreaName", areaID);
         var cList = ControllerBLL.GetControllersByAreaID(areaID);
         model.ControllersSelectList = new SelectList(cList, "ID", "ControllerName", model.ControllerID);
         return(PartialView("_AddActionInfo", model));
     }
 }