Exemplo n.º 1
0
    protected void rptRoles_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        switch (e.CommandName)
        {
        case "Del":
            string[]   args     = e.CommandArgument.ToString().Split(',');
            int        roleId   = Convert.ToInt32(args[0]);
            string     roleName = args[1];
            RoleParams param    = new RoleParams()
            {
                RoleId = roleId
            };

            bool result = empAuth.DeleteEmployeeRoleData(param);

            //新增後端操作記錄
            empAuth.InsertBackEndLogData(new BackEndLogData()
            {
                EmpAccount  = c.GetEmpAccount(),
                Description = string.Format(".刪除身分/Delete role .代碼/id[{0}] 名稱/name[{1}] 結果/result[{2}]", roleId, roleName, result),
                IP          = c.GetClientIP()
            });

            // log to file
            c.LoggerOfUI.InfoFormat("{0} deletes {1}, result: {2}", c.GetEmpAccount(), "role-" + roleId.ToString() + "-" + roleName, result);

            if (result)
            {
                DisplayRoles();
            }
            else
            {
                if (param.IsThereAccountsOfRole)
                {
                    Master.ShowErrorMsg(Resources.Lang.ErrMsg_ThereIsAccountOfRole);
                }
                else
                {
                    Master.ShowErrorMsg(Resources.Lang.ErrMsg_DeleteRoleFailed);
                }
            }

            break;
        }
    }