public static bool Equals(string typeStr, EUserActionType type) { if (string.IsNullOrEmpty(typeStr)) { return(false); } if (string.Equals(typeStr.ToLower(), GetValue(type).ToLower())) { return(true); } return(false); }
public static string GetText(EUserActionType type) { if (type == EUserActionType.Login) { return("用户登录成功"); } else if (type == EUserActionType.LoginFailed) { return("用户登录失败"); } else if (type == EUserActionType.WritingAdd) { return("新增稿件"); } else if (type == EUserActionType.WritingEdit) { return("编辑稿件"); } else if (type == EUserActionType.WritingDelete) { return("删除稿件"); } else if (type == EUserActionType.UpdateEmail) { return("修改邮箱"); } else if (type == EUserActionType.UpdateMobile) { return("修改手机"); } else if (type == EUserActionType.UpdatePassword) { return("修改密码"); } else { throw new Exception(); } }
public static string GetValue(EUserActionType type) { if (type == EUserActionType.Login) { return("Login"); } else if (type == EUserActionType.LoginFailed) { return("LoginFailed"); } else if (type == EUserActionType.WritingAdd) { return("WritingAdd"); } else if (type == EUserActionType.WritingEdit) { return("WritingEdit"); } else if (type == EUserActionType.WritingDelete) { return("WritingDelete"); } else if (type == EUserActionType.UpdateEmail) { return("UpdateEmail"); } else if (type == EUserActionType.UpdateMobile) { return("UpdateMobile"); } else if (type == EUserActionType.UpdatePassword) { return("UpdatePassword"); } else { throw new Exception(); } }
public static void AddUserLog(string userName, EUserActionType actionType, string summary) { if (!ConfigManager.SystemConfigInfo.IsLogUser) { return; } try { BaiRongDataProvider.UserLogDao.Delete(ConfigManager.SystemConfigInfo.IsTimeThreshold ? ConfigManager.SystemConfigInfo.TimeThreshold : 0, ConfigManager.SystemConfigInfo.IsCounterThreshold ? ConfigManager.SystemConfigInfo.CounterThreshold * 10000 : 0); if (!string.IsNullOrEmpty(summary)) { summary = StringUtils.MaxLengthText(summary, 250); } BaiRongDataProvider.UserLogDao.Insert(new UserLogInfo(0, userName, PageUtils.GetIpAddress(), DateTime.Now, EUserActionTypeUtils.GetValue(actionType), summary)); } catch (Exception ex) { AddErrorLog(ex); } }
public static bool Equals(EUserActionType type, string typeStr) { return(Equals(typeStr, type)); }
public static void AddUserLog(string userName, EUserActionType actionType, string summary) { AddUserLog(userName, EUserActionTypeUtils.GetText(actionType), summary); }