/// <summary> 格式化 /// </summary> private void dgvSyncData_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if (e.Value == null || string.IsNullOrEmpty(e.Value.ToString())) { return; } string fieldNmae = dgvSyncDataLog.Columns[e.ColumnIndex].DataPropertyName; if (fieldNmae.Equals("business_name")) { DataSources.EnumInterfaceType enumInterfaceType = (DataSources.EnumInterfaceType)Convert.ToInt16(e.Value.ToString()); e.Value = DataSources.GetDescription(enumInterfaceType, true); } if (fieldNmae.Equals("external_sys")) { DataSources.EnumExternalSys enumExternalSys = (DataSources.EnumExternalSys)Convert.ToInt16(e.Value.ToString()); e.Value = DataSources.GetDescription(enumExternalSys, true); } if (fieldNmae.Equals("sync_direction")) { DataSources.EnumSyncDirection enumSyncDirection = (DataSources.EnumSyncDirection)Convert.ToInt16(e.Value.ToString()); e.Value = DataSources.GetDescription(enumSyncDirection, true); } if (fieldNmae.Equals("sync_start_time") || fieldNmae.Equals("sync_end_time")) { long ticks = (long)e.Value; e.Value = Common.UtcLongToLocalDateTime(ticks); } }
/// <summary> 接口调用日志 /// </summary> /// <param name="enumInterfaceType">接口类型</param> /// <param name="enumExternalSys">外部系统</param> /// <param name="enumSyncDirection">同步方向</param> /// <param name="tableName">更新表名</param> /// <param name="dtpStart">开始时间</param> /// <param name="dtpEnd">结束时间</param> /// <param name="updateCount">更新条数</param> /// <param name="errMsg">错误原因</param> /// <returns>返回true or false</returns> public static bool WriteInterficeSyncLog(DataSources.EnumInterfaceType enumInterfaceType, DataSources.EnumExternalSys enumExternalSys, DataSources.EnumSyncDirection enumSyncDirection, string tableName, DateTime dtpStart, DateTime dtpEnd, int updateCount, string errMsg) { Dictionary <string, string> dicFields = new Dictionary <string, string>(); dicFields.Add("data_sync_log_id", Guid.NewGuid().ToString()); dicFields.Add("external_sys", Convert.ToInt32(enumExternalSys).ToString()); string enumName = DataSources.GetDescription(enumInterfaceType, true); dicFields.Add("business_name", Convert.ToInt32(enumInterfaceType).ToString()); dicFields.Add("table_name", tableName); dicFields.Add("sync_start_time", Common.LocalDateTimeToUtcLong(dtpStart).ToString()); dicFields.Add("sync_end_time", Common.LocalDateTimeToUtcLong(dtpEnd).ToString()); dicFields.Add("sync_direction", Convert.ToInt32(enumSyncDirection).ToString()); dicFields.Add("changes_num", updateCount.ToString()); dicFields.Add("sync_result", errMsg); dicFields.Add("create_time", Common.LocalDateTimeToUtcLong(GlobalStaticObj_Server.Instance.CurrentDateTime).ToString()); bool flag = DBHelper.Submit_AddOrEdit("接口调用日志-" + enumName, GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, "sys_data_sync_log", "", "", dicFields); return(flag); }