GameFramework.DataDML.LoadSingleTableMailStateInfo C# (CSharp) Method

LoadSingleTableMailStateInfo() private static method

private static LoadSingleTableMailStateInfo ( List primaryKeys ) : GeneralRecordData
primaryKeys List
return GameFrameworkData.GeneralRecordData
        private static GeneralRecordData LoadSingleTableMailStateInfo(List<string> primaryKeys)
        {
            GeneralRecordData ret = null;
            try {
              using (MySqlCommand cmd = new MySqlCommand()) {
                cmd.Connection = DBConn.MySqlConn;
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "LoadSingleTableMailStateInfo";
                if(primaryKeys.Count != 1)
                    throw new Exception("primary key number don't match !!!");
                MySqlParameter inputParam;
                inputParam = new MySqlParameter("@_MailGuid", MySqlDbType.UInt64);
                inputParam.Direction = ParameterDirection.Input;
                inputParam.Value = (ulong)Convert.ChangeType(primaryKeys[0],typeof(ulong));
                cmd.Parameters.Add(inputParam);
                using (DbDataReader reader = cmd.ExecuteReader()) {
                  if (reader.Read()) {
                    ret = new GeneralRecordData();
                    object val;
                    TableMailStateInfo msg = new TableMailStateInfo();
                    val = reader["MailGuid"];
                    msg.MailGuid = (ulong)val;
                    ret.PrimaryKeys.Add(val.ToString());
                    val = reader["UserGuid"];
                    msg.UserGuid = (ulong)val;
                    ret.ForeignKeys.Add(val.ToString());
                    val = reader["IsRead"];
                    msg.IsRead = (bool)val;
                    val = reader["IsReceived"];
                    msg.IsReceived = (bool)val;
                    val = reader["IsDeleted"];
                    msg.IsDeleted = (bool)val;
                    val = reader["ExpiryDate"];
                    msg.ExpiryDate = (string)val;
                    ret.DataVersion = (int)reader["DataVersion"];
                    ret.Data = DbDataSerializer.Encode(msg);
                  }
                }
              }
            } catch (Exception ex) {
              DBConn.Close();
              throw ex;
            }
            return ret;
        }