/// <summary> /// 绑定用户资产信息 /// </summary> /// <param name="slKeyCode"></param> /// <param name="propertyId"></param> /// <param name="isBind"></param> /// <returns></returns> public static bool BindUserAsset(string slKeyCode, int propertyId, int isBind = 1) { try { string eoopBindAssetUrl = string.Format("{0}?slKeyCode={1}&propertyId={2}&isBind={3}", GetEoopAppSettings("EOOP_USER_ASSET_BIND"), slKeyCode, propertyId, isBind); string result = GETEoopHttpRequest(eoopBindAssetUrl); BaseEoopResponse resultResponse = (BaseEoopResponse)JsonConvert.DeserializeObject(result, typeof(BaseEoopResponse)); return(resultResponse.ok); } catch (Exception ex) { Exception apiEx = new Exception("用户资产绑定失败:" + ex.Message, ex); throw apiEx; } }
/// <summary> /// 添加 BDO 客户端升级日志 /// </summary> /// <param name="logs"></param> /// <returns></returns> public static bool AddBDOUpgradeLogs(UpgradeLogs logs) { try { string bdoUpgradeLogURL = GetEoopAppSettings("EOOP_BDO_CLIENT_LOG"); string requesstBody = JsonConvert.SerializeObject(logs); string result = POSTEoopHttpRequest(bdoUpgradeLogURL, requesstBody); BaseEoopResponse resultResponse = (BaseEoopResponse)JsonConvert.DeserializeObject(result, typeof(BaseEoopResponse)); return(resultResponse.ok); } catch (Exception ex) { //Exception clientEx = new Exception("添加客户端升级日志失败:" + ex.Message, ex); //throw clientEx; return(false); } }
/// <summary> /// 添加 BDO 客户端日志 /// </summary> /// <param name="logs"></param> /// <returns></returns> public static bool AddBDOClientLogs(HrmResource loginUser, string userName, string slKeyCode, string itMark, string logType, string logData) { try { ClientLogsV2 clientLogsV2 = new ClientLogsV2(); clientLogsV2.company = !string.IsNullOrEmpty(loginUser.subcompanyname) ? loginUser.subcompanyname : ""; clientLogsV2.department = !string.IsNullOrEmpty(loginUser.departmentname) ? loginUser.departmentname : ""; //clientLogsV2.userName = !string.IsNullOrEmpty(userName) ? userName : ""; //clientLogsV2.loginId = !string.IsNullOrEmpty(loginUser.userId) ? loginUser.userId : ""; clientLogsV2.userName = !string.IsNullOrEmpty(loginUser.name) ? loginUser.name : ""; clientLogsV2.loginId = !string.IsNullOrEmpty(loginUser.loginid) ? loginUser.loginid : ""; clientLogsV2.userSlCode = !string.IsNullOrEmpty(slKeyCode) ? slKeyCode : ""; clientLogsV2.itMark = !string.IsNullOrEmpty(itMark) ? itMark : ""; HardwareHelper hardwareInfo = HardwareHelper.Instance(); clientLogsV2.pcName = hardwareInfo.ComputerName; clientLogsV2.cpuId = hardwareInfo.CpuID; clientLogsV2.cpuName = hardwareInfo.CpuName; clientLogsV2.diskName = hardwareInfo.DiskID; clientLogsV2.mcAddress = hardwareInfo.MacAddress; clientLogsV2.ip = hardwareInfo.IpAddress; clientLogsV2.ram = Math.Ceiling(Convert.ToDecimal(hardwareInfo.TotalPhysicalMemory) / 1024 / 1024 / 1024).ToString() + "G"; clientLogsV2.logDate = DateTime.Now.ToString("yyyy-MM-dd"); clientLogsV2.logTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); clientLogsV2.logType = logType; //TODO: .... clientLogsV2.logTypeValue = "1"; //TODO: .... clientLogsV2.logData = logData; // string bdoClientLogURL = GetEoopAppSettings("EOOP_BDO_CLIENT_LOG"); string requesstBody = JsonConvert.SerializeObject(clientLogsV2); string result = POSTEoopHttpRequest(bdoClientLogURL, requesstBody); BaseEoopResponse resultResponse = (BaseEoopResponse)JsonConvert.DeserializeObject(result, typeof(BaseEoopResponse)); return(resultResponse.ok); } catch (Exception ex) { //Exception clientEx = new Exception("添加客户端日志失败:" + ex.Message, ex); //throw clientEx; return(false); } }