示例#1
0
 /// <summary> 格式化
 /// </summary>
 private void dgvSyncData_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     try
     {
         if (e.Value == null || string.IsNullOrEmpty(e.Value.ToString()))
         {
             return;
         }
         string fieldNmae = dgvSyncData.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("last_sync_time"))
         {
             long ticks = (long)e.Value;
             e.Value = Common.UtcLongToLocalDateTime(ticks);
         }
     }
     catch (Exception ex)
     {
         GlobalStaticObj_Server.GlobalLogService.WriteLog("数据同步", ex);
         MessageBoxEx.ShowWarning("程序异常");
     }
 }
示例#2
0
        /// <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);
            }
        }
示例#3
0
        /// <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);
        }
示例#4
0
        /// <summary> 接口调用记录
        /// </summary>
        /// <param name="enumInterfaceType">接口类型</param>
        /// <param name="enumExternalSys">外部系统</param>
        /// <param name="totalCount">同步后本地总条数</param>
        /// <param name="updateCount">更新条数</param
        /// <param name="dtLastSyncTime">同步时间</param>
        /// <returns>返回true or false</returns>
        public static bool WriteInterficeSync(DataSources.EnumInterfaceType enumInterfaceType, DataSources.EnumExternalSys enumExternalSys, int totalCount, int updateCount, DateTime dtLastSyncTime)
        {
            string enumName = DataSources.GetDescription(enumInterfaceType, true);
            string keyName  = "data_sync_id";
            string keyValue = Convert.ToInt32(enumExternalSys).ToString() + "-" + Convert.ToInt32(enumInterfaceType).ToString();
            Dictionary <string, string> dicFields = new Dictionary <string, string>();

            dicFields.Add("local_total_num", totalCount.ToString());
            dicFields.Add("update_total_num", updateCount.ToString());
            dicFields.Add("last_sync_time", Common.LocalDateTimeToUtcLong(dtLastSyncTime).ToString());
            dicFields.Add("update_time", Common.LocalDateTimeToUtcLong(GlobalStaticObj_Server.Instance.CurrentDateTime).ToString());
            bool flag = DBHelper.Submit_AddOrEdit("接口调用记录-" + enumName, GlobalStaticObj_Server.DbPrefix + GlobalStaticObj_Server.CommAccCode, "sys_data_sync", keyName, keyValue, dicFields);

            return(flag);
        }