Exemplo n.º 1
0
        public ActionResult Action(ActionEditModel model)
        {
            if (TryUpdateModel(model, "EditModel"))
            {
                if (ModelState.IsValid)
                {
                    switch (model.Type)
                    {
                    case ActionType.Seat:
                        _processService.Seat(model.PlayerId, model.Amount, model.GameProcessId);
                        break;

                    case ActionType.Rebuy:
                        _processService.Rebuy(model.PlayerId, model.Amount, model.GameProcessId);
                        break;

                    case ActionType.SeatOut:
                        _processService.SeatOut(model.PlayerId, model.Amount, model.GameProcessId);
                        break;
                    }
                }
            }

            return(RedirectToAction("Edit", new { id = model.GameProcessId }));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 修改动作信息
        /// <para></para>
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static OperationResult ModifyAction(ActionEditModel model, int EditUserID)
        {
            List <SqlParameter> paras = new List <SqlParameter>()
            {
                new SqlParameter("@ControllerID", SqlDbType.Int),
                new SqlParameter("@ActionName", SqlDbType.NVarChar, 50),
                new SqlParameter("@ID", SqlDbType.Int),
                new SqlParameter("@Description", SqlDbType.NVarChar, 50),
                new SqlParameter("@EditUserID", SqlDbType.Int),
                new SqlParameter("@EditTime", SqlDbType.DateTime)
            };

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

            if (string.IsNullOrWhiteSpace(model.Description))
            {
                paras[3].Value = DBNull.Value;
            }
            else
            {
                paras[3].Value = model.Description;
            }
            paras[4].Value = EditUserID;
            paras[5].Value = DateTime.Now;



            string sql    = "UPDATE Actions SET ActionName=@ActionName,ControllerID=@ControllerID,Description=@Description,EditUserID=@EditUserID,EditTime=@EditTime WHERE ID=@ID";
            int    result = MSSQLHelper.ExecuteNonQuery(CommandType.Text, sql, paras.ToArray());

            string msg = string.Empty;

            switch (result)
            {
            case 1:
                msg = PromptInformation.OperationSuccess;
                break;

            case 0:
                msg = PromptInformation.NotExists;
                break;

            case -1:
                msg = PromptInformation.DBError;
                break;
            }
            return(new OperationResult()
            {
                Success = result > 0,
                Message = msg
            });
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Create(ActionEditModel model)
        {
            if (model is null)
            {
                return(BadRequest());
            }

            var entity = Models.Action.Create(model.Name, model.Description);

            _context.Actions.Add(entity);
            await _context.SaveChangesAsync();

            return(Ok(entity));
        }
Exemplo n.º 4
0
        public ActionResult Edit(ActionEditModel model)
        {
            if (ModelState.IsValid)
            {
                short systemMessageId = 0, levelId = 0;
                byte  sysMessageTypeId = 0;
                model.SystemStatus = SystemStatus.Error;
                if (model.ParentActionId > 0)
                {
                    Actions parentAction = new Actions().Get(model.ParentActionId);
                    if (parentAction.ActionId > 0)
                    {
                        levelId = (short)(parentAction.LevelId + 1);
                    }
                }
                var action = new Actions
                {
                    ActionId       = model.ActionId,
                    ActionName     = model.ActionName,
                    ActionDesc     = model.ActionDesc,
                    Url            = model.Url.TrimmedOrDefault(string.Empty),
                    ParentActionId = model.ParentActionId,
                    ActionOrder    = model.ActionOrder,
                    Display        = byte.Parse(model.Display ? "1" : "0"),
                    ActionStatusId = model.ActionStatusId,
                    LevelId        = levelId
                };
                sysMessageTypeId = model.ActionId > 0 ? action.Update(0, _userId, ref systemMessageId) : action.Insert(0, _userId, ref systemMessageId);

                if (systemMessageId > 0)
                {
                    var systemMessage = new SystemMessages().Get(systemMessageId);
                    if (sysMessageTypeId == CmsConstants.SystemMessageIdSuccess)
                    {
                        model.SystemStatus = SystemStatus.Success;
                    }
                    ModelState.AddModelError("SystemMessages", systemMessage.SystemMessageDesc);
                }
                else
                {
                    ModelState.AddModelError("SystemMessages", "Bạn vui lòng thử lại sau.");
                }
            }
            return(View(model));
        }
Exemplo n.º 5
0
        /// <summary>
        /// 根据动作编号获取动作信息(用于编辑)
        /// </summary>
        /// <param name="actionID"></param>
        /// <returns></returns>
        public static SelectResult <ActionEditModel> GetActionByID(int actionID)
        {
            List <SqlParameter> paras = new List <SqlParameter>()
            {
                new SqlParameter("@ID", SqlDbType.Int)
            };

            paras[0].Value = actionID;


            string sql = @"SELECT  act.ID ,
                                    act.ActionName ,
                                    act.ControllerID ,
                                    act.Description,
                                    c.AreaID
                            FROM    dbo.Actions act
                                    INNER JOIN dbo.Controllers c ON act.ControllerID = c.ID
                            WHERE   act.ID = @ID";
            List <ActionEditModel> list = ConvertToList <ActionEditModel> .Convert(MSSQLHelper.ExecuteDataTable(CommandType.Text, sql, paras.ToArray()));

            ActionEditModel data = null;
            string          msg  = string.Empty;

            if (list == null)
            {
                msg = PromptInformation.DBError;
            }
            else if (list.Count == 0)
            {
                msg = PromptInformation.NotExists;
            }
            else
            {
                data = list[0];
            }
            return(new SelectResult <ActionEditModel>()
            {
                DataResult = data,
                Message = msg
            });
        }
Exemplo n.º 6
0
        public ActionResult Edit(short actionId = 0)
        {
            var model = new ActionEditModel();

            if (actionId > 0)
            {
                var action = new Actions().Get(actionId);
                if (action.ActionId > 0)
                {
                    model.ActionId       = action.ActionId;
                    model.ActionName     = action.ActionName;
                    model.ActionDesc     = action.ActionDesc;
                    model.Url            = action.Url;
                    model.ParentActionId = action.ParentActionId;
                    model.ActionStatusId = action.ActionStatusId;
                    model.ActionOrder    = action.ActionOrder;
                    model.Display        = action.Display == 1;
                }
            }
            return(View(model));
        }