/// <summary>
 /// 绑定系统信息实体
 /// </summary>
 /// <param name="reader"></param>
 /// <returns></returns>
 private static EtlState BindEtlState(MySqlDataReader reader)
 {
     EtlState state = new EtlState();
     state.ID = Convert.ToInt32(reader["ID"]);
     state.Key = reader["Key"].ToString();
     state.Value = reader["Value"].ToString();
     state.AddTime = Convert.ToDateTime(reader["AddTime"]);
     state.Type = (EtlStateTypeOptions)Convert.ToInt32(reader["Type"]);
     state.Description = reader["Description"] == null || reader["Description"] == DBNull.Value ? string.Empty : reader["Description"].ToString();
     return state;
 }
 /// <summary>
 /// 更新状态信息
 /// </summary>
 /// <param name="state"></param>
 public static void UpdateEtlState(EtlState state)
 {
     string cmdText = @"update EtlStates set `Key`=?Key,`Value`=?Value,`Type`=?Type,`Description`=?Description where `ID`=?ID";
     MySqlParameter[] parameters = new MySqlParameter[]
     {
         new MySqlParameter("?ID", state.ID),
         new MySqlParameter("?Key", state.Key),
         new MySqlParameter("?Value", state.Value),
         new MySqlParameter("?Type", (int)state.Type),
         new MySqlParameter("?Description", state.Description)
     };
     MySqlHelper.ExecuteNonQuery(DACommonHelper.ConnectionString, cmdText, parameters);
 }
 /// <summary>
 /// 添加状态信息
 /// </summary>
 /// <param name="state"></param>
 public static void AddEtlState(EtlState state)
 {
     string cmdText = @"insert into EtlStates(`Key`,`Value`,`Type`,`AddTime`,`Description`) 
                        select ?Key,?Value,?Type,now(),?Description
                        from dual
                        where not exists(select * from EtlStates where `Key`=?Key);";
     MySqlParameter[] parameters = new MySqlParameter[]
     {
         new MySqlParameter("?Key", state.Key),
         new MySqlParameter("?Value", state.Value),
         new MySqlParameter("?Type", (int)state.Type),
         new MySqlParameter("?Description", state.Description)
     };
     int rowCount = MySqlHelper.ExecuteNonQuery(DACommonHelper.ConnectionString, cmdText, parameters);
     if (rowCount == 0)
         throw new ToUserException("状态信息已经存在!");
 }
 /// <summary>
 /// 更新状态信息
 /// </summary>
 /// <param name="state"></param>
 public void UpdateEtlState(EtlState state)
 {
     DAEtlStatesHelper.UpdateEtlState(state);
 }
 /// <summary>
 /// 添加状态信息
 /// </summary>
 /// <param name="state"></param>
 public void AddEtlState(EtlState state)
 {
     DAEtlStatesHelper.AddEtlState(state);
 }